Skip to main content

KeyStore

Trait KeyStore 

Source
pub trait KeyStore: Send + Sync {
    // Required methods
    fn store_key(&self, user_id: &str, key: &str) -> Result<()>;
    fn get_key(&self, user_id: &str) -> Result<Option<Zeroizing<String>>>;
    fn delete_key(&self, user_id: &str) -> Result<()>;
    fn is_available(&self) -> bool;
}
Expand description

Trait for secure credential storage (system keyring, encrypted file, etc).

CLI implements this with the keyring crate (GNOME Keyring, macOS Keychain, Windows Credential Manager).

Required Methods§

Source

fn store_key(&self, user_id: &str, key: &str) -> Result<()>

Store a key for a given user ID

Source

fn get_key(&self, user_id: &str) -> Result<Option<Zeroizing<String>>>

Retrieve a key for a given user ID (returns Zeroizing for secure memory clearing)

Source

fn delete_key(&self, user_id: &str) -> Result<()>

Delete the key for a given user ID

Source

fn is_available(&self) -> bool

Check if the key store backend is available on this system

Implementors§