pub struct ServerStorage { /* private fields */ }Implementations§
Source§impl ServerStorage
impl ServerStorage
Sourcepub fn add_ephemeral_keys(
&mut self,
journalist_id: Uuid,
keys: Vec<SignedKeyBundlePublic>,
)
pub fn add_ephemeral_keys( &mut self, journalist_id: Uuid, keys: Vec<SignedKeyBundlePublic>, )
Add ephemeral keys for a journalist
Sourcepub fn pop_random_ephemeral_keys<R: RngCore + CryptoRng>(
&mut self,
journalist_id: Uuid,
rng: &mut R,
) -> Option<SignedKeyBundlePublic>
pub fn pop_random_ephemeral_keys<R: RngCore + CryptoRng>( &mut self, journalist_id: Uuid, rng: &mut R, ) -> Option<SignedKeyBundlePublic>
Get a random ephemeral key set for a journalist and remove it from the pool Returns None if no keys are available for this journalist
Note: This method deletes the ephemeral key from storage. The returned key is permanently removed from the journalist’s ephemeral key pool.
Sourcepub fn get_all_ephemeral_keys<R: RngCore + CryptoRng>(
&mut self,
rng: &mut R,
) -> Vec<(Uuid, SignedKeyBundlePublic)>
pub fn get_all_ephemeral_keys<R: RngCore + CryptoRng>( &mut self, rng: &mut R, ) -> Vec<(Uuid, SignedKeyBundlePublic)>
Get random ephemeral keys for all journalists Returns a vector of (journalist_id, ephemeral_keys) pairs Only includes journalists that have available keys
Note: This method deletes the ephemeral keys from storage. Each call removes the returned keys from the journalist’s ephemeral key pool.
Sourcepub fn ephemeral_keys_count(&self, journalist_id: Uuid) -> usize
pub fn ephemeral_keys_count(&self, journalist_id: Uuid) -> usize
Check how many ephemeral keys are available for a journalist
Sourcepub fn has_ephemeral_keys(&self, journalist_id: Uuid) -> bool
pub fn has_ephemeral_keys(&self, journalist_id: Uuid) -> bool
Check if a journalist has any ephemeral keys available
Sourcepub fn get_journalists(
&self,
) -> &HashMap<Uuid, (VerifyingKey, DHPublicKey, MessagePublicKey, Signature<JournalistLongTermKey>, SignedLongtermPubKeyBytes, Signature<NewsroomOnJournalist>)>
pub fn get_journalists( &self, ) -> &HashMap<Uuid, (VerifyingKey, DHPublicKey, MessagePublicKey, Signature<JournalistLongTermKey>, SignedLongtermPubKeyBytes, Signature<NewsroomOnJournalist>)>
Get all journalists
Sourcepub fn add_journalist(
&mut self,
journalist: Enrollment,
newsroom_signature: Signature<NewsroomOnJournalist>,
) -> Uuid
pub fn add_journalist( &mut self, journalist: Enrollment, newsroom_signature: Signature<NewsroomOnJournalist>, ) -> Uuid
Add a journalist to storage and return the generated UUID
Sourcepub fn find_journalist_by_verifying_key(
&self,
verifying_key: &VerifyingKey,
) -> Option<Uuid>
pub fn find_journalist_by_verifying_key( &self, verifying_key: &VerifyingKey, ) -> Option<Uuid>
Find a journalist by their verifying key Returns the journalist ID if found
TODO: Remove?
Sourcepub fn get_messages(&self) -> &HashMap<Uuid, Envelope>
pub fn get_messages(&self) -> &HashMap<Uuid, Envelope>
Get all messages
Sourcepub fn add_message(&mut self, message_id: Uuid, message: Envelope)
pub fn add_message(&mut self, message_id: Uuid, message: Envelope)
Add a message to storage