Skip to main content

CredentialStorage

Trait CredentialStorage 

Source
pub trait CredentialStorage:
    Send
    + Sync
    + Debug {
    // Required methods
    fn load<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 CredentialKey<'life2>,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn save<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        key: &'life1 CredentialKey<'life2>,
        value: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 CredentialKey<'life2>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A pluggable place to persist a provider’s serialized credential.

Values are opaque strings (typically JSON); the backend never interprets them, so it stays independent of any provider’s token shape. Callers own (de)serialization and any validity/expiry checks.

Required Methods§

Source

fn load<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 CredentialKey<'life2>, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Loads the stored blob for key, or None when absent or unreadable.

Backends own the policy for distinguishing “no entry” from “store unavailable” (see AutoStorage); both collapse to None here.

Source

fn save<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, key: &'life1 CredentialKey<'life2>, value: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Persists value for key, replacing any existing value.

§Errors

Returns an error when the backend cannot durably store the value.

Source

fn delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 CredentialKey<'life2>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Removes the blob for key. Best-effort: absence is not an error.

Provided Methods§

Source

fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists environment names with stored credentials, if the backend supports enumeration. The default returns an empty list (the keychain cannot be enumerated by service prefix).

§Errors

Returns an error when enumeration is attempted but fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§