pub struct SecretsManager { /* private fields */ }
Expand description
Secrets management system
Implementations§
Source§impl SecretsManager
impl SecretsManager
pub fn new(config: SecretsConfig) -> Result<Self>
Sourcepub async fn initialize(&self) -> Result<()>
pub async fn initialize(&self) -> Result<()>
Initialize secrets management system
Sourcepub async fn get_secret(&self, key: &str) -> Result<String>
pub async fn get_secret(&self, key: &str) -> Result<String>
Get secret value
Sourcepub async fn set_secret(
&self,
key: &str,
value: &str,
expires_in_seconds: Option<i64>,
) -> Result<()>
pub async fn set_secret( &self, key: &str, value: &str, expires_in_seconds: Option<i64>, ) -> Result<()>
Set secret value (for testing or manual secret management)
Sourcepub async fn delete_secret(&self, key: &str) -> Result<()>
pub async fn delete_secret(&self, key: &str) -> Result<()>
Delete secret from cache
Sourcepub async fn get_secret_metadata(&self, key: &str) -> Result<SecretMetadata>
pub async fn get_secret_metadata(&self, key: &str) -> Result<SecretMetadata>
Get secret metadata (without the actual value)
Sourcepub async fn list_secrets(&self) -> Vec<String>
pub async fn list_secrets(&self) -> Vec<String>
List all secret keys (without values)
Sourcepub async fn rotate_secret(&self, key: &str, new_value: &str) -> Result<u32>
pub async fn rotate_secret(&self, key: &str, new_value: &str) -> Result<u32>
Rotate secret (create new version)
Sourcepub async fn cleanup_expired_secrets(&self) -> Result<usize>
pub async fn cleanup_expired_secrets(&self) -> Result<usize>
Clean up expired secrets
Sourcepub async fn get_statistics(&self) -> SecretsStatistics
pub async fn get_statistics(&self) -> SecretsStatistics
Get secrets statistics
Sourcepub async fn test_connection(&self) -> Result<()>
pub async fn test_connection(&self) -> Result<()>
Test connection to secrets backend
pub fn is_vault_enabled(&self) -> bool
pub fn is_env_fallback_enabled(&self) -> bool
Source§impl SecretsManager
Utility functions for secret management
impl SecretsManager
Utility functions for secret management
Sourcepub fn generate_random_key(length: usize) -> String
pub fn generate_random_key(length: usize) -> String
Generate a random secret key
Sourcepub fn generate_jwt_secret() -> String
pub fn generate_jwt_secret() -> String
Generate a secure JWT secret
Sourcepub fn generate_api_key() -> String
pub fn generate_api_key() -> String
Generate a secure API key
Sourcepub fn generate_encryption_key() -> String
pub fn generate_encryption_key() -> String
Generate a secure encryption key
Auto Trait Implementations§
impl Freeze for SecretsManager
impl !RefUnwindSafe for SecretsManager
impl Send for SecretsManager
impl Sync for SecretsManager
impl Unpin for SecretsManager
impl !UnwindSafe for SecretsManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more