pub struct TwistedEd25519PrivateKey { /* private fields */ }Available on crate feature
twisted_ed25519 only.Expand description
A Twisted Ed25519 private key (Ristretto255 scalar).
The private key is zeroized when dropped to prevent sensitive data from
remaining in memory, and Debug is redacted to avoid accidental leaks.
Implementations§
Source§impl TwistedEd25519PrivateKey
impl TwistedEd25519PrivateKey
Sourcepub fn from_bytes(bytes: &[u8]) -> MovementResult<Self>
pub fn from_bytes(bytes: &[u8]) -> MovementResult<Self>
Creates a private key from raw bytes (32 bytes, little-endian, reduced mod the Ristretto255 group order).
§Errors
Returns MovementError::InvalidPrivateKey if the byte slice length is
not exactly 32 bytes.
Sourcepub fn from_hex(hex_str: &str) -> MovementResult<Self>
pub fn from_hex(hex_str: &str) -> MovementResult<Self>
Creates a private key from a hex string (with or without 0x prefix).
§Errors
Returns MovementError::Hex if the hex string is invalid, or
MovementError::InvalidPrivateKey if the decoded length is not 32 bytes.
Sourcepub fn from_scalar(scalar: Scalar) -> Self
pub fn from_scalar(scalar: Scalar) -> Self
Wraps an existing Ristretto255 scalar as a private key.
Sourcepub fn public_key(&self) -> TwistedEd25519PublicKey
pub fn public_key(&self) -> TwistedEd25519PublicKey
Returns the corresponding encryption (public) key, pk = s⁻¹·H.
Trait Implementations§
Source§impl Clone for TwistedEd25519PrivateKey
impl Clone for TwistedEd25519PrivateKey
Source§fn clone(&self) -> TwistedEd25519PrivateKey
fn clone(&self) -> TwistedEd25519PrivateKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TwistedEd25519PrivateKey
impl Debug for TwistedEd25519PrivateKey
Auto Trait Implementations§
impl Freeze for TwistedEd25519PrivateKey
impl RefUnwindSafe for TwistedEd25519PrivateKey
impl Send for TwistedEd25519PrivateKey
impl Sync for TwistedEd25519PrivateKey
impl Unpin for TwistedEd25519PrivateKey
impl UnsafeUnpin for TwistedEd25519PrivateKey
impl UnwindSafe for TwistedEd25519PrivateKey
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