pub struct InMemSignalProtocolStore {
pub session_store: InMemSessionStore,
pub pre_key_store: InMemPreKeyStore,
pub signed_pre_key_store: InMemSignedPreKeyStore,
pub kyber_pre_key_store: InMemKyberPreKeyStore,
pub identity_store: InMemIdentityKeyStore,
pub sender_key_store: InMemSenderKeyStore,
}
Expand description
Reference implementation of traits::ProtocolStore.
Fields§
§session_store: InMemSessionStore
§pre_key_store: InMemPreKeyStore
§signed_pre_key_store: InMemSignedPreKeyStore
§kyber_pre_key_store: InMemKyberPreKeyStore
§identity_store: InMemIdentityKeyStore
§sender_key_store: InMemSenderKeyStore
Implementations§
source§impl InMemSignalProtocolStore
impl InMemSignalProtocolStore
sourcepub fn new(key_pair: IdentityKeyPair, registration_id: u32) -> Result<Self>
pub fn new(key_pair: IdentityKeyPair, registration_id: u32) -> Result<Self>
Create an object with the minimal implementation of traits::ProtocolStore, representing
the given identity key_pair
along with the separate randomly chosen registration_id
.
sourcepub fn all_pre_key_ids(&self) -> impl Iterator<Item = &PreKeyId>
pub fn all_pre_key_ids(&self) -> impl Iterator<Item = &PreKeyId>
Returns all registered pre-key ids
sourcepub fn all_signed_pre_key_ids(&self) -> impl Iterator<Item = &SignedPreKeyId>
pub fn all_signed_pre_key_ids(&self) -> impl Iterator<Item = &SignedPreKeyId>
Returns all registered signed pre-key ids
sourcepub fn all_kyber_pre_key_ids(&self) -> impl Iterator<Item = &KyberPreKeyId>
pub fn all_kyber_pre_key_ids(&self) -> impl Iterator<Item = &KyberPreKeyId>
Returns all registered Kyber pre-key ids
Trait Implementations§
source§impl Clone for InMemSignalProtocolStore
impl Clone for InMemSignalProtocolStore
source§fn clone(&self) -> InMemSignalProtocolStore
fn clone(&self) -> InMemSignalProtocolStore
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl IdentityKeyStore for InMemSignalProtocolStore
impl IdentityKeyStore for InMemSignalProtocolStore
source§fn get_identity_key_pair<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IdentityKeyPair>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_identity_key_pair<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IdentityKeyPair>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return the single specific identity the store is assumed to represent, with private key.
source§fn get_local_registration_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u32>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_local_registration_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u32>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn save_identity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
address: &'life1 ProtocolAddress,
identity: &'life2 IdentityKey,
) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_identity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
address: &'life1 ProtocolAddress,
identity: &'life2 IdentityKey,
) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Record an identity into the store. The identity is then considered “trusted”. Read more
source§fn is_trusted_identity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 ProtocolAddress,
identity: &'life2 IdentityKey,
direction: Direction,
) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn is_trusted_identity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 ProtocolAddress,
identity: &'life2 IdentityKey,
direction: Direction,
) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Return whether an identity is trusted for the role specified by
direction
.source§fn get_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 ProtocolAddress,
) -> Pin<Box<dyn Future<Output = Result<Option<IdentityKey>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 ProtocolAddress,
) -> Pin<Box<dyn Future<Output = Result<Option<IdentityKey>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the public identity for the given
address
, if known.source§impl KyberPreKeyStore for InMemSignalProtocolStore
impl KyberPreKeyStore for InMemSignalProtocolStore
source§fn get_kyber_pre_key<'life0, 'async_trait>(
&'life0 self,
kyber_prekey_id: KyberPreKeyId,
) -> Pin<Box<dyn Future<Output = Result<KyberPreKeyRecord>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_kyber_pre_key<'life0, 'async_trait>(
&'life0 self,
kyber_prekey_id: KyberPreKeyId,
) -> Pin<Box<dyn Future<Output = Result<KyberPreKeyRecord>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Look up the signed kyber pre-key corresponding to
kyber_prekey_id
.source§fn save_kyber_pre_key<'life0, 'life1, 'async_trait>(
&'life0 mut self,
kyber_prekey_id: KyberPreKeyId,
record: &'life1 KyberPreKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_kyber_pre_key<'life0, 'life1, 'async_trait>(
&'life0 mut self,
kyber_prekey_id: KyberPreKeyId,
record: &'life1 KyberPreKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set the entry for
kyber_prekey_id
to the value of record
.source§fn mark_kyber_pre_key_used<'life0, 'async_trait>(
&'life0 mut self,
kyber_prekey_id: KyberPreKeyId,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_kyber_pre_key_used<'life0, 'async_trait>(
&'life0 mut self,
kyber_prekey_id: KyberPreKeyId,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark the entry for
kyber_prekey_id
as “used”.
This would mean different things for one-time and last-resort Kyber keys.source§impl PreKeyStore for InMemSignalProtocolStore
impl PreKeyStore for InMemSignalProtocolStore
source§fn get_pre_key<'life0, 'async_trait>(
&'life0 self,
id: PreKeyId,
) -> Pin<Box<dyn Future<Output = Result<PreKeyRecord>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_pre_key<'life0, 'async_trait>(
&'life0 self,
id: PreKeyId,
) -> Pin<Box<dyn Future<Output = Result<PreKeyRecord>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Look up the pre-key corresponding to
prekey_id
.source§fn save_pre_key<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: PreKeyId,
record: &'life1 PreKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_pre_key<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: PreKeyId,
record: &'life1 PreKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set the entry for
prekey_id
to the value of record
.source§impl SenderKeyStore for InMemSignalProtocolStore
impl SenderKeyStore for InMemSignalProtocolStore
source§fn store_sender_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
sender: &'life1 ProtocolAddress,
distribution_id: Uuid,
record: &'life2 SenderKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store_sender_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
sender: &'life1 ProtocolAddress,
distribution_id: Uuid,
record: &'life2 SenderKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Assign
record
to the entry for (sender, distribution_id)
.source§fn load_sender_key<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sender: &'life1 ProtocolAddress,
distribution_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<SenderKeyRecord>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_sender_key<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sender: &'life1 ProtocolAddress,
distribution_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<SenderKeyRecord>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Look up the entry corresponding to
(sender, distribution_id)
.source§impl SessionStore for InMemSignalProtocolStore
impl SessionStore for InMemSignalProtocolStore
source§fn load_session<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 ProtocolAddress,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionRecord>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_session<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 ProtocolAddress,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionRecord>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Look up the session corresponding to
address
.source§fn store_session<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
address: &'life1 ProtocolAddress,
record: &'life2 SessionRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store_session<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
address: &'life1 ProtocolAddress,
record: &'life2 SessionRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Set the entry for
address
to the value of record
.source§impl SignedPreKeyStore for InMemSignalProtocolStore
impl SignedPreKeyStore for InMemSignalProtocolStore
source§fn get_signed_pre_key<'life0, 'async_trait>(
&'life0 self,
id: SignedPreKeyId,
) -> Pin<Box<dyn Future<Output = Result<SignedPreKeyRecord>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_signed_pre_key<'life0, 'async_trait>(
&'life0 self,
id: SignedPreKeyId,
) -> Pin<Box<dyn Future<Output = Result<SignedPreKeyRecord>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Look up the signed pre-key corresponding to
signed_prekey_id
.source§fn save_signed_pre_key<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: SignedPreKeyId,
record: &'life1 SignedPreKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_signed_pre_key<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: SignedPreKeyId,
record: &'life1 SignedPreKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set the entry for
signed_prekey_id
to the value of record
.impl ProtocolStore for InMemSignalProtocolStore
Auto Trait Implementations§
impl Freeze for InMemSignalProtocolStore
impl RefUnwindSafe for InMemSignalProtocolStore
impl Send for InMemSignalProtocolStore
impl Sync for InMemSignalProtocolStore
impl Unpin for InMemSignalProtocolStore
impl UnwindSafe for InMemSignalProtocolStore
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more