Skip to main content

DeviceIdentityCustody

Trait DeviceIdentityCustody 

Source
pub trait DeviceIdentityCustody: Send + Sync {
    // Required methods
    fn unlock(&self) -> Result<Option<UserKeypair>, KeyError>;
    fn persist(&self, keypair: &UserKeypair) -> Result<(), KeyError>;
    fn forget(&self) -> Result<(), KeyError>;

    // Provided method
    fn establish(&self, keypair: &UserKeypair) -> Result<(), KeyError> { ... }
}
Expand description

Custody of the Store identity used by this installation: who unlocks it, where an established identity is written, and how it is removed. Selected per Store, like MasterKeyCustody, but retains a UserKeypair instead of the Store’s encryption keyring.

Required Methods§

Source

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

This store’s established signing identity. Ok(None) means none has ever been established — distinct from a failure to produce one (wrong passphrase, unreadable backing store), which is Err.

Source

fn persist(&self, keypair: &UserKeypair) -> Result<(), KeyError>

Protect and store keypair, replacing whatever is stored. Idempotent.

Source

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

Remove the stored identity. Ok when nothing was stored.

Provided Methods§

Source

fn establish(&self, keypair: &UserKeypair) -> Result<(), KeyError>

Establish this Store’s identity without replacing a different identity. Repeating the same identity is idempotent.

Implementors§