#[non_exhaustive]pub struct DerivedKey {
pub private_key: Zeroizing<[u8; 32]>,
pub chain_code: Zeroizing<[u8; 32]>,
}Expand description
SLIP-0010 derived Ed25519 key pair.
Contains a 32-byte private key and chain code. All sensitive fields
are wrapped in Zeroizing for automatic secure cleanup on drop.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.private_key: Zeroizing<[u8; 32]>32-byte Ed25519 private key.
chain_code: Zeroizing<[u8; 32]>32-byte chain code for further derivation.
Implementations§
Source§impl DerivedKey
impl DerivedKey
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' — all components are treated as
hardened (Ed25519 requirement). Trailing ' or h markers are optional.
§Errors
Returns an error if the path is malformed 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.