Class

Keystore

(async) dcp/wallet.Keystore(passphrase) → {module:dcp/wallet.Keystore}

Constructor

# async new Keystore(passphrase) → {module:dcp/wallet.Keystore}

Form 7

A Keystore object with a randomly generated privateKey and an address that corresponds to it. This form will used the supplied passphrase to encrypt the private key.

Parameters:
Name Type Description
passphrase string | null

Methods

# async getPrivateKey() → {module:dcp/wallet.PrivateKey}

Returns private key, may prompt for password. If you need this you're probably doing something wrong.

# isLocked() → {boolean}

Is the keystore presently locked?

boolean

# isUnlocked() → {boolean}

Is the keystore presently unlocked?

boolean

# lock()

Lock the Keystore, the private key is no longer accessible without password entry.

# toJSON()

Generate JSON object literal representation of this keystore. This can later be passed to the constructor to generate a new Keystore object.

# 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.

  1. 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)
  2. 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, passphrasePrompt function is invoked to solicit it from the user if the keystore is not already unlocked.

lockTimerDuration number

Number of seconds to keep keystore unlocked for. Intended to implement features like sudo

autoReset boolean <optional>

Flag to determine if unlock timer should reset on subsequent calls.

Error with code "KS_NOT_UNLOCKED" when keystore could not be unlocked.

(async) dcp/wallet.Keystore(privateKey, passphrase) → {module:dcp/wallet.Keystore}

Constructor

# async new Keystore(privateKey, passphrase) → {module:dcp/wallet.Keystore}

Form 4

A Keystore object parsed from the third party object. If the third party object cannot be parsed the promise will reject.

Parameters:
Name Type Description
privateKey object

an Ethereum v3 Keystore object

passphrase string

Methods

# async getPrivateKey() → {module:dcp/wallet.PrivateKey}

Returns private key, may prompt for password. If you need this you're probably doing something wrong.

# isLocked() → {boolean}

Is the keystore presently locked?

boolean

# isUnlocked() → {boolean}

Is the keystore presently unlocked?

boolean

# lock()

Lock the Keystore, the private key is no longer accessible without password entry.

# toJSON()

Generate JSON object literal representation of this keystore. This can later be passed to the constructor to generate a new Keystore object.

# 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.

  1. 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)
  2. 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, passphrasePrompt function is invoked to solicit it from the user if the keystore is not already unlocked.

lockTimerDuration number

Number of seconds to keep keystore unlocked for. Intended to implement features like sudo

autoReset boolean <optional>

Flag to determine if unlock timer should reset on subsequent calls.

Error with code "KS_NOT_UNLOCKED" when keystore could not be unlocked.

(async) dcp/wallet.Keystore(privateKey, passphrase) → {module:dcp/wallet.Keystore}

Constructor

# async new Keystore(privateKey, passphrase) → {module:dcp/wallet.Keystore}

Form 3

A Keystore object with the provided privateKey and an address that corresponds to it, encrypted with the provided passphrase.

Parameters:
Name Type Description
privateKey string | object

an Ethereum v3 Keystore object, or privateKey in hex string format

passphrase string

Methods

# async getPrivateKey() → {module:dcp/wallet.PrivateKey}

Returns private key, may prompt for password. If you need this you're probably doing something wrong.

# isLocked() → {boolean}

Is the keystore presently locked?

boolean

# isUnlocked() → {boolean}

Is the keystore presently unlocked?

boolean

# lock()

Lock the Keystore, the private key is no longer accessible without password entry.

# toJSON()

Generate JSON object literal representation of this keystore. This can later be passed to the constructor to generate a new Keystore object.

# 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.

  1. 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)
  2. 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, passphrasePrompt function is invoked to solicit it from the user if the keystore is not already unlocked.

lockTimerDuration number

Number of seconds to keep keystore unlocked for. Intended to implement features like sudo

autoReset boolean <optional>

Flag to determine if unlock timer should reset on subsequent calls.

Error with code "KS_NOT_UNLOCKED" when keystore could not be unlocked.

(async) dcp/wallet.Keystore(privateKey) → {module:dcp/wallet.Keystore}

Constructor

# async new Keystore(privateKey) → {module:dcp/wallet.Keystore}

Form 2

A Keystore object with the provided privateKey and an address that corresponds to it. This form will prompt the user for a password to encrypt itself with.

Parameters:
Name Type Description
privateKey string | object

an Ethereum v3 Keystore object, or privateKey in hex string format

Methods

# async getPrivateKey() → {module:dcp/wallet.PrivateKey}

Returns private key, may prompt for password. If you need this you're probably doing something wrong.

# isLocked() → {boolean}

Is the keystore presently locked?

boolean

# isUnlocked() → {boolean}

Is the keystore presently unlocked?

boolean

# lock()

Lock the Keystore, the private key is no longer accessible without password entry.

# toJSON()

Generate JSON object literal representation of this keystore. This can later be passed to the constructor to generate a new Keystore object.

# 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.

  1. 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)
  2. 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, passphrasePrompt function is invoked to solicit it from the user if the keystore is not already unlocked.

lockTimerDuration number

Number of seconds to keep keystore unlocked for. Intended to implement features like sudo

autoReset boolean <optional>

Flag to determine if unlock timer should reset on subsequent calls.

Error with code "KS_NOT_UNLOCKED" when keystore could not be unlocked.

(async) dcp/wallet.Keystore() → {module:dcp/wallet.Keystore}

Constructor

# async new Keystore() → {module:dcp/wallet.Keystore}

Form 1

A Keystore object with a randomly generated privateKey and an address that corresponds to it. This form will prompt the user for a password to encrypt itself with.

Methods

# async getPrivateKey() → {module:dcp/wallet.PrivateKey}

Returns private key, may prompt for password. If you need this you're probably doing something wrong.

# isLocked() → {boolean}

Is the keystore presently locked?

boolean

# isUnlocked() → {boolean}

Is the keystore presently unlocked?

boolean

# lock()

Lock the Keystore, the private key is no longer accessible without password entry.

# toJSON()

Generate JSON object literal representation of this keystore. This can later be passed to the constructor to generate a new Keystore object.

# 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.

  1. 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)
  2. 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, passphrasePrompt function is invoked to solicit it from the user if the keystore is not already unlocked.

lockTimerDuration number

Number of seconds to keep keystore unlocked for. Intended to implement features like sudo

autoReset boolean <optional>

Flag to determine if unlock timer should reset on subsequent calls.

Error with code "KS_NOT_UNLOCKED" when keystore could not be unlocked.

(async) dcp/wallet.Keystore(privateKey) → {module:dcp/wallet.Keystore}

Constructor

# async new Keystore(privateKey) → {module:dcp/wallet.Keystore}

Form 6

A Keystore object parsed from the third party object. If the third party object cannot be parsed the promise will reject. The user will be prompted for a passphrase.

Parameters:
Name Type Description
privateKey object

Ethereum v3 Keystore object

Methods

# async getPrivateKey() → {module:dcp/wallet.PrivateKey}

Returns private key, may prompt for password. If you need this you're probably doing something wrong.

# isLocked() → {boolean}

Is the keystore presently locked?

boolean

# isUnlocked() → {boolean}

Is the keystore presently unlocked?

boolean

# lock()

Lock the Keystore, the private key is no longer accessible without password entry.

# toJSON()

Generate JSON object literal representation of this keystore. This can later be passed to the constructor to generate a new Keystore object.

# 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.

  1. 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)
  2. 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, passphrasePrompt function is invoked to solicit it from the user if the keystore is not already unlocked.

lockTimerDuration number

Number of seconds to keep keystore unlocked for. Intended to implement features like sudo

autoReset boolean <optional>

Flag to determine if unlock timer should reset on subsequent calls.

Error with code "KS_NOT_UNLOCKED" when keystore could not be unlocked.

(async) dcp/wallet.Keystore(JsonString, passphrase) → {module:dcp/wallet.Keystore}

Constructor

# async new Keystore(JsonString, passphrase) → {module:dcp/wallet.Keystore}

Form 5

A Keystore object parsed from the JSON string. If the JSON or resulting object cannot be parsed the promise will reject.

Parameters:
Name Type Description
JsonString string

a JSON encoded keystore of some sort

passphrase string

Methods

# async getPrivateKey() → {module:dcp/wallet.PrivateKey}

Returns private key, may prompt for password. If you need this you're probably doing something wrong.

# isLocked() → {boolean}

Is the keystore presently locked?

boolean

# isUnlocked() → {boolean}

Is the keystore presently unlocked?

boolean

# lock()

Lock the Keystore, the private key is no longer accessible without password entry.

# toJSON()

Generate JSON object literal representation of this keystore. This can later be passed to the constructor to generate a new Keystore object.

# 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.

  1. 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)
  2. 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, passphrasePrompt function is invoked to solicit it from the user if the keystore is not already unlocked.

lockTimerDuration number

Number of seconds to keep keystore unlocked for. Intended to implement features like sudo

autoReset boolean <optional>

Flag to determine if unlock timer should reset on subsequent calls.

Error with code "KS_NOT_UNLOCKED" when keystore could not be unlocked.