#[non_exhaustive]pub struct DerivedEd25519Key { /* private fields */ }Expand description
A SLIP-0010 derived Ed25519 key pair.
Wraps the 32-byte private key plus the 32-byte chain code required for
further child derivation. Both fields are held in Zeroizing and are
wiped on drop. The struct is opaque — callers interact with it
exclusively through the accessor methods below, which mirrors the
secp256k1 sibling crate::bip32::DerivedSecp256k1Key.
Implementations§
Source§impl DerivedEd25519Key
impl DerivedEd25519Key
Sourcepub fn from_seed(seed: &[u8]) -> Result<Self, DeriveError>
pub fn from_seed(seed: &[u8]) -> Result<Self, DeriveError>
Derive the master key from a BIP-39 seed using SLIP-0010.
§Errors
Returns an error if the HMAC key is invalid (should not happen in practice).
Sourcepub fn derive_hardened(&self, index: u32) -> Result<Self, DeriveError>
pub fn derive_hardened(&self, index: u32) -> Result<Self, DeriveError>
Derive a child key at a hardened index.
SLIP-0010 only supports hardened derivation for Ed25519.
The hardened flag (0x8000_0000) is applied automatically.
§Errors
Returns an error if the HMAC key is invalid.
Sourcepub fn derive_path(seed: &[u8], path: &str) -> Result<Self, DeriveError>
pub fn derive_path(seed: &[u8], path: &str) -> Result<Self, DeriveError>
Derive a key at an arbitrary SLIP-0010 path.
Path format: m/44'/501'/0'/0' — every component must be marked
hardened with a trailing ' or h. SLIP-0010 only defines
hardened derivation for Ed25519, so unhardened components (e.g.
"m/44/0") are rejected up-front rather than silently promoted.
§Errors
Returns DeriveError::Path if the path is malformed, contains an
unhardened segment, or derivation fails.
Sourcepub fn to_signing_key(&self) -> SigningKey
pub fn to_signing_key(&self) -> SigningKey
Convert the derived private key to an Ed25519 SigningKey.
Sourcepub fn verifying_key(&self) -> VerifyingKey
pub fn verifying_key(&self) -> VerifyingKey
Derive the Ed25519 VerifyingKey (public key).
Sourcepub fn private_key_bytes(&self) -> Zeroizing<[u8; 32]>
pub fn private_key_bytes(&self) -> Zeroizing<[u8; 32]>
Get the 32-byte raw private key. Returned copy is zeroized on drop.
Sourcepub fn private_key_hex(&self) -> Zeroizing<String>
pub fn private_key_hex(&self) -> Zeroizing<String>
Get the 32-byte private key as a lowercase hex string. The returned
String is zeroized on drop.
Sourcepub fn public_key_bytes(&self) -> [u8; 32]
pub fn public_key_bytes(&self) -> [u8; 32]
Get the 32-byte Ed25519 public key.
Sourcepub fn chain_code_bytes(&self) -> Zeroizing<[u8; 32]>
pub fn chain_code_bytes(&self) -> Zeroizing<[u8; 32]>
Get the 32-byte chain code. Returned copy is zeroized on drop.
Callers rarely need this — it only exists for SLIP-0010 compliance testing and advanced derivation schemes.