pub trait KeyStore {
// Required methods
fn describe(&self) -> String;
fn get(&self, salt: &[u8; 16]) -> Result<Option<StoredSecret>>;
fn put(
&self,
salt: &[u8; 16],
secret: &StoredSecret,
label: &str,
) -> Result<()>;
fn delete(&self, salt: &[u8; 16]) -> Result<()>;
// Provided methods
fn durable(&self) -> bool { ... }
fn check_available(&self) -> Result<()> { ... }
}Expand description
Where brains’ secrets are kept, each found by its brain’s salt: the OS
keychain (the keychain feature), or the test store.
Required Methods§
Sourcefn get(&self, salt: &[u8; 16]) -> Result<Option<StoredSecret>>
fn get(&self, salt: &[u8; 16]) -> Result<Option<StoredSecret>>
The entry for salt, if there is one.
Provided Methods§
Sourcefn durable(&self) -> bool
fn durable(&self) -> bool
Whether an entry is known to be on disk when KeyStore::put
returns. None of the OS stores documents it, so the default is
false, and the keys note’s section 4 rule applies: a new key the
display rule can’t show isn’t left in the store alone.
Sourcefn check_available(&self) -> Result<()>
fn check_available(&self) -> Result<()>
Whether the store can be used here at all: an error says why not (no Secret Service on the session bus, no access). It reads one entry that never exists, so it asks nothing of the user.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".