Trait libsignal_service::prelude::IdentityKeyStore

pub trait IdentityKeyStore {
    // Required methods
    fn get_identity_key_pair<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<IdentityKeyPair, SignalProtocolError>> + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn get_local_registration_id<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u32, SignalProtocolError>> + 'async_trait>>
       where 'life0: 'async_trait,
             Self: '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, SignalProtocolError>> + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: '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, SignalProtocolError>> + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn get_identity<'life0, 'life1, 'async_trait>(
        &'life0 self,
        address: &'life1 ProtocolAddress,
    ) -> Pin<Box<dyn Future<Output = Result<Option<IdentityKey>, SignalProtocolError>> + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Interface defining the identity store, which may be in-memory, on-disk, etc.

Signal clients usually use the identity store in a TOFU manner, but this is not required.

Required Methods§

fn get_identity_key_pair<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<IdentityKeyPair, SignalProtocolError>> + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Return the single specific identity the store is assumed to represent, with private key.

fn get_local_registration_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u32, SignalProtocolError>> + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Return a u32 specific to this store instance.

This local registration id is separate from the per-device identifier used in [ProtocolAddress] and should not change run over run.

If the same device is unregistered, then registers again, the [ProtocolAddress::device_id] may be the same, but the store registration id returned by this method should be regenerated.

fn save_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, address: &'life1 ProtocolAddress, identity: &'life2 IdentityKey, ) -> Pin<Box<dyn Future<Output = Result<bool, SignalProtocolError>> + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Record an identity into the store. The identity is then considered “trusted”.

The return value represents whether an existing identity was replaced (Ok(true)). If it is new or hasn’t changed, the return value should be Ok(false).

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, SignalProtocolError>> + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Return whether an identity is trusted for the role specified by direction.

fn get_identity<'life0, 'life1, 'async_trait>( &'life0 self, address: &'life1 ProtocolAddress, ) -> Pin<Box<dyn Future<Output = Result<Option<IdentityKey>, SignalProtocolError>> + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Return the public identity for the given address, if known.

Implementors§

§

impl IdentityKeyStore for InMemIdentityKeyStore

§

impl IdentityKeyStore for InMemSignalProtocolStore