Mnemonics¶
- class index.MNEMONICS()¶
Registry for all supported mnemonic schemes.
- Provides utility functions to:
List all available mnemonic names (getNames).
Retrieve classes for each mnemonic (getClasses).
Lookup a specific mnemonic implementation by name (getMnemonicClass).
Validate whether a mnemonic name is supported (isMnemonic).
exported from
mnemonics.indexName
Class
Algorand
BIP39
Electrum-V1
Electrum-V2
Monero
- static index.MNEMONICS.getClasses()¶
Get the list of all supported mnemonic classes.
- Returns:
typeof Mnemonic[] – Array of mnemonic class constructors.
- static index.MNEMONICS.getMnemonicClass(name)¶
Lookup a mnemonic class by name.
- Arguments:
name (string) – The mnemonic name to lookup (e.g.
"BIP39").
- Returns:
any – The corresponding mnemonic class.
- static index.MNEMONICS.getNames()¶
Get the list of all supported mnemonic names.
- Returns:
string[] – Array of mnemonic names, e.g.
["Algorand", "BIP39", "Electrum-V1", "Electrum-V2", "Monero"].
- static index.MNEMONICS.isMnemonic(name)¶
Check if a given name corresponds to a supported mnemonic.
- Arguments:
name (string) – The mnemonic name to check.
- Returns:
boolean – true if the name is supported, otherwise
false.
- class mnemonic.Mnemonic(mnemonic, options={})¶
Abstract base class for Mnemonic implementations.
Provides common functionality for handling mnemonics such as: - Normalizing word arrays - Validating mnemonics against wordlists - Detecting language
Specific standards (e.g., BIP39, Electrum V1, Electrum V2, Monero) must extend this class and override methods like
getName,fromWords, fromEntropy,encode, anddecode.exported from
mnemonics.mnemonicCreate a new mnemonic instance.
- Arguments:
mnemonic (string | string[]) – A string or array of words representing the mnemonic.
options (MnemonicOptionsInterface) – Optional settings including custom wordlists.
- mnemonic.Mnemonic.language¶
type: string
- mnemonic.Mnemonic.mnemonic¶
type: string[]
- mnemonic.Mnemonic.options¶
type: MnemonicOptionsInterface
- mnemonic.Mnemonic.words¶
type: number
- mnemonic.Mnemonic.languages¶
type: string[]
- mnemonic.Mnemonic.wordLists¶
type: Record<string, string[]>
- mnemonic.Mnemonic.wordsList¶
type: number[]
- mnemonic.Mnemonic.getLanguage()¶
Get the language of the mnemonic.
- Returns:
string – The detected language.
- mnemonic.Mnemonic.getMnemonic()¶
Get the full mnemonic phrase as a string.
- Returns:
string – The mnemonic phrase.
- mnemonic.Mnemonic.getMnemonicType()¶
Get the mnemonic type (scheme-specific). Must be overridden by subclasses.
- Returns:
string
- mnemonic.Mnemonic.getName()¶
Instance method to get the scheme name.
- Returns:
string – The name of the mnemonic type.
- mnemonic.Mnemonic.getWords()¶
Get the number of words in the mnemonic.
- Returns:
number – Word count.
- static mnemonic.Mnemonic.decode(mnemonic, options={})¶
Decode a mnemonic phrase into entropy. Must be overridden by subclasses.
- Arguments:
mnemonic (string | string[]) – Mnemonic as string or array of words.
options (MnemonicOptionsInterface) – Optional settings.
- Returns:
string – Decoded entropy in hex.
- static mnemonic.Mnemonic.encode(entropy, language, options={})¶
Encode entropy into a mnemonic phrase. Must be overridden by subclasses.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike>) – Entropy as hex or bytes.
language (string) – Language code.
options (MnemonicOptionsInterface) – Optional settings.
- Returns:
string – Encoded mnemonic.
- static mnemonic.Mnemonic.findLanguage(mnemonic, wordLists)¶
Detect the language of a mnemonic by matching words to wordlists.
- Arguments:
mnemonic (string[]) – Array of words to check.
wordLists (Record<string, string[]>) – Optional custom wordlists.
- Returns:
[string[], string] – A tuple containing the matched wordlist and language.
- static mnemonic.Mnemonic.fromEntropy(entropy, language, options={})¶
Generate a mnemonic from entropy. Must be overridden by subclasses.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike> | Entropy) – Entropy as hex, bytes, or Entropy instance.
language (string) – Language code.
options (MnemonicOptionsInterface) – Optional settings.
- Returns:
string – Generated mnemonic.
- static mnemonic.Mnemonic.fromWords(words, language, options={})¶
Generate a mnemonic from word count and language. Must be overridden by subclasses.
- Arguments:
words (number) – The number of words.
language (string) – Language code.
options (MnemonicOptionsInterface) – Optional settings.
- Returns:
string – Generated mnemonic.
- static mnemonic.Mnemonic.getName()¶
Get the mnemonic scheme name. Must be overridden by subclasses (e.g., “BIP39”, “Electrum-V1”).
- Returns:
string
- static mnemonic.Mnemonic.getWordsListByLanguage(language, wordLists)¶
Get a wordlist by language.
- Arguments:
language (string) – Language code.
wordLists (Record<string, string[]>) – Optional custom wordlists.
- Returns:
string[] – The wordlist for the given language.
- static mnemonic.Mnemonic.isValid(mnemonic, options={})¶
Validate if a mnemonic is correct for its scheme.
- Arguments:
mnemonic (string | string[]) – Mnemonic as string or word array.
options (MnemonicOptionsInterface) – Optional settings.
- Returns:
boolean – True if valid, false otherwise.
- static mnemonic.Mnemonic.isValidLanguage(language)¶
Check if a language is supported.
- Arguments:
language (string) – Language code.
- Returns:
boolean – True if valid.
- static mnemonic.Mnemonic.isValidWords(words)¶
Check if the number of words is supported.
- Arguments:
words (number) – Word count.
- Returns:
boolean – True if supported.
- static mnemonic.Mnemonic.normalize(mnemonic)¶
Normalize a mnemonic into a word array.
- Arguments:
mnemonic (string | string[]) – Mnemonic as string or word array.
- Returns:
string[] – Normalized word array.
- class algorand.mnemonic.AlgorandMnemonic()¶
Represents an Algorand mnemonic implementation.
This class provides functionality to generate, encode, decode, and validate mnemonics based on Algorand’s specification.
Uses 25-word mnemonics
Uses a checksum mechanism (2 bytes, 11-bit words)
Supported languages: English
exported from
mnemonics.algorand.mnemonic- Extends:
Mnemonic
- algorand.mnemonic.AlgorandMnemonic.checksumLength¶
type: number
- algorand.mnemonic.AlgorandMnemonic.languages¶
type: string[]
- algorand.mnemonic.AlgorandMnemonic.wordBitLength¶
type: number
- algorand.mnemonic.AlgorandMnemonic.wordLists¶
type: Record<string, string[]>
- algorand.mnemonic.AlgorandMnemonic.wordsList¶
type: number[]
- algorand.mnemonic.AlgorandMnemonic.wordsToEntropyStrength¶
type: Record<number, number>
- static algorand.mnemonic.AlgorandMnemonic.decode(mnemonic, options={})¶
Decode an Algorand mnemonic back into entropy.
- Arguments:
mnemonic (string | string[]) – Mnemonic string or array of words.
options (MnemonicOptionsInterface) – Optional decode options.
- Returns:
string – Hex string representing entropy.
- static algorand.mnemonic.AlgorandMnemonic.encode(entropyInput, language, options={})¶
Encode entropy bytes into an Algorand mnemonic phrase.
- Arguments:
entropyInput (string | Uint8Array<ArrayBufferLike>) – Entropy (hex string or bytes).
language (string) – Language for wordlist.
options (MnemonicOptionsInterface) – Optional encode options.
- Returns:
string – A space-separated mnemonic.
- static algorand.mnemonic.AlgorandMnemonic.fromEntropy(entropy, language, options={})¶
Generate a mnemonic from entropy input.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike> | Entropy) – Entropy (hex string, Uint8Array, or Entropy object).
language (string) – Target language.
options (MnemonicOptionsInterface) – Optional mnemonic options.
- Returns:
string – A mnemonic phrase.
- static algorand.mnemonic.AlgorandMnemonic.fromWords(words, language, options={})¶
Generate a new mnemonic from word count and language.
- Arguments:
words (number) – Number of words (must be 25).
language (string) – Language of the wordlist.
options (MnemonicOptionsInterface) – Optional mnemonic generation options.
- Returns:
string – A space-separated mnemonic string.
- static algorand.mnemonic.AlgorandMnemonic.getName()¶
Returns the name of this mnemonic type.
- Returns:
string – The string
"Algorand".
- static algorand.mnemonic.AlgorandMnemonic.normalize(input)¶
Normalize input mnemonic into lowercase array of words.
- Arguments:
input (string | string[]) – Mnemonic string or array.
- Returns:
string[] – Normalized array of words.
const { MNEMONICS, AlgorandMnemonic, ALGORAND_MNEMONIC_STRENGTHS } = await import('./src/mnemonics/index.js');
MNEMONICS.names()
console.log(MNEMONICS.getNames());
// Output: [ 'Algorand', 'BIP39', 'Electrum-V1', 'Electrum-V2', 'Monero' ]
MNEMONICS.classes()
console.log(MNEMONICS.getClasses());
// Output: [ [class AlgorandMnemonic], [class BIP39Mnemonic], ... ]
MNEMONICS.getMnemonicClass("Algorand")
console.log(MNEMONICS.getMnemonicClass("Algorand"));
// Output: [class AlgorandMnemonic]
MNEMONICS.getMnemonicClass("Algorand") === AlgorandMnemonic
console.log(MNEMONICS.getMnemonicClass("Algorand") === AlgorandMnemonic);
// Output: true
MNEMONICS.isMnemonic("Algorand")
console.log(MNEMONICS.isMnemonic("Algorand"));
// Output: true
ALGORAND_MNEMONIC_STRENGTHS.TWENTY_FIVE
console.log(ALGORAND_MNEMONIC_STRENGTHS.TWENTY_FIVE);
// Output: 25
- class bip39.mnemonic.BIP39Mnemonic()¶
Implements the BIP-39 mnemonic standard.
BIP-39 mnemonics are human-readable sequences of words that encode entropy with a checksum, making it easier to back up and restore HD wallets.
Supported word counts: 12, 15, 18, 21, 24 Supported languages: Chinese (Simplified/Traditional), Czech, English, French, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Turkish.
Features: - Generate mnemonics from entropy or word count. - Encode entropy into mnemonic phrases. - Decode mnemonic phrases back to entropy. - Verify and normalize mnemonics across languages.
exported from
mnemonics.bip39.mnemonic- Extends:
Mnemonic
- bip39.mnemonic.BIP39Mnemonic.languages¶
type: string[]
- bip39.mnemonic.BIP39Mnemonic.wordBitLength¶
type: number
- bip39.mnemonic.BIP39Mnemonic.wordLists¶
type: Record<string, string[]>
- bip39.mnemonic.BIP39Mnemonic.wordsList¶
type: number[]
- bip39.mnemonic.BIP39Mnemonic.wordsListNumber¶
type: number
- bip39.mnemonic.BIP39Mnemonic.wordsToEntropyStrength¶
type: Record<number, number>
- static bip39.mnemonic.BIP39Mnemonic.decode(mnemonic, options=...)¶
Decode a mnemonic phrase back into entropy.
- Arguments:
mnemonic (string | string[]) – Mnemonic phrase as string or array of words.
options (MnemonicOptionsInterface) – Options for checksum verification and custom wordlists.
- Returns:
string – Hex string of entropy.
- static bip39.mnemonic.BIP39Mnemonic.encode(entropyInput, language, options={})¶
Encode entropy into a BIP-39 mnemonic phrase.
- Arguments:
entropyInput (string | Uint8Array<ArrayBufferLike>) – Hex string or byte array.
language (string) – Wordlist language.
options (MnemonicOptionsInterface) – Additional options.
- Returns:
string – Mnemonic phrase as a string.
- static bip39.mnemonic.BIP39Mnemonic.fromEntropy(entropy, language, options={})¶
Generate a mnemonic phrase from entropy.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike> | Entropy) – Hex string, byte array, or Entropy instance.
language (string) – Language of the wordlist.
options (MnemonicOptionsInterface) – Additional encoding options.
- Returns:
string – Mnemonic phrase as a string.
- static bip39.mnemonic.BIP39Mnemonic.fromWords(words, language, options={})¶
Generate a new mnemonic phrase by word count.
- Arguments:
words (number) – Number of words (12, 15, 18, 21, or 24).
language (string) – Language of the wordlist.
options (MnemonicOptionsInterface) – Additional encoding options.
- Returns:
string – Mnemonic phrase as a string.
- static bip39.mnemonic.BIP39Mnemonic.getName()¶
Get the human-readable name of this mnemonic standard.
- Returns:
string – “BIP39”
- static bip39.mnemonic.BIP39Mnemonic.normalize(input)¶
Normalize a mnemonic phrase into lowercase NFKD words.
- Arguments:
input (string | string[]) – Mnemonic as string or array of words.
- Returns:
string[] – Array of normalized words.
const { MNEMONICS, BIP39Mnemonic, BIP39_MNEMONIC_STRENGTHS } = await import('./src/mnemonics/index.js');
MNEMONICS.names()
console.log(MNEMONICS.getNames());
// Output: [ 'Algorand', 'BIP39', 'Electrum-V1', 'Electrum-V2', 'Monero' ]
MNEMONICS.classes()
console.log(MNEMONICS.getClasses());
// Output: [ [class AlgorandMnemonic], [class BIP39Mnemonic], ... ]
MNEMONICS.getMnemonicClass("BIP39")
console.log(MNEMONICS.getMnemonicClass("BIP39"));
// Output: [class BIP39Mnemonic]
MNEMONICS.getMnemonicClass("BIP39") === BIP39Mnemonic
console.log(MNEMONICS.getMnemonicClass("BIP39") === BIP39Mnemonic);
// Output: true
MNEMONICS.isMnemonic("BIP39")
console.log(MNEMONICS.isMnemonic("BIP39"));
// Output: true
BIP39_MNEMONIC_STRENGTHS.TWELVE
console.log(BIP39_MNEMONIC_STRENGTHS.TWELVE);
// Output: 12
BIP39_MNEMONIC_STRENGTHS.TWENTY_FOUR
console.log(BIP39_MNEMONIC_STRENGTHS.TWENTY_FOUR);
// Output: 24
- class electrum.v1.mnemonic.ElectrumV1Mnemonic()¶
Electrum-V1 mnemonic implementation.
Electrum-V1 mnemonics are generated by encoding entropy into a sequence of words using the Electrum-V1 algorithm.
exported from
mnemonics.electrum.v1.mnemonic- Extends:
Mnemonic
- electrum.v1.mnemonic.ElectrumV1Mnemonic.languages¶
type: string[]
- electrum.v1.mnemonic.ElectrumV1Mnemonic.wordLists¶
type: Record<string, string[]>
- electrum.v1.mnemonic.ElectrumV1Mnemonic.wordsList¶
type: number[]
- electrum.v1.mnemonic.ElectrumV1Mnemonic.wordsListNumber¶
type: number
- electrum.v1.mnemonic.ElectrumV1Mnemonic.wordsToStrength¶
type: Record<number, number>
- static electrum.v1.mnemonic.ElectrumV1Mnemonic.decode(mnemonic, options=...)¶
Decode an Electrum-V1 mnemonic back to entropy.
- Arguments:
mnemonic (string | string[]) – Mnemonic string or array of words.
options (MnemonicOptionsInterface) – Decoding options (e.g. checksum).
- Returns:
string – Hex-encoded entropy string.
- static electrum.v1.mnemonic.ElectrumV1Mnemonic.encode(entropy, language, options={})¶
Encode entropy into an Electrum-V1 mnemonic.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike>) – Entropy as hex string or Uint8Array.
language (string) – Language of the wordlist.
options (MnemonicOptionsInterface) – Optional mnemonic encoding options.
- Returns:
string – A space-separated mnemonic string.
- static electrum.v1.mnemonic.ElectrumV1Mnemonic.fromEntropy(entropy, language, options={})¶
Generate a mnemonic from entropy.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike> | Entropy) – Entropy in hex string, Uint8Array, or Entropy object form.
language (string) – Language of the wordlist.
options (MnemonicOptionsInterface) – Optional mnemonic generation options.
- Returns:
string – A space-separated mnemonic string.
- static electrum.v1.mnemonic.ElectrumV1Mnemonic.fromWords(count, language, options={})¶
Generate a mnemonic from word count and language.
- Arguments:
count (number) – Number of words (must be in
wordsList).language (string) – Language of the wordlist.
options (MnemonicOptionsInterface) – Optional mnemonic generation options.
- Returns:
string – A space-separated mnemonic string.
- static electrum.v1.mnemonic.ElectrumV1Mnemonic.getName()¶
Get the name of this mnemonic type.
- Returns:
string – The string
"Electrum-V1".
- static electrum.v1.mnemonic.ElectrumV1Mnemonic.isValid(input, options={})¶
Validate if the given input is a valid Electrum-V1 mnemonic.
- Arguments:
input (string | string[]) – Mnemonic string or array of words.
options (MnemonicOptionsInterface) – Validation options.
- Returns:
boolean – True if valid, false otherwise.
- static electrum.v1.mnemonic.ElectrumV1Mnemonic.normalize(input)¶
Normalize input mnemonic or words list.
- Arguments:
input (string | string[]) – Mnemonic string or array of words.
- Returns:
string[] – Normalized array of lowercase words (NFKD).
const { MNEMONICS, ElectrumV1Mnemonic, ELECTRUM_V1_MNEMONIC_WORDS, ELECTRUM_V1_MNEMONIC_LANGUAGES } = await import('./src/mnemonics/index.js');
MNEMONICS.names()
console.log(MNEMONICS.getNames());
// Output: [ 'Algorand', 'BIP39', 'Electrum-V1', 'Electrum-V2', 'Monero' ]
MNEMONICS.classes()
console.log(MNEMONICS.getClasses());
// Output: [ [class AlgorandMnemonic], [class BIP39Mnemonic], [class ElectrumV1Mnemonic], ... ]
MNEMONICS.getMnemonicClass("Electrum-V1")
console.log(MNEMONICS.getMnemonicClass("Electrum-V1"));
// Output: [class ElectrumV1Mnemonic]
MNEMONICS.getMnemonicClass("Electrum-V1") === ElectrumV1Mnemonic
console.log(MNEMONICS.getMnemonicClass("Electrum-V1") === ElectrumV1Mnemonic);
// Output: true
MNEMONICS.isMnemonic("Electrum-V1")
console.log(MNEMONICS.isMnemonic("Electrum-V1"));
// Output: true
ELECTRUM_V1_MNEMONIC_WORDS.TWELVE
console.log(ELECTRUM_V1_MNEMONIC_WORDS.TWELVE);
// Output: 12
ELECTRUM_V1_MNEMONIC_LANGUAGES.ENGLISH
console.log(ELECTRUM_V1_MNEMONIC_LANGUAGES.ENGLISH);
// Output: 'english'
- class electrum.v2.mnemonic.ElectrumV2Mnemonic()¶
Electrum V2 Mnemonic implementation.
Provides methods for: - Generating mnemonics from entropy or directly from word count. - Encoding and decoding mnemonics. - Validating Electrum V2 mnemonics against BIP39 and Electrum V1. - Supporting multiple languages and mnemonic types (Standard, SegWit, 2FA).
exported from
mnemonics.electrum.v2.mnemonic- Extends:
Mnemonic
- electrum.v2.mnemonic.ElectrumV2Mnemonic.languages¶
type: string[]
- electrum.v2.mnemonic.ElectrumV2Mnemonic.mnemonicTypes¶
type: Record<string, string>
- electrum.v2.mnemonic.ElectrumV2Mnemonic.wordBitLength¶
type: number
- electrum.v2.mnemonic.ElectrumV2Mnemonic.wordLists¶
type: Record<string, string[]>
- electrum.v2.mnemonic.ElectrumV2Mnemonic.wordsList¶
type: number[]
- electrum.v2.mnemonic.ElectrumV2Mnemonic.wordsToEntropyStrength¶
type: Record<number, number>
- electrum.v2.mnemonic.ElectrumV2Mnemonic.getMnemonicType()¶
Get the mnemonic type from instance options.
- Returns:
string – The mnemonic type string
- static electrum.v2.mnemonic.ElectrumV2Mnemonic.decode(mnemonic, option=...)¶
Decode an Electrum-V2 mnemonic back into entropy.
- Arguments:
mnemonic (string | string[]) – Mnemonic phrase
option (MnemonicOptionsInterface) – Mnemonic options (type required)
- Returns:
string – Entropy as a string
- static electrum.v2.mnemonic.ElectrumV2Mnemonic.encode(entropy, language, option=...)¶
Encode entropy into an Electrum-V2 mnemonic.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike>) – Raw entropy (hex, bytes)
language (string) – Wordlist language
option (MnemonicOptionsInterface) – Mnemonic options
- Returns:
string – Mnemonic string
- static electrum.v2.mnemonic.ElectrumV2Mnemonic.fromEntropy(entropy, language, option=...)¶
Generate a mnemonic from entropy.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike> | Entropy) – Raw entropy (hex string, byte array, or Entropy object)
language (string) – Wordlist language
option (MnemonicOptionsInterface) – Mnemonic options (type + maxAttempts)
- Returns:
string – A valid Electrum-V2 mnemonic
- static electrum.v2.mnemonic.ElectrumV2Mnemonic.fromWords(count, language, option=...)¶
Generate a mnemonic from a specified word count.
- Arguments:
count (number) – Number of words (12 or 24)
language (string) – Wordlist language
option (MnemonicOptionsInterface) – Mnemonic options (type + maxAttempts)
- Returns:
string – A valid Electrum-V2 mnemonic string
- static electrum.v2.mnemonic.ElectrumV2Mnemonic.getName()¶
Get the identifier name for this mnemonic scheme.
- Returns:
string – “Electrum-V2”
- static electrum.v2.mnemonic.ElectrumV2Mnemonic.isType(input, mnemonicType)¶
Check if a mnemonic belongs to the specified type.
- Arguments:
input (string | string[]) – Mnemonic words
mnemonicType (string) – Target mnemonic type
- Returns:
boolean – True if mnemonic type matches
- static electrum.v2.mnemonic.ElectrumV2Mnemonic.isValid(input, option=...)¶
Validate whether input is a valid Electrum-V2 mnemonic.
- Arguments:
input (string | string[]) – Mnemonic words
option (MnemonicOptionsInterface) – Mnemonic options
- Returns:
boolean – True if valid, false otherwise
- static electrum.v2.mnemonic.ElectrumV2Mnemonic.normalize(input)¶
Normalize input (string or array) into lowercase words (NFKD form).
- Arguments:
input (string | string[]) – Mnemonic phrase or word array
- Returns:
string[] – Normalized word array
const { MNEMONICS, ElectrumV2Mnemonic, ELECTRUM_V2_MNEMONIC_WORDS, ELECTRUM_V2_MNEMONIC_LANGUAGES, ELECTRUM_V2_MNEMONIC_TYPES } = await import('./src/mnemonics/index.js');
MNEMONICS.names()
console.log(MNEMONICS.getNames());
// Output: [ 'Algorand', 'BIP39', 'Electrum-V1', 'Electrum-V2', 'Monero' ]
MNEMONICS.classes()
console.log(MNEMONICS.getClasses());
// Output: [ [class AlgorandMnemonic], [class BIP39Mnemonic], [class ElectrumV1Mnemonic], [class ElectrumV2Mnemonic], [class MoneroMnemonic] ]
MNEMONICS.getMnemonicClass("Electrum-V2")
console.log(MNEMONICS.getMnemonicClass("Electrum-V2"));
// Output: [class ElectrumV2Mnemonic]
MNEMONICS.getMnemonicClass("Electrum-V2") === ElectrumV2Mnemonic
console.log(MNEMONICS.getMnemonicClass("Electrum-V2") === ElectrumV2Mnemonic);
// Output: true
MNEMONICS.isMnemonic("Electrum-V2")
console.log(MNEMONICS.isMnemonic("Electrum-V2"));
// Output: true
ELECTRUM_V2_MNEMONIC_WORDS.TWELVE
console.log(ELECTRUM_V2_MNEMONIC_WORDS.TWELVE);
// Output: 12
ELECTRUM_V2_MNEMONIC_WORDS.TWENTY_FOUR
console.log(ELECTRUM_V2_MNEMONIC_WORDS.TWENTY_FOUR);
// Output: 24
ELECTRUM_V2_MNEMONIC_LANGUAGES.ENGLISH
console.log(ELECTRUM_V2_MNEMONIC_LANGUAGES.ENGLISH);
// Output: 'english'
ELECTRUM_V2_MNEMONIC_TYPES.SEGWIT
console.log(ELECTRUM_V2_MNEMONIC_TYPES.SEGWIT);
// Output: 'segwit'
- class monero.mnemonic.MoneroMnemonic()¶
MoneroMnemonic
Implements the Monero-specific mnemonic system which supports multiple languages and variable word counts (12, 13, 24, or 25 words). Provides encoding and decoding between entropy and mnemonic phrases with optional checksum validation.
exported from
mnemonics.monero.mnemonic- Extends:
Mnemonic
- monero.mnemonic.MoneroMnemonic.checksumWordCounts¶
type: number[]
- monero.mnemonic.MoneroMnemonic.languageUniquePrefixLengths¶
type: Record<string, number>
- monero.mnemonic.MoneroMnemonic.languages¶
type: string[]
- monero.mnemonic.MoneroMnemonic.wordBitLength¶
type: number
- monero.mnemonic.MoneroMnemonic.wordLists¶
type: Record<string, string[]>
- monero.mnemonic.MoneroMnemonic.wordsList¶
type: number[]
- monero.mnemonic.MoneroMnemonic.wordsToStrength¶
type: Record<number, number>
- static monero.mnemonic.MoneroMnemonic.decode(input, options={})¶
Decodes a Monero mnemonic phrase into entropy.
- Arguments:
input (string | string[]) – Mnemonic phrase as string or array of words.
options (MnemonicOptionsInterface) – Options (checksum validation).
- Returns:
string – Hex string of entropy.
- static monero.mnemonic.MoneroMnemonic.encode(entropy, language, options={})¶
Encodes raw entropy bytes into a Monero mnemonic phrase.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike>) – Raw entropy.
language (string) – Language for the mnemonic.
options (MnemonicOptionsInterface) – Options, supports
{ checksum: true }.
- Returns:
string – Encoded mnemonic phrase.
- static monero.mnemonic.MoneroMnemonic.fromEntropy(entropy, language, options={})¶
Generates a mnemonic phrase from entropy.
- Arguments:
entropy (string | Uint8Array<ArrayBufferLike> | Entropy) – Entropy in hex, bytes, or Entropy object.
language (string) – Target language for words.
options (MnemonicOptionsInterface) – Options (e.g., checksum).
- Returns:
string – Mnemonic phrase.
- static monero.mnemonic.MoneroMnemonic.fromWords(count, language)¶
Generates a mnemonic phrase from a given word count.
- Arguments:
count (number) – The number of words (12, 13, 24, or 25).
language (string) – The language of the mnemonic (must be one of
MONERO_MNEMONIC_LANGUAGES).
- Returns:
string – Mnemonic phrase.
- static monero.mnemonic.MoneroMnemonic.getName()¶
Returns the name of this mnemonic type.
- Returns:
string – “Monero”
- static monero.mnemonic.MoneroMnemonic.normalize(input)¶
Normalizes mnemonic input into a lowercase word array.
- Arguments:
input (string | string[]) – Mnemonic phrase (string or array).
- Returns:
string[] – Normalized words.
const { MNEMONICS, MoneroMnemonic, MONERO_MNEMONIC_STRENGTHS } = await import('./src/mnemonics/index.js');
MNEMONICS.names()
console.log(MNEMONICS.getNames());
// Output: [ 'Algorand', 'BIP39', 'Electrum-V1', 'Electrum-V2', 'Monero' ]
MNEMONICS.classes()
console.log(MNEMONICS.getClasses());
// Output: [ [class AlgorandMnemonic], [class BIP39Mnemonic], ... ]
MNEMONICS.getMnemonicClass("Monero")
console.log(MNEMONICS.getMnemonicClass("Monero"));
// Output: [class MoneroMnemonic]
MNEMONICS.getMnemonicClass("Monero") === MoneroMnemonic
console.log(MNEMONICS.getMnemonicClass("Monero") === MoneroMnemonic);
// Output: true
MNEMONICS.isMnemonic("Monero")
console.log(MNEMONICS.isMnemonic("Monero"));
// Output: true
MONERO_MNEMONIC_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT
console.log(MONERO_MNEMONIC_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT);
// Output: 128
MONERO_MNEMONIC_STRENGTHS.TWO_HUNDRED_FIFTY_SIX
console.log(MONERO_MNEMONIC_STRENGTHS.TWO_HUNDRED_FIFTY_SIX);
// Output: 256