pub struct SecretArray<const CAP: usize> { /* private fields */ }Expand description
Non-Clone bounded secret bytes with mandatory full-capacity cleanup.
Implementations§
Source§impl<const CAP: usize> SecretArray<CAP>
impl<const CAP: usize> SecretArray<CAP>
Sourcepub fn from_array(
bytes: [u8; CAP],
len: usize,
) -> Result<Self, BufferLengthError>
pub fn from_array( bytes: [u8; CAP], len: usize, ) -> Result<Self, BufferLengthError>
Takes ownership, checks the visible prefix, and wipes unused capacity.
Sourcepub fn expose_secret(&self) -> ExposedSecret<'_>
pub fn expose_secret(&self) -> ExposedSecret<'_>
Creates an explicit borrowed interoperability view.
Sourcepub fn expose_secret_mut(&mut self) -> ExposedSecretMut<'_>
pub fn expose_secret_mut(&mut self) -> ExposedSecretMut<'_>
Creates an explicit mutable interoperability view.
Sourcepub fn declassify(self) -> DeclassifiedArray<CAP>
pub fn declassify(self) -> DeclassifiedArray<CAP>
Deliberately converts this secret into ordinary non-wiping storage.
Trait Implementations§
Source§impl<const CAP: usize> Debug for SecretArray<CAP>
impl<const CAP: usize> Debug for SecretArray<CAP>
Source§impl<const CAP: usize> Display for SecretArray<CAP>
impl<const CAP: usize> Display for SecretArray<CAP>
Source§impl<const CAP: usize> Drop for SecretArray<CAP>
impl<const CAP: usize> Drop for SecretArray<CAP>
Auto Trait Implementations§
impl<const CAP: usize> Freeze for SecretArray<CAP>
impl<const CAP: usize> RefUnwindSafe for SecretArray<CAP>
impl<const CAP: usize> Send for SecretArray<CAP>
impl<const CAP: usize> Sync for SecretArray<CAP>
impl<const CAP: usize> Unpin for SecretArray<CAP>
impl<const CAP: usize> UnsafeUnpin for SecretArray<CAP>
impl<const CAP: usize> UnwindSafe for SecretArray<CAP>
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