Skip to main content

SecretBackend

Trait SecretBackend 

pub trait SecretBackend: Send + Sync {
    // Required methods
    fn protection(&self) -> Protection;
    fn get(&self, app: &str, key: &str) -> Result<Option<Secret>, SecretError>;
    fn put(
        &self,
        app: &str,
        key: &str,
        value: &[u8],
        label: &str,
    ) -> Result<(), SecretError>;
    fn delete(&self, app: &str, key: &str) -> Result<(), SecretError>;

    // Provided method
    fn probe(&self) -> Result<(), SecretError> { ... }
}
Expand description

A synchronous secret store for one process: the desktop backends, SecretStore::memory, or a host’s own. Every call names the app.

Required Methods§

fn protection(&self) -> Protection

fn get(&self, app: &str, key: &str) -> Result<Option<Secret>, SecretError>

§Errors

The store is unavailable or refused.

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

Store value, replacing any secret under key.

§Errors

The store is unavailable or refused.

fn delete(&self, app: &str, key: &str) -> Result<(), SecretError>

Delete the secret under key; deleting a missing key succeeds.

§Errors

The store is unavailable or refused.

Provided Methods§

fn probe(&self) -> Result<(), SecretError>

Whether the store answers at all on this session, without touching a secret.

§Errors

Why it does not.

Implementors§