SecretProvider

Trait SecretProvider 

Source
pub trait SecretProvider: Send + Sync {
    // Required methods
    fn get_secret<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context_id: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SecretValue>, ContextError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn set_secret<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        context_id: &'life1 str,
        key: &'life2 str,
        value: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete_secret<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context_id: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_keys<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ContextError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn name(&self) -> &'static str;

    // Provided methods
    fn has_secret<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context_id: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, ContextError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn is_read_only(&self) -> bool { ... }
}
Expand description

Trait for secret providers.

All secret values are wrapped in Zeroizing<String> to ensure they are cleared from memory when no longer needed.

Required Methods§

Source

fn get_secret<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context_id: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<SecretValue>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get a secret value.

Returns None if the secret doesn’t exist.

Source

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

Set a secret value.

Source

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

Delete a secret.

Source

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

List all secret keys for a context.

Source

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

Get the provider name.

Provided Methods§

Source

fn has_secret<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context_id: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check if a secret exists.

Source

fn is_read_only(&self) -> bool

Check if this provider is read-only.

Implementors§