new Master(options)
Master BIP32 key which can exist in an timed out encrypted state.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Methods
(static) fromJSON() → {MasterKey}
Instantiate master key from jsonified object.
- Source:
Returns:
- Type
- MasterKey
(static) fromKey(key) → {MasterKey}
Instantiate master key from an HDPrivateKey.
Parameters:
Name | Type | Description |
---|---|---|
key |
HDPrivateKey |
- Source:
Returns:
- Type
- MasterKey
(static) fromRaw() → {MasterKey}
Instantiate master key from serialized data.
- Source:
Returns:
- Type
- MasterKey
(static) isMasterKey(obj) → {Boolean}
Test whether an object is a MasterKey.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
- Source:
Returns:
- Type
- Boolean
(static) listen(id, optionsnullable) → {Master}
Listen for messages from master process (only if worker).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
Number | Worker id. |
|
options |
Object |
<nullable> |
- Source:
Returns:
- Type
- Master
debug(…args)
Write a debug message, prefixing it with the worker ID.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
String |
<repeatable> |
- Source:
decrypt(passphrase)
Decrypt the key permanently.
Parameters:
Name | Type | Description |
---|---|---|
passphrase |
Buffer | String | Zero this yourself. |
- Source:
destroy()
Destroy the key by zeroing the privateKey and chainCode. Stop the timer if there is one.
- Source:
destroy()
Destroy the worker.
- Source:
encrypt(passphrase)
Encrypt the key permanently.
Parameters:
Name | Type | Description |
---|---|---|
passphrase |
Buffer | String | Zero this yourself. |
- Source:
error(err)
Write an error as a debug message.
Parameters:
Name | Type | Description |
---|---|---|
err |
Error |
- Source:
send(job, name, items) → {Boolean}
Frame and send a packet.
Parameters:
Name | Type | Description |
---|---|---|
job |
String | |
name |
String | |
items |
Array |
- Source:
Returns:
- Type
- Boolean
sendEvent(event, …arg) → {Boolean}
Emit an event on the worker side.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event |
String | ||
arg |
Object |
<repeatable> |
- Source:
Returns:
- Type
- Boolean
(private) start(timeoutopt)
Start the destroy timer.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
timeout |
Number |
<optional> |
60000 | timeout in ms. |
- Source:
(private) stop()
Stop the destroy timer.
- Source:
toJSON() → {Object}
Convert master key to a jsonifiable object.
- Source:
Returns:
- Type
- Object
toKey(passphrase, timeoutopt) → {HDPrivateKey}
Decrypt the key and set a timeout to destroy decrypted data.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
passphrase |
Buffer | String | Zero this yourself. |
||
timeout |
Number |
<optional> |
60000 | timeout in ms. |
- Source:
Returns:
- Type
- HDPrivateKey
toRaw() → {Buffer}
Serialize the key in the form of:
[enc-flag][phrase-marker][phrase?][passphrase?][xprivkey]
- Source:
Returns:
- Type
- Buffer
write(data) → {Boolean}
Send data to worker.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer |
- Source:
Returns:
- Type
- Boolean