Skip to content

Class: MnemonicUtils

Constructors

new MnemonicUtils()

new MnemonicUtils(): MnemonicUtils

Returns

MnemonicUtils

Properties

DEFAULT_WORDLIST

static DEFAULT_WORDLIST: string[]

The default English wordlist.

Defined in

@nimiq/core/lib/index.d.ts:260


ENGLISH_WORDLIST

static ENGLISH_WORDLIST: string[]

The English wordlist.

Defined in

@nimiq/core/lib/index.d.ts:256

Methods

entropyToMnemonic()

static entropyToMnemonic(entropy, wordlist?): string[]

Converts an Entropy to a mnemonic.

Parameters

entropy: string | ArrayBuffer | Uint8Array | Entropy

wordlist?: string[]

Returns

string[]

Defined in

@nimiq/core/lib/index.d.ts:264


getMnemonicType()

static getMnemonicType(mnemonic, wordlist?): MnemonicType

Gets the type of a mnemonic.

Return values:

  • 0 = MnemonicType.LEGACY: the mnemonic is for a legacy Nimiq wallet.
  • 1 = MnemonicType.BIP39: the mnemonic is for a BIP39 wallet.
  • -1 = MnemonicType.UNKNOWN: the mnemonic can be for both.

Throws if the menmonic is invalid.

Parameters

mnemonic: string | string[]

wordlist?: string[]

Returns

MnemonicType

Defined in

@nimiq/core/lib/index.d.ts:295


isCollidingChecksum()

static isCollidingChecksum(entropy): boolean

Tests if a mnemonic can be both for a legacy Nimiq wallet and a BIP39 wallet.

Parameters

entropy: Entropy

Returns

boolean

Defined in

@nimiq/core/lib/index.d.ts:284


mnemonicToEntropy()

static mnemonicToEntropy(mnemonic, wordlist?): Entropy

Converts a mnemonic to an Entropy.

Parameters

mnemonic: string | string[]

wordlist?: string[]

Returns

Entropy

Defined in

@nimiq/core/lib/index.d.ts:268


mnemonicToExtendedPrivateKey()

static mnemonicToExtendedPrivateKey(mnemonic, password?): ExtendedPrivateKey

Converts a mnemonic to an extended private key.

Optionally takes a password to use for the seed derivation.

Parameters

mnemonic: string | string[]

password?: string

Returns

ExtendedPrivateKey

Defined in

@nimiq/core/lib/index.d.ts:280


mnemonicToSeed()

static mnemonicToSeed(mnemonic, password?): SerialBuffer

Converts a mnemonic to a seed.

Optionally takes a password to use for the seed derivation.

Parameters

mnemonic: string | string[]

password?: string

Returns

SerialBuffer

Defined in

@nimiq/core/lib/index.d.ts:274