pub struct PrivateKey(pub [u8; 32]);Expand description
An Ed25519 private key (raw 32-byte seed).
§Zeroize
PrivateKey derives Zeroize and ZeroizeOnDrop: the 32 seed bytes
are overwritten with zeroes when a value is dropped.
from_string and from_slice
zero their intermediate scratch buffers when they return.
Unredacted::write_string is the encoding path that wraps its scratch
buffers in Zeroizing and writes directly into a caller-provided
buffer, avoiding any return-value move.
Debug emits PrivateKey([REDACTED]). To render the encoded strkey
form, serialize via serde, or emit the raw seed bytes in any form,
wrap the value in Unredacted — see Unredacted’s doc for the full
list of paths that opt-in unlocks.
Tuple Fields§
§0: [u8; 32]Implementations§
Source§impl PrivateKey
impl PrivateKey
pub const ENCODED_LEN: usize
Source§impl PrivateKey
impl PrivateKey
pub fn from_payload(payload: &[u8]) -> Result<Self, DecodeError>
pub fn from_string(s: &str) -> Result<Self, DecodeError>
pub fn from_slice(s: &[u8]) -> Result<Self, DecodeError>
Sourcepub fn as_unredacted(&self) -> Unredacted<&Self>
pub fn as_unredacted(&self) -> Unredacted<&Self>
Borrows this private key as an Unredacted wrapper so it can be
rendered via Display or to_string, or
serialized in its strkey string form.
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrivateKey
impl Debug for PrivateKey
Source§impl Drop for PrivateKey
impl Drop for PrivateKey
impl Eq for PrivateKey
Source§impl FromStr for PrivateKey
impl FromStr for PrivateKey
Source§impl Hash for PrivateKey
impl Hash for PrivateKey
Source§impl Ord for PrivateKey
impl Ord for PrivateKey
Source§fn cmp(&self, other: &PrivateKey) -> Ordering
fn cmp(&self, other: &PrivateKey) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PrivateKey
impl PartialEq for PrivateKey
Source§fn eq(&self, other: &PrivateKey) -> bool
fn eq(&self, other: &PrivateKey) -> bool
self and other values to be equal, and is used by ==.