pub trait IdentityVault {
type Error;
// Required methods
fn load(
&self,
label: &IdentityLabel,
) -> Result<Option<Zeroizing<[u8; 64]>>, Self::Error>;
fn store(
&mut self,
label: &IdentityLabel,
secret: &[u8; 64],
) -> Result<(), Self::Error>;
fn remove(&mut self, label: &IdentityLabel) -> Result<Removal, Self::Error>;
fn stored_blob_len(
&self,
label: &IdentityLabel,
) -> Result<Option<usize>, Self::Error>;
fn load_blob<'b>(
&self,
label: &IdentityLabel,
buf: &'b mut [u8],
) -> Result<Option<&'b [u8]>, Self::Error>;
fn store_blob(
&mut self,
label: &IdentityLabel,
blob: &[u8],
) -> Result<(), Self::Error>;
}Expand description
Identity secrets are fixed 64-byte entries; blobs are variable-length secret records
(self-ratchet state) sharing the same trust domain and label namespace, so remove
clears either kind and a label addresses exactly one entry of one kind.
Required Associated Types§
Required Methods§
fn load( &self, label: &IdentityLabel, ) -> Result<Option<Zeroizing<[u8; 64]>>, Self::Error>
fn store( &mut self, label: &IdentityLabel, secret: &[u8; 64], ) -> Result<(), Self::Error>
fn remove(&mut self, label: &IdentityLabel) -> Result<Removal, Self::Error>
fn stored_blob_len( &self, label: &IdentityLabel, ) -> Result<Option<usize>, Self::Error>
Sourcefn load_blob<'b>(
&self,
label: &IdentityLabel,
buf: &'b mut [u8],
) -> Result<Option<&'b [u8]>, Self::Error>
fn load_blob<'b>( &self, label: &IdentityLabel, buf: &'b mut [u8], ) -> Result<Option<&'b [u8]>, Self::Error>
A buf shorter than the stored blob is the impl’s error, never a silent truncation.
fn store_blob( &mut self, label: &IdentityLabel, blob: &[u8], ) -> Result<(), Self::Error>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".