Trait libsignal_protocol::IdentityKeyStore

source ·
pub trait IdentityKeyStore {
    // Required methods
    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_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 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 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 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;
}
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§

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,

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,

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.

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,

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).

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,

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,

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

Implementors§