pub trait StoreBackend<Key: KeySlotId>:
ZeroizeOnDrop
+ Send
+ Sync {
// Required methods
fn upsert(&mut self, key_id: Key, key: Key::KeyValue);
fn get(&self, key_id: Key) -> Option<&Key::KeyValue>;
fn remove(&mut self, key_id: Key);
fn clear(&mut self);
fn retain(&mut self, f: fn(Key) -> bool);
}Expand description
This trait represents a platform that can store and return keys. If possible, it will try to enable as many security protections on the keys as it can. The keys themselves implement [ZeroizeOnDrop], so the store will only need to make sure that the keys are dropped when they are no longer needed.
The default implementation is a basic in-memory store that does not provide any security guarantees.
We have other implementations in testing using mlock and memfd_secret for protecting keys in
memory.
Other implementations could use secure enclaves, HSMs or OS provided keychains.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".