pub struct Journalist { /* private fields */ }Expand description
Journalists: ingredients. Journalists have a signing/verifying key, a reply key, a fetch key, and a collection of one-time signed key bundles
Implementations§
Source§impl Journalist
impl Journalist
pub fn new<R: RngCore + CryptoRng>(rng: &mut R, num_keybundles: usize) -> Self
pub fn public(&self, idx: usize) -> JournalistPublicView
Sourcepub fn long_term_bytes(&self) -> JournalistLongTermBytes
pub fn long_term_bytes(&self) -> JournalistLongTermBytes
Extract the long-term keypairs as raw bytes, sufficient to
reconstruct the long-term Journalist state via
Journalist::from_long_term_bytes.
Sourcepub fn from_long_term_bytes(parts: JournalistLongTermBytes) -> Self
pub fn from_long_term_bytes(parts: JournalistLongTermBytes) -> Self
Reconstruct the long-term Journalist state from raw key bytes.
Sourcepub fn generate_ephemeral_bundles<R: RngCore + CryptoRng>(
&mut self,
rng: &mut R,
n: usize,
)
pub fn generate_ephemeral_bundles<R: RngCore + CryptoRng>( &mut self, rng: &mut R, n: usize, )
Generate n fresh signed ephemeral key bundles and retain them in memory.
The public halves are uploaded to the server via
create_ephemeral_key_request.
The secret halves should be persisted via Journalist::ephemeral_bundle_bytes.
Sourcepub fn ephemeral_bundle_bytes(&self) -> Vec<EphemeralBundleBytes>
pub fn ephemeral_bundle_bytes(&self) -> Vec<EphemeralBundleBytes>
Extract the secret halves of the retained ephemeral key bundles so we can
reconstruct them via Journalist::load_ephemeral_bundles.
Used by the demo.
Sourcepub fn load_ephemeral_bundles(&mut self, bundles: Vec<EphemeralBundleBytes>)
pub fn load_ephemeral_bundles(&mut self, bundles: Vec<EphemeralBundleBytes>)
Reconstruct ephemeral key bundles from persisted secret bytes.
Used by the demo
Trait Implementations§
Source§impl Client for Journalist
impl Client for Journalist
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§impl Enrollable for Journalist
impl Enrollable for Journalist
fn enroll(&self) -> Enrollment
Source§fn signed_keybundles(&self) -> Vec<SignedKeyBundlePublic> ⓘ
fn signed_keybundles(&self) -> Vec<SignedKeyBundlePublic> ⓘ
SignedKeyBundlePublic: the public keys together with the
journalist’s self-signature over them.fn signing_key(&self) -> &VerifyingKey
Source§impl UserSecret for Journalist
Private, common to all users, implemented for Journalists
impl UserSecret for Journalist
Private, common to all users, implemented for Journalists
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 own_message_auth_pk(&self) -> &MessagePublicKey
fn own_message_auth_pk(&self) -> &MessagePublicKey
pk^APKE.fn build_message(&self, message: Vec<u8>) -> Plaintext
fn keybundles(&self) -> Vec<&MessageKeyBundle>
Auto Trait Implementations§
impl Freeze for Journalist
impl RefUnwindSafe for Journalist
impl Send for Journalist
impl Sync for Journalist
impl Unpin for Journalist
impl UnsafeUnpin for Journalist
impl UnwindSafe for Journalist
Blanket Implementations§
Source§impl<T> Api for Twhere
T: Client,
impl<T> Api for Twhere
T: Client,
Source§fn fetch_message_ids<R>(&self, _rng: &mut R) -> MessageChallengeFetchRequestwhere
R: RngCore + CryptoRng,
fn fetch_message_ids<R>(&self, _rng: &mut R) -> MessageChallengeFetchRequestwhere
R: RngCore + CryptoRng,
Creates a request to fetch encrypted message IDs from the server.
Corresponds to step 7 in the protocol spec. The server returns a
fixed-size set of challenges (encrypted message IDs) that the client
must solve using solve_fetch_challenges.
Source§fn solve_fetch_challenges(
&self,
challenges: &[FetchResponse],
) -> Result<Vec<Uuid>, Error>where
T: UserSecret,
fn solve_fetch_challenges(
&self,
challenges: &[FetchResponse],
) -> Result<Vec<Uuid>, Error>where
T: UserSecret,
Solves the encrypted message-ID challenges returned by the server.
Each FetchResponse contains an encrypted message ID and a
per-request DH share. The client uses its fetch keypair to recover
message IDs that were addressed to it, discarding the rest.
Returns the set of Uuids for messages belonging to this client.
Source§fn fetch_message(&self, message_id: Uuid) -> Option<MessageFetchRequest>
fn fetch_message(&self, message_id: Uuid) -> Option<MessageFetchRequest>
Creates a request to fetch a specific message by its ID.
Corresponds to steps 8 and 10 in the protocol spec. Returns None
if the request cannot be constructed (the default implementation
always returns Some).
Source§fn submit_message<R, S, P>(
&self,
rng: &mut R,
message: &[u8],
sender: &S,
recipient: &P,
) -> Result<Envelope, Error>where
R: RngCore + CryptoRng,
S: UserSecret,
P: UserPublic,
fn submit_message<R, S, P>(
&self,
rng: &mut R,
message: &[u8],
sender: &S,
recipient: &P,
) -> Result<Envelope, Error>where
R: RngCore + CryptoRng,
S: UserSecret,
P: UserPublic,
Encrypts and submits a message from sender to recipient.
Handles padding, plaintext construction (including sender reply keys), and hybrid encryption. This covers step 6 (source submissions) and step 9 (journalist replies) in the protocol spec.
§Errors
Returns an error if encryption fails.
Source§fn handle_welcome(
&mut self,
welcome: &WelcomeBundle,
fpf_verifying_key: &VerifyingKey,
) -> Result<(), Error>
fn handle_welcome( &mut self, welcome: &WelcomeBundle, fpf_verifying_key: &VerifyingKey, ) -> Result<(), Error>
WelcomeBundle and stores the newsroom key (step 5). Read moreSource§fn verify_long_term(
&self,
journalist: &JournalistLongTermView,
newsroom_verifying_key: &VerifyingKey,
) -> Result<(), Error>
fn verify_long_term( &self, journalist: &JournalistLongTermView, newsroom_verifying_key: &VerifyingKey, ) -> Result<(), Error>
Source§fn verify_ephemeral(
&self,
long_term: &JournalistLongTermView,
ephemeral: &(KeyBundlePublic, Signature<JournalistEphemeralKey>),
) -> Result<JournalistPublicView, Error>
fn verify_ephemeral( &self, long_term: &JournalistLongTermView, ephemeral: &(KeyBundlePublic, Signature<JournalistEphemeralKey>), ) -> Result<JournalistPublicView, Error>
JournalistPublicView for encryption. Read more