Constructor
new Mnemonic(options)
Create a mnemonic.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- 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) → {Object}
Retrieve the wordlist for a language.
Parameters:
Name | Type | Description |
---|---|---|
lang |
String |
- Source:
Returns:
- Type
- Object
(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, langnullable)
Inject properties from entropy.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
entropy |
Buffer | ||
lang |
String |
<nullable> |
- Source:
(private) fromJSON(json)
Inject properties from json object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object |
- Source:
(private) fromOptions(options)
Inject properties from options object.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
(private) 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
(private) read(br)
Inject properties from buffer reader.
Parameters:
Name | Type | Description |
---|---|---|
br |
BufferReader |
- Source:
toSeed(passphrasenullable) → {Buffer}
Generate the seed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
passphrase |
String |
<nullable> |
- Source:
Returns:
pbkdf2 seed.
- Type
- Buffer
toString() → {String}
Convert the mnemonic to a string.
- Source:
Returns:
- Type
- String
write()
Write the mnemonic to a buffer writer.
- Source: