a 2048-word array to use as the BIP39 word list
the entropy length to generate – 16, 20, 24, 28, or 32 bytes (defaults to 16).
Optional
generateGenerate a Uint8Array of the specified length containing a cryptographically-random series of bytes.
For safety, this function first verifies that the provided generate
function produces unique results across two evaluations; by default, this
verifies that the crypto.getRandomValues
function provided by the
JavaScript environment appears to be producing random values.
While this validation can't prevent a compromised environment from producing attacker-known entropy, it may help to prevent software defects in unusual environments (e.g. React Native) from impacting end-user security.
An Error
is thrown if this validation fails, otherwise, the Uint8Array
produced by the first evaluation is returned.
the length of the Uint8Array to generate
a function used to generate the random bytes, defaults to generateRandomBytesUnchecked.
Generate a Uint8Array of the specified length containing a cryptographically-random series of bytes. See generateRandomBytes for a safer alternative.
Generated using TypeDoc
Generate a new, cryptographically secure, BIP39 mnemonic phrase using a localized or custom word list.
See generateBip39Mnemonic to generate a standard, 12-word English mnemonic phrase.
See encodeBip39Mnemonic to encode existing entropy as a BIP39 mnemonic phrase.
Usage