Skip to main content

Keystore

Trait Keystore 

Source
pub trait Keystore: Send + Sync {
    // Required methods
    fn save(&self, user: &str, secret: &str) -> Result<()>;
    fn load(&self, user: &str) -> Result<Option<String>>;
    fn forget(&self, user: &str) -> Result<()>;
}
Expand description

Abstract OS-native secret store. Implementations MUST be safe to share across threads (the GUI calls them from both the UI thread and background test threads).

Required Methods§

Source

fn save(&self, user: &str, secret: &str) -> Result<()>

Persist secret under (SERVICE, user). Overwrites any existing value. Returns an error only on real backend failure (e.g. no Secret Service daemon on Linux).

Source

fn load(&self, user: &str) -> Result<Option<String>>

Look up the secret for (SERVICE, user). Ok(None) means “looked, none stored” - which is the expected case on first use and must NOT be reported as an error.

Source

fn forget(&self, user: &str) -> Result<()>

Delete the entry for (SERVICE, user). Idempotent: deleting an entry that does not exist returns Ok(()).

Implementors§