Skip to main content

Class: Bip39

Implementation of Bip39 for mnemonic generation.

Table of contents

Methods

Constructors

Methods

setWordList

Static setWordList(wordlistData, joiningChar?): void

Set the wordlist and joining character.

Parameters

NameTypeDefault valueDescription
wordlistDatastring[]undefinedArray of words.
joiningCharstring" "The character to join the words with.

Returns

void


randomMnemonic

Static randomMnemonic(length?): string

Generate a random mnemonic.

Parameters

NameTypeDefault valueDescription
lengthnumber256The length of the mnemonic to generate, defaults to 256.

Returns

string

The random mnemonic.


entropyToMnemonic

Static entropyToMnemonic(entropy): string

Generate a mnemonic from the entropy.

Parameters

NameTypeDescription
entropyUint8ArrayThe entropy to generate.

Returns

string

The mnemonic.


mnemonicToSeed

Static mnemonicToSeed(mnemonic, password?, iterations?, keyLength?): Uint8Array

Convert a mnemonic to a seed.

Parameters

NameTypeDefault valueDescription
mnemonicstringundefinedThe mnemonic to convert.
password?stringundefinedThe password to apply to the seed generation.
iterationsnumber2048The number of iterations to perform on the password function, defaults to 2048.
keyLengthnumber64The size of the key length to generate, defaults to 64.

Returns

Uint8Array

The seed.


mnemonicToEntropy

Static mnemonicToEntropy(mnemonic): Uint8Array

Convert the mnemonic back to entropy.

Parameters

NameTypeDescription
mnemonicstringThe mnemonic to convert.

Returns

Uint8Array

The entropy.


entropyChecksumBits

Static entropyChecksumBits(entropy): string

Calculate the entropy checksum.

Parameters

NameTypeDescription
entropyUint8ArrayThe entropy to calculate the checksum for.

Returns

string

The checksum.

Constructors

constructor

new Bip39()