Trait libsignal_service::groups_v2::CredentialsCache

source ·
pub trait CredentialsCache {
    // Required methods
    fn clear(&mut self) -> Result<(), CredentialsCacheError>;
    fn get(
        &self,
        key: &u64,
    ) -> Result<Option<&AuthCredentialWithPniResponse>, CredentialsCacheError>;
    fn write(
        &mut self,
        map: HashMap<u64, AuthCredentialWithPniResponse>,
    ) -> Result<(), CredentialsCacheError>;
}
Expand description

Global cache for groups v2 credentials, as demonstrated in the libsignal-service java library of Signal-Android.

A basic in-memory implementation is provided with InMemoryCredentialsCache.

Required Methods§

source

fn clear(&mut self) -> Result<(), CredentialsCacheError>

source

fn get( &self, key: &u64, ) -> Result<Option<&AuthCredentialWithPniResponse>, CredentialsCacheError>

Get an entry of the cache, key usually represents the day number since EPOCH.

source

fn write( &mut self, map: HashMap<u64, AuthCredentialWithPniResponse>, ) -> Result<(), CredentialsCacheError>

Overwrite the entire contents of the cache with new data.

Implementations on Foreign Types§

source§

impl<T: CredentialsCache> CredentialsCache for &mut T

source§

fn clear(&mut self) -> Result<(), CredentialsCacheError>

source§

fn get( &self, key: &u64, ) -> Result<Option<&AuthCredentialWithPniResponse>, CredentialsCacheError>

source§

fn write( &mut self, map: HashMap<u64, AuthCredentialWithPniResponse>, ) -> Result<(), CredentialsCacheError>

Implementors§