generateMnemonic method
Generates a random mnemonic.
Defaults to 128-bits of entropy.
By default it uses Random.secure()
under the food to get random bytes,
but you can swap RNG by providing randomBytes
.
strength
- Optional number of entropy bits
randomBytes
- A seed buffer of random data to provide entropy
Implementation
Future<String> generateMnemonic({ int strength = 128, RandomBytes randomBytes = _nextBytes }) async {
assert(strength % 32 == 0);
final entropy = randomBytes(strength ~/ 8);
return await _entropyToMnemonic(entropy, loadWordResource);
}