Wallet API - perform operations related to Addresses, Keystores, Key Pairs
Classes
- Address
- AuthKeystore
- IdKeystore
- Keystore
- Keystore
- Keystore
- Keystore
- Keystore
- Keystore
- Keystore
- PrivateKey
Methods
# static add(keystore, nameopt, contextIdopt)
Add a temporary Keystore (in RAM) to the current wallet, which can be retrieved later by get.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
keystore |
Promise | A promise which resolves to the keystore to add |
||
name |
string |
<optional> |
'default' | The name of the keystore |
contextId |
string |
<optional> |
An optional identifier for caching keystores. See |
# static addId(keystore, nameopt, contextIdopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
keystore |
module:dcp/wallet.Keystore | The keystore to add |
||
name |
string |
<optional> |
'default' | The name of the keystore |
contextId |
string |
<optional> |
An optional identifier for caching keystores. See |
# async static get(array, name) → {module:dcp/wallet.AuthKeystore}
Form 6
This form is equivalent to wallet.get(array, {name: string})
.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array.<string> | Array-like object, formatted like |
name |
string | Override the default keystore name. |
Return an authorization keystore.
# async static get(options) → {module:dcp/wallet.AuthKeystore}
Form 1
This form loads a Keystore File via load. The options object is used to override default parameters which help to identify and locate the Keystore File.
On NodeJS: The options object is passed directly to wallet.load
.
On Web: The options object is primarily used to provide context to the user for showing a modal;
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
object | |||
name |
string |
<optional> |
'default' | Override the default keystore name. |
contextId |
string |
<optional> |
An optional, user-defined identifier used for caching keystores.
See |
|
jobName |
string |
<optional> |
Optional name of the job that the keystore is being requested for. |
|
checkEmpty |
boolean |
<optional> |
true | Try an empty password before prompting user |
KeystoreConstructor |
function |
<optional> |
Override the constructor to use for the keystore. |
Return an authorization keystore.
# async static get(array) → {module:dcp/wallet.AuthKeystore}
Form 4
This form accepts an Array-like object, formatted like process.argv
, to specify options for invoking Form 1.
Its purpose is to unify Keystore, PrivateKey, and Address-related options for programs written in NodeJS.
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
array |
Array.<string> | Array-like object, formatted like
|
Return an authorization keystore.
# async static get(array, options) → {module:dcp/wallet.AuthKeystore}
Form 5
This form accepts an Array-like object, as described in form 4, and an options object as described in form 1. Its behaviour is to generate an options object from the array, merge the passed options object into this options object, and invoke form 1. To be clear, the options argument has a higher precedence than the array argument.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array.<string> | Array-like object, formatted like |
options |
object | Options object, see Form 1. |
Return an authorization keystore.
# async static get(name) → {module:dcp/wallet.AuthKeystore}
Form 3
This form is equivalent to wallet.get({name: string})
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Override the default keystore name. |
Return an authorization keystore.
# async static get() → {module:dcp/wallet.AuthKeystore}
Form 2
This form is equivalent to wallet.get({})
.
Return an authorization keystore.
# async static load(options) → {module:dcp/wallet~LoadResult}
Form 2
This function locates and reads a keystore or private key file, and instantiates a keystore from it.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
object | An options object |
||
name |
string |
<optional> |
'default' | The keystore label, or filename |
paths |
Array.<string> |
<optional> |
Override default keystore directory search path, normally the application data directory, followed by the |
|
dir |
string |
<optional> |
Overrides paths, equivalent to |
|
KeystoreConstructor |
KeystoreConstructor |
<optional> |
Constructor to use when creating the keystore |
# async static load(filename) → {module:dcp/wallet~LoadResult}
Form 1
This function locates and reads a keystore or private key file, and instantiates a keystore from it.
NodeJS only: filename
must be an absolute path, or begin withgin with path.sep, '.' + path.sep
, or '..' + path.sep
.
The safe flag is set to true to indicate that the Keystore file was stored safely; this happens if and only if the following conditions are true:
- The containing directory and all its ancestors, up to and including the root directory, is not world-writable.
- The Keystore File is neither world-writable nor world-readable.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string | The keystore filename |
Type Definitions
# LoadResult
Object returned by wallet.load
Properties:
Name | Type | Description |
---|---|---|
keystore |
Keystore | the instance of the keystore that was loaded |
safe |
boolean | indicates that the keystore was read from a secure location. |