new MasterKey(options)
Master BIP32 key which can exist in a timed out encrypted state.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Members
(static) alg :Number
Key derivation algorithms.
Type:
- Number
Properties:
Name | Type | Description |
---|---|---|
PBKDF2 |
Number | |
SCRYPT |
Number |
- Default Value:
{"PBKDF2":0,"SCRYPT":1}
- Source:
(static) algByVal :String
Key derivation algorithms by value.
Type:
- String
Properties:
Name | Type | Description |
---|---|---|
0 |
String | |
1 |
String |
- Default Value:
{"undefined":"SCRYPT"}
- Source:
(static, constant) SALT :Buffer
Key derivation salt.
Type:
- Buffer
- Source:
(private) _decrypt
Decrypt the key permanently without a lock.
- Source:
(private) _encrypt
Encrypt the key permanently without a lock.
- Source:
(private) _unlock
Decrypt the key without a lock.
- Source:
decrypt
Decrypt the key permanently.
- Source:
derive
Derive an aes key based on params.
- Source:
destroy
Destroy the key permanently.
- Source:
encrypt
Encrypt the key permanently.
- Source:
lock
Destroy the key by zeroing the privateKey and chainCode. Stop the timer if there is one.
- Source:
unlock
Decrypt the key and set a timeout to destroy decrypted data.
- Source:
Methods
(static) fromKey(key) → {MasterKey}
Instantiate master key from an HDPrivateKey.
Parameters:
Name | Type | Description |
---|---|---|
key |
HDPrivateKey |
- Source:
Returns:
- Type
- MasterKey
(static) fromOptions() → {MasterKey}
Instantiate master key from options.
- 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
_lock()
Destroy the key by zeroing the privateKey and chainCode. Stop the timer if there is one.
- Source:
decipher(data, iv) → {Buffer}
Decrypt data with in-memory aes key.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer | |
iv |
Buffer |
- Source:
Returns:
- Type
- Buffer
encipher(data, iv) → {Buffer}
Encrypt data with in-memory aes key.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer | |
iv |
Buffer |
- Source:
Returns:
- Type
- Buffer
(private) fromKey(key)
Inject properties from an HDPrivateKey.
Parameters:
Name | Type | Description |
---|---|---|
key |
HDPrivateKey |
- Source:
(private) fromOptions(options)
Inject properties from options object.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
(private) fromRaw(raw)
Inject properties from serialized data.
Parameters:
Name | Type | Description |
---|---|---|
raw |
Buffer |
- Source:
getSize() → {Number}
Calculate serialization size.
- Source:
Returns:
- Type
- Number
inspect() → {Object}
Inspect the key.
- Source:
Returns:
- Type
- Object
(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(unsafenullable) → {Object}
Convert master key to a jsonifiable object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
unsafe |
Boolean |
<nullable> |
Whether to include the key data in the JSON. |
- Source:
Returns:
- Type
- Object
toRaw() → {Buffer}
Serialize the key in the form of:
[enc-flag][iv?][ciphertext?][extended-key?]
- Source:
Returns:
- Type
- Buffer