Skip to main content

SecretProvider

Trait SecretProvider 

Source
pub trait SecretProvider: Send + Sync {
    // Required methods
    fn id(&self) -> &SecretProviderId;
    fn capabilities(&self) -> SecretProviderCapabilities;
    fn read(
        &self,
        name: &SecretName,
    ) -> Result<VersionedSecret, SecurityProviderError>;
    fn write(
        &self,
        name: &SecretName,
        material: SecretMaterial,
        expected_version: Option<SecretVersion>,
    ) -> Result<SecretVersion, SecurityProviderError>;
}
Expand description

Synchronous, runtime-neutral boundary implemented by injected providers.

Required Methods§

Source

fn id(&self) -> &SecretProviderId

Returns the id.

Source

fn capabilities(&self) -> SecretProviderCapabilities

Returns the capabilities.

Source

fn read( &self, name: &SecretName, ) -> Result<VersionedSecret, SecurityProviderError>

Reads a secret without exposing provider implementation types.

§Errors

Returns a redacted SecurityProviderError when the material cannot be obtained safely.

Source

fn write( &self, name: &SecretName, material: SecretMaterial, expected_version: Option<SecretVersion>, ) -> Result<SecretVersion, SecurityProviderError>

Creates or atomically updates a secret. None is create-only; an existing secret requires its current version to prevent lost updates.

§Errors

Returns a redacted SecurityProviderError when persistence or version validation fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§