generate static method

Mnemonic generate({
  1. int words = 12,
})

BIP39: Since the vast majority of BIP39 wallets supports only the English wordlist, it is strongly discouraged to use non-English wordlists.

Substrate-BIP39 also only supports english wordlist.

Implementation

static Mnemonic generate({int words = 12}) {
  final wordsToEntropy = {
    12: 128,
    15: 160,
    18: 192,
    21: 224,
    24: 256,
  };
  final entropy = wordsToEntropy[words];
  if (entropy == null) {
    throw SubstrateBip39Exception.invalidEntropy(
        'Invalid number of words given for phrase, must be 12/15/18/21/24');
  }
  return Mnemonic.generate(Language.english, entropyLength: entropy);
}