Skip to main content

Server

Struct Server 

Source
pub struct Server { /* private fields */ }
Expand description

Server session for handling source requests

Implementations§

Source§

impl Server

Source

pub fn new() -> Self

Create a new server session

TODO: Load newsroom keys from storage if they exist.

Source

pub fn create_newsroom_setup_request<R: RngCore + CryptoRng>( &mut self, rng: R, ) -> Result<NewsroomSetupRequest, Error>

Generate a new newsroom setup request.

This creates a newsroom key pair, stores it in the server storage, and returns a setup request that can be sent to FPF for signing.

TODO: The caller should persist these keys to disk.

Source

pub fn setup_journalist( &mut self, request: JournalistSetupRequest, ) -> Result<JournalistSetupResponse, Error>

Setup a journalist. This corresponds to step 3.1 in the spec.

The newsroom then signs the bundle of journalist public keys.

TODO: There is a manual verification step here, so the caller should instruct the user to stop, verify the fingerprint out of band, and then proceed. The caller should also persist the fingerprint and signature in its local data store.

TODO(later): How to handle signing when offline? (Not relevant for benchmarking)

Source

pub fn handle_ephemeral_key_request( &mut self, request: JournalistEphemeralKeyRequest, ) -> Result<(), Error>

Handle journalist ephemeral key replenishment. This corresponds to step 3.2 in the spec.

The journalist sends ephemeral keys signed by their signing key, and the server verifies the signature and stores the ephemeral keys.

§Errors

Returns an error if the journalist is not found in storage, or if any bundle signature fails verification.

Source

pub fn newsroom_verifying_key(&self) -> Option<VerifyingKey>

Returns the newsroom verifying key, if one has been generated.

Source

pub fn set_fpf_signature(&mut self, signature: Signature<FpfOnNewsroom>)

Set the FPF signature for the newsroom

Source

pub fn ephemeral_keys_count(&self, journalist_id: Uuid) -> usize

Get the ephemeral key count for a journalist

Source

pub fn has_ephemeral_keys(&self, journalist_id: Uuid) -> bool

Check if a journalist has ephemeral keys available

Source

pub fn find_journalist_id(&self, verifying_key: &VerifyingKey) -> Option<Uuid>

Find journalist ID by verifying key

Source

pub fn has_message(&self, message_id: &Uuid) -> bool

Check if a message exists with the given ID

Source

pub fn handle_source_newsroom_key_request( &self, _request: SourceNewsroomKeyRequest, ) -> SourceNewsroomKeyResponse

Handle source newsroom key request (step 5)

Source

pub fn handle_source_journalist_key_request<R: RngCore + CryptoRng>( &mut self, _request: SourceJournalistKeyRequest, rng: &mut R, ) -> Vec<SourceJournalistKeyResponse>

Handle source journalist key request (step 5)

Source

pub fn handle_message_submit<R: RngCore + CryptoRng>( &mut self, message: Envelope, rng: &mut R, ) -> Result<Uuid, Error>

Handle message submission (step 6 for sources, step 9 for journalists)

Source

pub fn handle_request_challenges<R: RngCore + CryptoRng>( &self, _request: MessageChallengeFetchRequest, rng: &mut R, ) -> Result<MessageChallengeFetchResponse, Error>

Compute “hints”/challenges for message id fetch request (step 7)

Source

pub fn handle_message_fetch( &self, request: MessageFetchRequest, ) -> Option<Envelope>

Handle message ID fetch request (step 7)

TODO: Nothing here prevents someone from requesting messages that aren’t theirs? Should request messages have a signature? Handle message fetch request (step 8/10)

Trait Implementations§

Source§

impl Default for Server

Source§

fn default() -> Server

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Classify for T

§

type Classified = T

§

fn classify(self) -> T

§

impl<T> Classify for T

§

type Classified = T

§

fn classify(self) -> T

§

impl<T> Declassify for T

§

type Declassified = T

§

fn declassify(self) -> T

§

impl<T> Declassify for T

§

type Declassified = T

§

fn declassify(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V