Skip to main content

CredentialStore

Trait CredentialStore 

Source
pub trait CredentialStore: Send + Sync {
    // Required methods
    fn get(&self, provider: &str) -> Option<String>;
    fn set(&self, provider: &str, key: &str) -> Result<()>;
    fn delete(&self, provider: &str) -> Result<bool>;
    fn label(&self) -> &'static str;
}
Expand description

Abstract credential storage so resolution logic tests against an in-memory fake instead of the real OS keyring.

Required Methods§

Source

fn get(&self, provider: &str) -> Option<String>

The stored key for provider, if any. Backend failures (no Secret Service, locked keychain) read as None — resolution then simply reports no key, exactly like an unset env var.

Source

fn set(&self, provider: &str, key: &str) -> Result<()>

Store (or replace) provider’s key.

Source

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

Delete provider’s key; Ok(false) when nothing was stored.

Source

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

Human name for confirmations (“Stored key for groq in

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§