pub struct Source { /* private fields */ }Expand description
A source and their long-term key material (step 4).
A source’s keys are fully determined by their passphrase: the fetch key,
APKE key, and PKE key are all derived from a master key via Argon2id and
a domain-separated KDF. Returning sources reconstruct the same keys by
calling Source::from_passphrase with the same passphrase.
Implementations§
Source§impl Source
impl Source
Sourcepub fn new<R: RngCore + CryptoRng>(rng: R) -> Self
pub fn new<R: RngCore + CryptoRng>(rng: R) -> Self
Create a new source with a randomly generated passphrase.
TODO / For testing only - in production the passphrase must be a mnemonic of sufficient entropy generated and displayed to the source.
Sourcepub fn passphrase(&self) -> &[u8] ⓘ
pub fn passphrase(&self) -> &[u8] ⓘ
Returns the source’s passphrase.
§Security
The passphrase is the root secret from which all source keys are derived. It MUST be stored and transmitted only over secure channels.
Sourcepub fn from_passphrase(passphrase: &[u8]) -> Self
pub fn from_passphrase(passphrase: &[u8]) -> Self
Reconstruct source keys from a passphrase (step 4).
Derives a master key via Source::derive_master_key, then derives
each private key from the master key using a domain-separated KDF.
Sourcepub fn public(&self) -> SourcePublicView
pub fn public(&self) -> SourcePublicView
Returns the public key material for this source.
Trait Implementations§
Source§impl Api for Source
impl Api for Source
Source§fn newsroom_verifying_key(&self) -> Option<&VerifyingKey>
fn newsroom_verifying_key(&self) -> Option<&VerifyingKey>
Source§fn set_newsroom_verifying_key(&mut self, key: VerifyingKey)
fn set_newsroom_verifying_key(&mut self, key: VerifyingKey)
Source§fn fetch_newsroom_keys(&self) -> SourceNewsroomKeyRequest
fn fetch_newsroom_keys(&self) -> SourceNewsroomKeyRequest
Source§fn fetch_journalist_keys(&self) -> SourceJournalistKeyRequest
fn fetch_journalist_keys(&self) -> SourceJournalistKeyRequest
Source§fn fetch_message_ids<R: RngCore + CryptoRng>(
&self,
_rng: &mut R,
) -> MessageChallengeFetchRequest
fn fetch_message_ids<R: RngCore + CryptoRng>( &self, _rng: &mut R, ) -> MessageChallengeFetchRequest
Source§fn solve_fetch_challenges(
&self,
challenges: &[FetchResponse],
) -> Result<Vec<Uuid>, Error>where
Self: Sized + UserSecret,
fn solve_fetch_challenges(
&self,
challenges: &[FetchResponse],
) -> Result<Vec<Uuid>, Error>where
Self: Sized + UserSecret,
Source§fn fetch_message(&self, message_id: Uuid) -> Option<MessageFetchRequest>
fn fetch_message(&self, message_id: Uuid) -> Option<MessageFetchRequest>
Source§fn submit_message<R, S, P>(
&self,
rng: &mut R,
message: &[u8],
sender: &S,
recipient: &P,
) -> Result<Envelope, Error>
fn submit_message<R, S, P>( &self, rng: &mut R, message: &[u8], sender: &S, recipient: &P, ) -> Result<Envelope, Error>
Source§fn handle_newsroom_key_response(
&mut self,
response: &SourceNewsroomKeyResponse,
fpf_verifying_key: &VerifyingKey,
) -> Result<(), Error>
fn handle_newsroom_key_response( &mut self, response: &SourceNewsroomKeyResponse, fpf_verifying_key: &VerifyingKey, ) -> Result<(), Error>
Source§fn handle_journalist_key_response(
&self,
response: &SourceJournalistKeyResponse,
newsroom_verifying_key: &VerifyingKey,
) -> Result<(), Error>
fn handle_journalist_key_response( &self, response: &SourceJournalistKeyResponse, newsroom_verifying_key: &VerifyingKey, ) -> Result<(), Error>
Source§impl UserSecret for Source
Private, common to all users, implemented for sources
impl UserSecret for Source
Private, common to all users, implemented for sources
fn num_bundles(&self) -> usize
fn fetch_keypair(&self) -> (&DHPrivateKey, &DHPublicKey)
Source§fn message_auth_key(&self) -> &MessagePrivateKey
fn message_auth_key(&self) -> &MessagePrivateKey
sk^APKE.Source§fn message_auth_pk(&self) -> &MessagePublicKey
fn message_auth_pk(&self) -> &MessagePublicKey
pk^APKE.