Skip to main content

KeyVault

Trait KeyVault 

Source
pub trait KeyVault: Send + Sync {
    // Required methods
    fn get(&self, label: &str) -> Result<Option<Zeroizing<Vec<u8>>>>;
    fn put(&self, label: &str, value: &[u8]) -> Result<()>;
    fn delete(&self, label: &str) -> Result<bool>;
    fn kind(&self) -> &'static str;

    // Provided methods
    fn labels(&self) -> Result<Vec<String>> { ... }
    fn external_identity(&self, _session_id: &str) -> Option<[u8; 32]> { ... }
    fn sign_external(&self, _session_id: &str, _msg: &[u8]) -> Result<[u8; 64]> { ... }
}

Required Methods§

Source

fn get(&self, label: &str) -> Result<Option<Zeroizing<Vec<u8>>>>

Source

fn put(&self, label: &str, value: &[u8]) -> Result<()>

Source

fn delete(&self, label: &str) -> Result<bool>

Source

fn kind(&self) -> &'static str

A short name for logs (“memory”, “file+keychain”, “file+keyfile”).

Provided Methods§

Source

fn labels(&self) -> Result<Vec<String>>

Every label held (for backup). A vault that cannot list says so.

Source

fn external_identity(&self, _session_id: &str) -> Option<[u8; 32]>

The public key of session_id’s identity when the private key lives outside this vault (a host keystore that signs but never exports). None (the default) keeps the seed here.

Source

fn sign_external(&self, _session_id: &str, _msg: &[u8]) -> Result<[u8; 64]>

Sign msg with the external identity key of session_id.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§