StorageAdapter

StorageAdapter

A Generic StorageAdapter class that provides shared functions between all StorageAdapters




Constructor

new StorageAdapter(username, password)

Create a new Storage Adapter

Parameters:
Name Type Description
username string

The username of the account you wish to use

password string

The password of the account you wish to use

Source:

Methods




(async) check() → {Promise.<Identifier>}

Check if the Wallet exists on the StorageAdapter, this function is overwritten by sub-classes

Source:
Returns:

Returns the Identifier of the matched wallet (if found)

Type:
Promise.<Identifier>



(async) create(account_data, emailopt) → {Promise.<Identifier>}

Create an account using the StorageAdapter

Parameters:
Name Type Attributes Description
account_data Object

The Account Data you wish to save

email string <optional>

The Email you wish to attach to your account

Source:
Returns:

The Identifier of the Created Account

Type:
Promise.<Identifier>



decrypt(encrypted_data) → {Object}

Decrypt the Account data

Parameters:
Name Type Description
encrypted_data string

The Encrypted Data string to Decrypt

Source:
Throws:

If there is an error decrypting the encrypted data using the Password

Type
InvalidPassword
Returns:

Returns the decrypted data as a JSON Object

Type:
Object



encrypt(decrypted_data) → {string}

Encrypt the Account data

Parameters:
Name Type Description
decrypted_data Object

A JSON object of the data you would like to encrypt

Source:
Returns:

Returns the Encrypted Data as a String

Type:
string



generateIdentifier() → {Identifier}

Generate a valid Identifier

Source:
Returns:

Returns a newly generated identifier

Type:
Identifier



(async) load() → {Promise.<Object>}

Load the Wallet from the StorageAdapter, this function is overwritten by sub-classes

Source:
Returns:

Returns the Account Data for the specified account

Type:
Promise.<Object>



(async) save(account_data, identifieropt) → {Promise.<Identifier>}

Save an Account using the StorageAdapter

Parameters:
Name Type Attributes Description
account_data Object

The Account Data you wish to save

identifier Identifier <optional>

The Identifier of the Account you wish to save to

Source:
Returns:

Returns the Identifier of the saved account

Type:
Promise.<Identifier>