Trait mls_rs_core::key_package::KeyPackageStorage
source · pub trait KeyPackageStorage: Send + Sync {
type Error: IntoAnyError;
// Required methods
fn delete(&mut self, id: &[u8]) -> Result<(), Self::Error>;
fn insert(
&mut self,
id: Vec<u8>,
pkg: KeyPackageData
) -> Result<(), Self::Error>;
fn get(&self, id: &[u8]) -> Result<Option<KeyPackageData>, Self::Error>;
}Expand description
Storage trait that maintains key package secrets.
Required Associated Types§
sourcetype Error: IntoAnyError
type Error: IntoAnyError
Error type that the underlying storage mechanism returns on internal failure.
Required Methods§
sourcefn delete(&mut self, id: &[u8]) -> Result<(), Self::Error>
fn delete(&mut self, id: &[u8]) -> Result<(), Self::Error>
Delete KeyPackageData referenced by id.
This function is called automatically when the key package referenced
by id is used to successfully join a group.
Warning
KeyPackageData internally contains secret key values. The
provided delete mechanism should securely erase data.
sourcefn insert(
&mut self,
id: Vec<u8>,
pkg: KeyPackageData
) -> Result<(), Self::Error>
fn insert( &mut self, id: Vec<u8>, pkg: KeyPackageData ) -> Result<(), Self::Error>
Store KeyPackageData that can be accessed by id in the future.
This function is automatically called whenever a new key package is created.
sourcefn get(&self, id: &[u8]) -> Result<Option<KeyPackageData>, Self::Error>
fn get(&self, id: &[u8]) -> Result<Option<KeyPackageData>, Self::Error>
Retrieve KeyPackageData by its id.
None should be returned in the event that no key packages are found
that match id.