pub fn derive_private_key(
mnemonic_phrase: &str,
derivation_path_str: Option<&str>,
network: Option<Network>,
bip39_passphrase: Option<&str>,
) -> Result<String, DerivationError>Expand description
Derives a private key in WIF format from a mnemonic phrase, derivation path, network type, and optional BIP39 passphrase.
§Arguments
mnemonic_phrase- A BIP39 mnemonic phrase (space-separated words)derivation_path_str- Optional BIP32 derivation path (e.g., “m/84’/0’/0’/0/0”). Default is “m/84’/0’/0’/0/0”.network- Optional network type. Default is Network::Bitcoin.bip39_passphrase- Optional BIP39 passphrase. Default is an empty string.
§Returns
Result<String, DerivationError>- The private key in WIF format or an error
§Errors
DerivationError::Bip39Error- If the mnemonic is invalidDerivationError::Bip32Error- If key derivation failsDerivationError::SecpError- If secp256k1 operations fail