# async new IdKeystore()
See Keystore constructor for documentation on all the ways to call this constructor.
Extends
Methods
# async getPrivateKey() → {module:dcp/wallet.PrivateKey}
Returns private key, may prompt for password. If you need this you're probably doing something wrong.
- Inherited From:
# lock()
Lock the Keystore, the private key is no longer accessible without password entry.
- Inherited From:
# toJSON()
Generate JSON object literal representation of this keystore. This can later be passed to the constructor to generate a new Keystore object.
- Inherited From:
# async unlock(passphraseopt, lockTimerDuration, autoResetopt)
This method unlocks the Keystore object for either a single use or a given amount of time. When the
object is unlocked, getPrivateKey
and related operations do not need to ask for a passphrase, as
the private key is "remembered" internally. If time is not specified, the object will be immediately
locked after the next call to getPrivateKey
; otherwise, it will remain unlocked until the timer runs out.
When the unlock timer is running, calling unlock
can have multiple effects. In all cases the current
running timer will be increased to lockTimerDuration if that will increase the time left.
- If the autoReset flag is true for this invocation, the autoReset duration is updated only if it will be increased. Thus autoReset is a sticky setting, it can be turned on but not off (except by locking)
- If the autoReset flag is false for this invocation, the current unlock duration is increased, but the autoReset duration remains the same.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
passphrase |
string |
<optional> |
Passphrase to unlock keystore. If null|undefined, |
lockTimerDuration |
number | Number of seconds to keep keystore unlocked for. Intended to implement features like |
|
autoReset |
boolean |
<optional> |
Flag to determine if unlock timer should reset on subsequent calls. |
- Inherited From:
Error with code "KS_NOT_UNLOCKED" when keystore could not be unlocked.