Constructor
new KeystoreStorageAdapter(username, password, keystore_urlopt)
Create a new KeystoreStorageAdapter
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 |
Extends
Methods
(async) _save(account_data, identifier) → {Promise.<Object>}
Internal Save function to Save an Account to the Keystore Server
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 |
Returns:
Returns a Promise that will resolve to the saved Account Data of the updated account if successful
- Type:
- Promise.<Object>
(async) check() → {Promise.<Identifier>}
Check if the Account exists on the Keystore server. This matches an email to an identifier if the username being used is an email.
- Overrides:
- Source:
Throws:
-
If there is no Identifier that matches the Username passed
- Type
- AccountNotFoundError
Returns:
Returns a Promise that will resolve to the Accounts Identifier if set
- Type:
- Promise.<Identifier>
(async) create(account_data, emailopt) → {Promise.<Object>}
Create a new Account on the Keystore Server
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
account_data |
Object |
The Account Data you wish to save to your new accouny |
|
email |
string |
<optional> |
An Email if you would like to attach an email to your account |
- Overrides:
- Source:
Returns:
Returns a Promise that will resolve to the Account Data of the new account if successful
- Type:
- Promise.<Object>
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() → {Promise.<Object>}
Load an Account from the Keystore Server
- Overrides:
- Source:
Throws:
-
-
If the password being used for login is invalid
- Type
- InvalidPassword
-
-
-
If the Account cannot beb found on the storage server
- Type
- AccountNotFoundError
-
Returns:
Returns a Promise that will resolve to the Decrypted Account Data if successful
- 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>