pub struct SecureString(/* private fields */);
Expand description
Secure wrapper for sensitive string data that automatically zeroes memory on drop.
This wrapper ensures that sensitive authentication data is securely cleared from memory when it’s no longer needed, providing protection against memory inspection attacks.
Implementations§
Source§impl SecureString
impl SecureString
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns a reference to the inner string value.
§Security Note
The returned reference should not be stored for extended periods to minimize exposure time of sensitive data.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the SecureString and returns the inner String.
§Security Note
The caller becomes responsible for the secure handling of the returned String.
Sourcepub fn equals_str(&self, other: &str) -> bool
pub fn equals_str(&self, other: &str) -> bool
Checks if the secure string equals the given string slice.
This method is provided for convenient testing and comparison without exposing the internal string value.
Trait Implementations§
Source§impl Clone for SecureString
impl Clone for SecureString
Source§fn clone(&self) -> SecureString
fn clone(&self) -> SecureString
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SecureString
impl Debug for SecureString
Source§impl<'de> Deserialize<'de> for SecureString
impl<'de> Deserialize<'de> for SecureString
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for SecureString
impl Display for SecureString
Source§impl Drop for SecureString
impl Drop for SecureString
Source§impl From<&str> for SecureString
impl From<&str> for SecureString
Source§impl From<String> for SecureString
impl From<String> for SecureString
Source§impl PartialEq for SecureString
impl PartialEq for SecureString
Source§impl Serialize for SecureString
impl Serialize for SecureString
Source§impl Zeroize for SecureString
impl Zeroize for SecureString
impl Eq for SecureString
impl StructuralPartialEq for SecureString
Auto Trait Implementations§
impl Freeze for SecureString
impl RefUnwindSafe for SecureString
impl Send for SecureString
impl Sync for SecureString
impl Unpin for SecureString
impl UnwindSafe for SecureString
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.