load

load(filename)
load({ options.name, options.paths, options.dir })

This function locates and reads a keystore file, and instantiates a Keystore from it.

Arguments:
  • filename (string) – The keystore filename

  • options.name (string) – The keystore label or filename.

  • options.paths (string[]) – Override the default keystore directory search path (Node.js Only). This must be a complete pathname.

  • options.dir (string) – Override paths.

Return type:

Promise<LoadResult()>

class LoadResult()

Object returned by wallet.load

Arguments:
  • keystore (Keystore) – the instance of the keystore that was loaded

  • safe (boolean) – indicates that the keystore was read from a secure location.

Warning

Bug: (NodeJS only) filename must be an absolute path, or begin with path.sep, ‘.’ + path.sep, or ‘..’ + path.sep.

Example:

/*
 * Example using load to get a keystore from a filename.
 * The return from load() is an object with a property 'keystore',
 * which can be used in deployment when the job is set to use it
 */

const wallet = require('dcp/wallet');

const job = compute.for(inputSet, workFn);

// If payment account is not set, the job will search .dcp/ by default
const ks = await wallet.load('../path/to/your.keystore');
job.setPaymentAccountKeystore(ks.keystore);