pub struct Secret { /* private fields */ }Expand description
A secure secret wrapper that provides memory safety guarantees.
- Implements
Zeroizefor secure memory cleanup on drop - Debug output shows
[REDACTED]instead of the actual value - Uses
SecretStringfrom the secrecy crate for the underlying storage
Implementations§
Source§impl Secret
impl Secret
Sourcepub fn expose(&self) -> &str
pub fn expose(&self) -> &str
Expose the secret value for use.
This should only be called when the secret value is actually needed, such as when passing to an external service or writing to an encrypted store.
Sourcepub fn as_secret_string(&self) -> &SecretString
pub fn as_secret_string(&self) -> &SecretString
Get the underlying SecretString reference.
Trait Implementations§
Source§impl From<SecretBox<str>> for Secret
impl From<SecretBox<str>> for Secret
Source§fn from(value: SecretString) -> Self
fn from(value: SecretString) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Secret
impl RefUnwindSafe for Secret
impl Send for Secret
impl Sync for Secret
impl Unpin for Secret
impl UnsafeUnpin for Secret
impl UnwindSafe for Secret
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