Skip to main content

MasterKeyCustody

Trait MasterKeyCustody 

Source
pub trait MasterKeyCustody: Send + Sync {
    // Required methods
    fn unlock(&self) -> Result<Option<MasterKeyring>, KeyError>;
    fn persist(&self, keyring: &MasterKeyring) -> Result<(), KeyError>;
    fn forget(&self) -> Result<(), KeyError>;
}
Expand description

A store’s master keyring’s custody: who unlocks it, where a newly established or rotated one is written, and how it is removed. Implemented once per protection policy (the OS keyring, a passphrase-wrapped file, an in-memory session value, or a host’s own).

Required Methods§

Source

fn unlock(&self) -> Result<Option<MasterKeyring>, KeyError>

The store’s master keyring for this session. Ok(None) means the store has never had one established (a fresh store before create/join) — distinct from a failure to produce one (wrong passphrase, unreadable backing store), which is Err.

Source

fn persist(&self, keyring: &MasterKeyring) -> Result<(), KeyError>

Protect and store keyring, replacing whatever is stored. Serves both establishment (create/join/restore) and rotation re-protection (member removal, the per-cycle refresh adoption). Idempotent.

Source

fn forget(&self) -> Result<(), KeyError>

Remove the stored keyring. Ok when nothing was stored.

Implementors§