pub struct BoundedGuardedSecretString<const MAX: usize> { /* private fields */ }Expand description
Guarded UTF-8 text with a permanent type-level byte maximum.
Implementations§
Source§impl<const MAX: usize> BoundedGuardedSecretString<MAX>
impl<const MAX: usize> BoundedGuardedSecretString<MAX>
pub const fn max_len() -> usize
Sourcepub fn try_with_capacity_with_protection(
capacity: usize,
request: ProtectionRequest,
) -> Result<Self, ProtectedSecretTextFillError<Infallible>>
pub fn try_with_capacity_with_protection( capacity: usize, request: ProtectionRequest, ) -> Result<Self, ProtectedSecretTextFillError<Infallible>>
Construct empty bounded UTF-8 storage after required controls succeed.
Sourcepub fn try_from_capacity_with_protection<E>(
capacity: usize,
request: ProtectionRequest,
fill: impl FnOnce(&mut [u8]) -> Result<usize, E>,
) -> Result<Self, ProtectedSecretTextFillError<E>>
pub fn try_from_capacity_with_protection<E>( capacity: usize, request: ProtectionRequest, fill: impl FnOnce(&mut [u8]) -> Result<usize, E>, ) -> Result<Self, ProtectedSecretTextFillError<E>>
Fill bounded guarded UTF-8 storage after required controls succeed.
Sourcepub fn try_from_exact_len_with_protection<E>(
len: usize,
request: ProtectionRequest,
fill: impl FnOnce(&mut [u8]) -> Result<(), E>,
) -> Result<Self, ProtectedSecretTextFillError<E>>
pub fn try_from_exact_len_with_protection<E>( len: usize, request: ProtectionRequest, fill: impl FnOnce(&mut [u8]) -> Result<(), E>, ) -> Result<Self, ProtectedSecretTextFillError<E>>
Fill an exact-length bounded guarded UTF-8 value in place.
Sourcepub fn from_secret_str_with_protection(
text: &str,
request: ProtectionRequest,
) -> Result<Self, ProtectedSecretTextFillError<Infallible>>
pub fn from_secret_str_with_protection( text: &str, request: ProtectionRequest, ) -> Result<Self, ProtectedSecretTextFillError<Infallible>>
Copy UTF-8 text after required controls are established.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn backing_capacity(&self) -> usize
pub const fn is_memory_locked(&self) -> bool
pub const fn protection_report(&self) -> &ProtectionReport
pub const fn protection_request(&self) -> ProtectionRequest
pub fn try_with_secret<R>( &self, inspect: impl FnOnce(&str) -> R, ) -> Result<R, SecretTextIntegrityError>
pub fn try_with_secret_mut<R>( &mut self, edit: impl FnOnce(&mut str) -> R, ) -> Result<R, SecretTextIntegrityError>
pub fn try_push_str( &mut self, text: &str, ) -> Result<(), BoundedMappedSecretError<GuardPageError>>
pub fn try_replace_from_secret_str( &mut self, text: &str, ) -> Result<(), BoundedMappedSecretError<GuardPageError>>
pub fn clear_secret(&mut self)
pub fn try_constant_time_eq( &self, other: &str, ) -> Result<bool, CanaryCorruptedError>
pub fn verify_integrity(&self) -> Result<(), CanaryCorruptedError>
Trait Implementations§
Source§impl<const MAX: usize> ConstantTimeEq for BoundedGuardedSecretString<MAX>
impl<const MAX: usize> ConstantTimeEq for BoundedGuardedSecretString<MAX>
Source§impl<const MAX: usize> ConstantTimeEq for BoundedGuardedSecretString<MAX>
Available on crate feature guard-pages and not (miri) only.
impl<const MAX: usize> ConstantTimeEq for BoundedGuardedSecretString<MAX>
Available on crate feature
guard-pages and not (miri) only.Source§impl<const MAX: usize> ConstantTimeEq<str> for BoundedGuardedSecretString<MAX>
impl<const MAX: usize> ConstantTimeEq<str> for BoundedGuardedSecretString<MAX>
Source§impl<const MAX: usize> Debug for BoundedGuardedSecretString<MAX>
Available on crate feature guard-pages and (Android, or DragonFly BSD, or FreeBSD, or iOS, or macOS, or NetBSD, or OpenBSD, or Windows, or Linux and (AArch64 or x86-64)) and not (miri) only.
impl<const MAX: usize> Debug for BoundedGuardedSecretString<MAX>
Available on crate feature
guard-pages and (Android, or DragonFly BSD, or FreeBSD, or iOS, or macOS, or NetBSD, or OpenBSD, or Windows, or Linux and (AArch64 or x86-64)) and not (miri) only.Source§impl<const MAX: usize> SecureSanitize for BoundedGuardedSecretString<MAX>
Available on crate feature guard-pages and (Android, or DragonFly BSD, or FreeBSD, or iOS, or macOS, or NetBSD, or OpenBSD, or Windows, or Linux and (AArch64 or x86-64)) and not (miri) only.
impl<const MAX: usize> SecureSanitize for BoundedGuardedSecretString<MAX>
Available on crate feature
guard-pages and (Android, or DragonFly BSD, or FreeBSD, or iOS, or macOS, or NetBSD, or OpenBSD, or Windows, or Linux and (AArch64 or x86-64)) and not (miri) only.Source§fn secure_sanitize(&mut self)
fn secure_sanitize(&mut self)
Clear the sensitive bytes owned by this value.
Source§impl<const MAX: usize> Zeroize for BoundedGuardedSecretString<MAX>
Available on crate feature guard-pages and not (miri) only.
impl<const MAX: usize> Zeroize for BoundedGuardedSecretString<MAX>
Available on crate feature
guard-pages and not (miri) only.impl<const MAX: usize> ZeroizeOnDrop for BoundedGuardedSecretString<MAX>
Available on crate feature
guard-pages and not (miri) only.Auto Trait Implementations§
impl<const MAX: usize> !Freeze for BoundedGuardedSecretString<MAX>
impl<const MAX: usize> !RefUnwindSafe for BoundedGuardedSecretString<MAX>
impl<const MAX: usize> !Sync for BoundedGuardedSecretString<MAX>
impl<const MAX: usize> Send for BoundedGuardedSecretString<MAX>
impl<const MAX: usize> Unpin for BoundedGuardedSecretString<MAX>
impl<const MAX: usize> UnsafeUnpin for BoundedGuardedSecretString<MAX>
impl<const MAX: usize> UnwindSafe for BoundedGuardedSecretString<MAX>
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