pub struct ExposedSecretVec { /* private fields */ }Expand description
Owned secret bytes extracted from SecretBuffer.
This wrapper keeps redacted formatting, best-effort spare-capacity clearing
at construction time, and best-effort full wipe on drop after a
SecretBuffer is consumed for owned interop. Use
Self::into_exposed_unprotected_vec_caller_must_zeroize only when a raw
Vec<u8> is unavoidable and the caller will handle cleanup.
Implementations§
Source§impl ExposedSecretVec
impl ExposedSecretVec
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether the buffer contains no initialized secret bytes.
Sourcepub fn expose_secret(&self) -> &[u8] ⓘ
pub fn expose_secret(&self) -> &[u8] ⓘ
Reveals the secret bytes.
This method is intentionally named to make secret access explicit at the call site.
Sourcepub fn expose_secret_mut(&mut self) -> &mut [u8] ⓘ
pub fn expose_secret_mut(&mut self) -> &mut [u8] ⓘ
Reveals the secret bytes mutably.
This method is intentionally named to make secret access explicit at the call site.
Sourcepub fn into_exposed_unprotected_vec_caller_must_zeroize(self) -> Vec<u8> ⓘ
pub fn into_exposed_unprotected_vec_caller_must_zeroize(self) -> Vec<u8> ⓘ
Consumes the wrapper and returns a raw Vec<u8>.
This is an unprotected escape hatch. The returned vector is no longer redacted by formatting and will not be cleared by this crate on drop. Callers must clear it with their own approved zeroization policy.
Trait Implementations§
Source§impl AsMut<[u8]> for ExposedSecretVec
Available on crate feature alloc only.
impl AsMut<[u8]> for ExposedSecretVec
alloc only.Source§impl AsRef<[u8]> for ExposedSecretVec
Available on crate feature alloc only.
impl AsRef<[u8]> for ExposedSecretVec
alloc only.Source§impl Debug for ExposedSecretVec
Available on crate feature alloc only.
impl Debug for ExposedSecretVec
alloc only.Source§impl Display for ExposedSecretVec
Available on crate feature alloc only.
impl Display for ExposedSecretVec
alloc only.Source§impl Drop for ExposedSecretVec
Available on crate feature alloc only.
impl Drop for ExposedSecretVec
alloc only.