Skip to main content

KeychainBackend

Trait KeychainBackend 

Source
pub trait KeychainBackend:
    Send
    + Sync
    + Debug {
    // Required methods
    fn get(
        &self,
        service: &str,
        account: &str,
    ) -> Result<String, CredentialError>;
    fn set(
        &self,
        service: &str,
        account: &str,
        value: &str,
    ) -> Result<(), CredentialError>;
    fn delete(
        &self,
        service: &str,
        account: &str,
    ) -> Result<(), CredentialError>;
}
Expand description

keyring crate abstraction. Real production code uses the keyring crate; the trait is what the rest of the code depends on so tests can swap in a fake without touching the OS keychain.

Required Methods§

Source

fn get(&self, service: &str, account: &str) -> Result<String, CredentialError>

Source

fn set( &self, service: &str, account: &str, value: &str, ) -> Result<(), CredentialError>

Source

fn delete(&self, service: &str, account: &str) -> Result<(), CredentialError>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§