StaticgenerateGenerates a mnemonic phrase based on the specified strength.
The entropy strength for the mnemonic generation. Acceptable values are 128, 192, or 256 bits. Defaults to 128 if not specified.
A mnemonic phrase as a string.
StaticvalidateValidates a given mnemonic phrase against the BIP39 wordlist.
The mnemonic phrase to validate.
true if the mnemonic is valid, otherwise false.
StatictoConverts a BIP-39 mnemonic phrase into a seed.
The BIP-39 mnemonic phrase to be converted into a seed.
An optional password used to secure the seed. Defaults to an empty string if not provided.
A Uint8Array representing the generated seed.
StatictoConverts a BIP-39 mnemonic phrase into its corresponding entropy.
The BIP-39 mnemonic phrase to be converted.
A Uint8Array representing the entropy derived from the mnemonic.
StaticfromGenerates a mnemonic phrase from the provided entropy.
A Uint8Array representing the entropy used to generate the mnemonic.
A string containing the mnemonic phrase derived from the entropy.
Staticto0xConverts a mnemonic phrase into a private key in the form of a Uint8Array.
The BIP-39 mnemonic phrase used to generate the seed.
OptionalderivationIndex: number
(Optional) The index used for deriving the key from the hierarchical deterministic (HD) path. If not provided, a default derivation path will be used.
The derived private key as a Uint8Array.
The
Mnemonicclass provides utility methods for working with BIP-39 mnemonic phrases. It includes functionality for generating, validating, and converting mnemonic phrases to entropy, seeds, and private keys. This class leverages the BIP-39 standard for secure and deterministic key generation.Methods:
generate(strength: 128 | 192 | 256 = 128): string: Generates a mnemonic phrase based on the specified entropy strength. Acceptable values are 128, 192, or 256 bits. Defaults to 128 if not specified.validate(mnemonic: string): boolean: Validates a given mnemonic phrase against the BIP-39 wordlist. Returnstrueif the mnemonic is valid, otherwisefalse.toSeed(mnemonic: string, password: string = ""): Uint8Array: Converts a BIP-39 mnemonic phrase into a seed. An optional password can be provided to secure the seed. Defaults to an empty string if not specified.toEntropy(mnemonic: string): Uint8Array: Converts a BIP-39 mnemonic phrase into its corresponding entropy.fromEntropy(entropy: Uint8Array): string: Generates a mnemonic phrase from the provided entropy.to0xPrivateKey(mnemonic: string, derivationIndex?: number): Uint8Array: Converts a mnemonic phrase into a private key in the form of aUint8Array. Optionally accepts a derivation index for hierarchical deterministic (HD) path derivation.