Constructor
new Mnemonic(optionsopt)
Create a mnemonic.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
String | MnemonicOptions |
<optional> |
- Source:
Members
(static, constant) languages :Array.<String>
List of languages.
Type:
- Array.<String>
- Default Value:
["simplified chinese","traditional chinese","english","french","italian","japanese","portuguese","spanish"]
- Source:
Methods
(static) fromEntropy(entropy, langnullable) → {Mnemonic}
Instantiate mnemonic from entropy.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
entropy |
Buffer | ||
lang |
String |
<nullable> |
- Source:
Returns:
- Type
- Mnemonic
(static) fromPhrase(phrase) → {Mnemonic}
Instantiate mnemonic from a phrase (validates checksum).
Parameters:
Name | Type | Description |
---|---|---|
phrase |
String |
- Source:
Throws:
on bad checksum
Returns:
- Type
- Mnemonic
(static) getLanguage(word) → {String}
Determine a single word's language.
Parameters:
Name | Type | Description |
---|---|---|
word |
String |
- Source:
Throws:
on not found.
Returns:
Language.
- Type
- String
(static) getWordlist(lang) → {WordList}
Retrieve the wordlist for a language.
Parameters:
Name | Type | Description |
---|---|---|
lang |
String |
- Source:
Returns:
- Type
- WordList
(static) isMnemonic(obj) → {Boolean}
Test whether an object is a Mnemonic.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
- Source:
Returns:
- Type
- Boolean
destroy()
Destroy the mnemonic (zeroes entropy).
- Source:
format() → {String}
Inspect the mnemonic.
- Source:
Returns:
- Type
- String
(private) fromEntropy(entropy, langopt, nullable)
Inject properties from entropy.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
entropy |
Buffer | ||
lang |
String |
<optional> <nullable> |
- Source:
fromJSON(json)
Inject properties from json object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object |
- Source:
fromOptions(options)
Inject properties from options object.
Parameters:
Name | Type | Description |
---|---|---|
options |
String | MnemonicOptions |
- Source:
fromPhrase(phrase)
Inject properties from phrase.
Parameters:
Name | Type | Description |
---|---|---|
phrase |
String |
- Source:
getEntropy() → {Buffer}
Get or generate entropy.
- Source:
Returns:
- Type
- Buffer
getJSON() → {Object}
Convert mnemonic to a json-friendly object.
- Source:
Returns:
- Type
- Object
getPhrase() → {String}
Generate a mnemonic phrase from chosen language.
- Source:
Returns:
- Type
- String
getSize() → {Number}
Calculate serialization size.
- Source:
Returns:
- Type
- Number
read(br)
Inject properties from buffer reader.
Parameters:
Name | Type | Description |
---|---|---|
br |
bio.BufferReader |
- Source:
toSeed(passphraseopt, nullable) → {Buffer}
Generate the seed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
passphrase |
String |
<optional> <nullable> |
- Source:
Returns:
pbkdf2 seed.
- Type
- Buffer
toString() → {String}
Convert the mnemonic to a string.
- Source:
Returns:
- Type
- String
write(bw) → {BufioWriter}
Write the mnemonic to a buffer writer.
Parameters:
Name | Type | Description |
---|---|---|
bw |
BufioWriter |
- Source:
Returns:
- Type
- BufioWriter