generateMnemonic method
Generates a BIP-39 mnemonic phrase with the specified strength. Generates a random BIP-39 mnemonic phrase of a specified word length.
This method generates a random entropy of the specified size (in bytes)
and converts it into a BIP-39 mnemonic phrase. The strength
parameter
determines the word length of the mnemonic (e.g., 12, 15, 18, 21, or 24 words).
Parameters:
strength
: The desired word length for the mnemonic phrase.
Returns: A randomly generated BIP-39 mnemonic phrase as a String.
Implementation
String generateMnemonic(
{Bip39WordLength strength = Bip39WordLength.words12}) {
final entropy = generateRandom(size: strength.value ~/ 8);
return entropyToMnemonic(bytesToHex(entropy));
}