arsenal-store · traits
Declared module signatures, types, configuration, and source documentation.
Source: arsenal/crates/arsenal-store/src/traits.rs. SHA-256: f1e8cf49bdd881de6ca0f5bb1ae623cd2dbccf466665c1f375de947185c28ac3.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
traits::SecretStoreResult
Result type for secret store operations
pub type SecretStoreResult<T> = Result<T, SecretStoreError>;Source line: 16.
traits::SecretStoreError
Errors specific to secret storage
#[derive(Debug, thiserror::Error)]
pub enum SecretStoreError {
/// Secret not found
#[error("Secret not found: {0}")]
NotFound(String),
/// Secret version not found
#[error("Secret version not found: {0} v{1}")]
VersionNotFound(String, u64),
/// Secret already exists
#[error("Secret already exists: {0}")]
AlreadyExists(String),
/// Access denied
#[error("Access denied: {0}")]
AccessDenied(String),
/// Storage backend error
#[error("Storage error: {0}")]
StorageError(String),
/// Encryption error
#[error("Encryption error: {0}")]
EncryptionError(String),
/// Validation error
#[error("Validation error: {0}")]
ValidationError(String),
/// Configuration error
#[error("Configuration error: {0}")]
ConfigurationError(String),
/// Wrapped arsenal error
#[error(transparent)]
Arsenal(#[from] ArsenalError),
}Source line: 20.
traits::SecretStoreError::not_found
Create a not found error
pub fn not_found(id: impl Into<String>) -> Self;Source line: 60.
traits::SecretStoreError::storage
Create a storage error
pub fn storage(msg: impl Into<String>) -> Self;Source line: 65.
traits::SecretStoreError::encryption
Create an encryption error
pub fn encryption(msg: impl Into<String>) -> Self;Source line: 70.
traits::SecretStoreError::validation
Create a validation error
pub fn validation(msg: impl Into<String>) -> Self;Source line: 75.
traits::SecretStoreError::is_not_found
Check if this is a not found error
#[must_use]
pub fn is_not_found(&self) -> bool;Source line: 81.
traits::SecretStore
Trait for secret storage backends
All methods async to support both local and remote backends.
pub trait SecretStore: Send + Sync {
/// Create a new secret
fn create<'a>(
&'a self,
tenant_id: &'a TenantId,
name: &'a str,
secret_type: SecretType,
value: SecretValue,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<SecretMetadata>> + Send + 'a>>;
/// Get secret metadata (without the value)
fn get_metadata<'a>(
&'a self,
tenant_id: &'a TenantId,
secret_id: &'a SecretId,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<SecretMetadata>> + Send + 'a>>;
/// Get a secret value
fn get_value<'a>(
&'a self,
tenant_id: &'a TenantId,
secret_ref: &'a SecretRef,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<SecretValue>> + Send + 'a>>;
/// Update a secret (creates a new version)
fn update<'a>(
&'a self,
tenant_id: &'a TenantId,
secret_id: &'a SecretId,
new_value: SecretValue,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<SecretVersion>> + Send + 'a>>;
/// Delete a secret (all versions)
fn delete<'a>(
&'a self,
tenant_id: &'a TenantId,
secret_id: &'a SecretId,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<()>> + Send + 'a>>;
/// List secrets for a tenant
fn list<'a>(
&'a self,
tenant_id: &'a TenantId,
filter: Option<&'a SecretFilter>,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<Vec<SecretMetadata>>> + Send + 'a>>;
/// Disable a specific version
fn disable_version<'a>(
&'a self,
tenant_id: &'a TenantId,
secret_id: &'a SecretId,
version: SecretVersion,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<()>> + Send + 'a>>;
/// Check if a secret exists
fn exists<'a>(
&'a self,
tenant_id: &'a TenantId,
secret_id: &'a SecretId,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<bool>> + Send + 'a>>;
}Source line: 89.
traits::SecretFilter
Filter for listing secrets
#[derive(Debug, Clone, Default)]
pub struct SecretFilter {
/// Filter by secret type
pub secret_type: Option<SecretType>,
/// Filter by name prefix
pub name_prefix: Option<String>,
/// Filter by service
pub service: Option<String>,
/// Filter by label key
pub label_key: Option<String>,
/// Filter by label value (requires `label_key`)
pub label_value: Option<String>,
/// Only active secrets
pub active_only: bool,
/// Maximum results
pub limit: Option<usize>,
/// Offset for pagination
pub offset: Option<usize>
}Source line: 153.
traits::SecretFilter::new
Create a new filter
#[must_use]
pub fn new() -> Self;Source line: 175.
traits::SecretFilter::with_type
Filter by secret type
#[must_use]
pub fn with_type(mut self, secret_type: SecretType) -> Self;Source line: 181.
traits::SecretFilter::with_name_prefix
Filter by name prefix
#[must_use]
pub fn with_name_prefix(mut self, prefix: impl Into<String>) -> Self;Source line: 188.
traits::SecretFilter::with_service
Filter by service
#[must_use]
pub fn with_service(mut self, service: impl Into<String>) -> Self;Source line: 195.
traits::SecretFilter::active_only
Only active secrets
#[must_use]
pub fn active_only(mut self) -> Self;Source line: 202.
traits::SecretFilter::with_limit
Set limit
#[must_use]
pub fn with_limit(mut self, limit: usize) -> Self;Source line: 209.
traits::SecretFilter::with_offset
Set offset
#[must_use]
pub fn with_offset(mut self, offset: usize) -> Self;Source line: 216.
traits::SecretFilter::matches
Check if a secret matches this filter
#[must_use]
pub fn matches(&self, metadata: &SecretMetadata) -> bool;Source line: 223.
traits::SecretStoreStats
Statistics about the secret store
#[derive(Debug, Clone, Default)]
pub struct SecretStoreStats {
/// Total number of secrets
pub total_secrets: u64,
/// Number of active secrets
pub active_secrets: u64,
/// Total number of versions across all secrets
pub total_versions: u64,
/// Number of secrets needing rotation
pub needs_rotation: u64,
/// Storage size in bytes (if available)
pub storage_bytes: Option<u64>
}Source line: 271.
traits::SecretStoreExt
Extended secret store trait with additional operations
pub trait SecretStoreExt: SecretStore {
/// Get store statistics
fn stats<'a>(
&'a self,
tenant_id: &'a TenantId,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<SecretStoreStats>> + Send + 'a>>;
/// Find secrets by name
fn find_by_name<'a>(
&'a self,
tenant_id: &'a TenantId,
name: &'a str,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<Option<SecretMetadata>>> + Send + 'a>>;
/// Rotate a secret (convenience method)
fn rotate<'a>(
&'a self,
tenant_id: &'a TenantId,
secret_id: &'a SecretId,
new_value: SecretValue,
) -> Pin<Box<dyn Future<Output = SecretStoreResult<SecretVersion>> + Send + 'a>> ;
}Source line: 285.