pub struct SecureSecret { /* private fields */ }Expand description
A resolved secret value with automatic memory zeroing on drop.
This type wraps secrecy::SecretString to ensure:
- Secret values are zeroed from memory when dropped
- Debug output shows
[REDACTED]instead of the actual value - Explicit
.expose()call required to access the value
§Example
ⓘ
let secret = SecureSecret::new("my-password".to_string());
// Use the secret
let value = secret.expose();
// When `secret` goes out of scope, memory is zeroedImplementations§
Source§impl SecureSecret
impl SecureSecret
Sourcepub fn new(value: String) -> Self
pub fn new(value: String) -> Self
Create a new secure secret from a string.
The string value is moved into secure storage and will be
automatically zeroed when this SecureSecret is dropped.
Trait Implementations§
Source§impl Clone for SecureSecret
impl Clone for SecureSecret
Source§fn clone(&self) -> SecureSecret
fn clone(&self) -> SecureSecret
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecureSecret
impl Debug for SecureSecret
Auto Trait Implementations§
impl Freeze for SecureSecret
impl RefUnwindSafe for SecureSecret
impl Send for SecureSecret
impl Sync for SecureSecret
impl Unpin for SecureSecret
impl UnwindSafe for SecureSecret
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