Skip to main content

CredentialsCache

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: CredentialsCache> CredentialsCache for &mut T

Implementors§