pub struct PrivateKey<P>where
P: Profile,{ /* private fields */ }Expand description
A one-time WOTS private key bound to cryptographic profile P.
Signing APIs consume this value to make accidental key reuse harder. Raw
bytes can still be copied deliberately, so the surrounding key-management
system must enforce one-time use durably. This type does not zeroize on
drop; see PrivateSeed for the corresponding memory-handling caveat.
Implementations§
Source§impl<P> PrivateKey<P>where
P: Profile,
impl<P> PrivateKey<P>where
P: Profile,
Sourcepub const fn new(bytes: [u8; 32]) -> PrivateKey<P>
pub const fn new(bytes: [u8; 32]) -> PrivateKey<P>
Creates a profile-bound private key from exact upstream-format bytes.
Sourcepub fn from_slice(bytes: &[u8]) -> Result<PrivateKey<P>, LengthError>
pub fn from_slice(bytes: &[u8]) -> Result<PrivateKey<P>, LengthError>
Parses a private key, rejecting every non-32-byte input.
§Errors
Returns LengthError unless bytes contains exactly 32 bytes.
Sourcepub const fn expose_secret(&self) -> &[u8; 32]
pub const fn expose_secret(&self) -> &[u8; 32]
Explicitly borrows the secret bytes for a cryptographic operation.
Sourcepub const fn into_secret(self) -> [u8; 32]
pub const fn into_secret(self) -> [u8; 32]
Explicitly returns the secret bytes.
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for PrivateKey<P>
impl<P> RefUnwindSafe for PrivateKey<P>
impl<P> Send for PrivateKey<P>
impl<P> Sync for PrivateKey<P>
impl<P> Unpin for PrivateKey<P>
impl<P> UnsafeUnpin for PrivateKey<P>
impl<P> UnwindSafe for PrivateKey<P>
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