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§
Sourcefn id(&self) -> &SecretProviderId
fn id(&self) -> &SecretProviderId
Returns the id.
Sourcefn capabilities(&self) -> SecretProviderCapabilities
fn capabilities(&self) -> SecretProviderCapabilities
Returns the capabilities.
Sourcefn read(
&self,
name: &SecretName,
) -> Result<VersionedSecret, SecurityProviderError>
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.
Sourcefn write(
&self,
name: &SecretName,
material: SecretMaterial,
expected_version: Option<SecretVersion>,
) -> Result<SecretVersion, SecurityProviderError>
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".