pub trait LeafStore: Send + Sync {
// Required methods
fn store(
&self,
key_type: &str,
key_id: &str,
data: &[u8],
) -> Result<(), StoreError>;
fn load(
&self,
key_type: &str,
key_id: &str,
) -> Result<Option<Vec<u8>>, StoreError>;
fn delete(&self, key_type: &str, key_id: &str) -> Result<(), StoreError>;
}Expand description
Durable storage for a leaf node’s secret material and MLS state.
The shape mirrors MlsStorage in offline-protocol-mls, which is the same
seam on the phone: a two-part (key_type, key_id) key, &self methods so
one store can be shared by the several places that write through it, and
per-entry atomicity. A device implements it over the part’s secure key
storage, its flash filesystem, or an EEPROM.
§Errors
Returning an error is always safe. It aborts the operation before anything is emitted, which is the whole point of the seam.
Required Methods§
Sourcefn store(
&self,
key_type: &str,
key_id: &str,
data: &[u8],
) -> Result<(), StoreError>
fn store( &self, key_type: &str, key_id: &str, data: &[u8], ) -> Result<(), StoreError>
Writes data, replacing any previous value for this key.
Must be durable and atomic per entry: after Ok, a power cut leaves
either the new value or the old one, never a torn record, and a
subsequent LeafStore::load returns the new value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".