MemoryStorageAdapter

MemoryStorageAdapter

The MemoryStorageAdapter is used when the user only wants their wallet stored in memory for the single session.




Constructor

new MemoryStorageAdapter(username, password, keystore_urlopt)

Create a new MemoryStorageAdapter

Parameters:
Name Type Attributes Default Description
username string

The username of the account you wish to use

password string

The password of the account you wish to use

keystore_url string <optional>
"https://keystore.oip.li/v2/"

The URL of the OIP Keystore server to use

Source:

Extends

Methods




(async) _save(account_data, identifier) → {Promise.<Object>}

Internal Save function to Save an Account to the Memory

Parameters:
Name Type Description
account_data Object

The new Account Data you wish to save

identifier Identifier

The Identifier of the account you wish to save

Source:
Returns:

Returns a Promise that will resolve to the Account Data of the updated account

Type:
Promise.<Object>



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

Check if the Account exists in Memory. It will never exists, so it always will return an error This matches an email to an identifier if the username being used is an email.

Overrides:
Source:
Throws:

If no Account is found

Type
AccountNotFoundError
Returns:

Returns a Promsie that will resolve to the Accounts Identifier if set

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

Overrides:
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

Inherited From:
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

Inherited From:
Source:
Returns:

Returns the Encrypted Data as a String

Type:
string



generateIdentifier() → {Identifier}

Generate a valid Identifier

Inherited From:
Source:
Returns:

Returns a newly generated identifier

Type:
Identifier



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

Load an Account from the Memory

Parameters:
Name Type Description
account_data Object

The Account Data if you are "logging" in and not just "refreshing"

Overrides:
Source:
Returns:

Returns a Promise that will resolve to the Account Data

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

Inherited From:
Source:
Returns:

Returns the Identifier of the saved account

Type:
Promise.<Identifier>