WalletServer

WalletServer

Facilitates interaction with the wallet server.

Constructor

new WalletServer(sdk, serverUrl, opts)

Create a new wallet server instance.

Source:
Parameters:
Name Type Description
sdk ShelfNetwork

Parent SDK instance.

serverUrl string

wallet server URL.

opts Object
Name Type Attributes Default Description
allowHttp boolean <optional>

Allow connecting to http servers, default: false. This must be set to false in production deployments!

proxy Object <optional>

Proxy configuration. Look axios docs for more info

httpBasicAuth Object <optional>

HTTP basic auth credentials. Look axios docs for more info.

customHeaders Object <optional>

Custom headers for request.

withCredentials boolean <optional>

Indicates whether or not cross-site Access-Control requests should be made using credentials.

responseType string <optional>
'json'

Indicates the type of data that the server will respond with options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'.

Methods

(async) changePassword(newPassword, walletopt) → {Promise.<Wallet>}

Change user's password.

Source:
Parameters:
Name Type Attributes Default Description
newPassword string

User's password.

wallet string <optional>
null

A wallet to be updated.

Returns:
Type:
Promise.<Wallet>

Updated wallet.

(async) checkPassword(walletId, password, accountId)

Verify if password is matching the wallet's one.

Source:
Parameters:
Name Type Description
walletId string

User's wallet ID.

password string

A password to be verified.

accountId string

Account ID.

(async) create(wallet, password) → {Promise.<Wallet>}

Create an encrypted wallet.

Source:
Parameters:
Name Type Description
wallet Wallet

User's wallet.

password string

User's password.

Returns:
Type:
Promise.<Wallet>

User's wallet.

(async) get(email, password, accountIdopt, platformIdopt) → {Promise.<Wallet>}

Get user's wallet.

Source:
Parameters:
Name Type Attributes Description
email string

User's email.

password string

User's password.

accountId string <optional>

User's account ID. Can be used instead of email.

platformId string <optional>

User's platform ID. Must be used with email.

Returns:
Type:
Promise.<Wallet>

User's email.

(async) recover(accountId, newSignerKeypair, newPassword) → {Promise.<Wallet>}

Recover user's wallet.

Source:
Parameters:
Name Type Description
accountId string

User's account ID.

newSignerKeypair Keypair

New singer's keypair.

newPassword string

New password.

Returns:
Type:
Promise.<Wallet>

Updated wallet.