mnemonic_to_seed

Function mnemonic_to_seed 

Source
pub fn mnemonic_to_seed(
    mnemonic_phrase: &str,
    passphrase: Option<&str>,
) -> Result<Vec<u8>, DerivationError>
Expand description

Converts a mnemonic phrase to a seed with optional passphrase.

§Arguments

  • mnemonic_phrase - The mnemonic phrase to convert
  • passphrase - Optional BIP39 passphrase (default: empty string)

§Returns

  • Result<Vec<u8>, DerivationError> - The seed bytes (always 64 bytes) or an error

§Security

WARNING: The returned seed is highly sensitive cryptographic material. Callers must ensure the returned Vec<u8> is properly zeroized when no longer needed. Consider using zeroize::Zeroize trait to securely clear the data from memory.

§Example

use bitcoin_address_generator::mnemonic_to_seed;

let mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
let seed = mnemonic_to_seed(mnemonic, None).unwrap();
assert_eq!(seed.len(), 64);