new IndexedDbConsumerDb(databaseName)
IndexedDbConsumerDb extends ConsumerDb to implement the storage of decryption
keys for the consumer using the browser's IndexedDB service.
Create an IndexedDbConsumerDb to use the given IndexedDB database name.
Parameters:
Name | Type | Description |
---|---|---|
databaseName |
string | IndexedDB database name. |
- Source:
Methods
addKeyPromise(keyName, keyBlob, useSync) → {Promise}
Add the key with keyName and keyBlob to the database.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The key name. |
keyBlob |
Blob | The encoded key. |
useSync |
boolean | (optional) If true then return a rejected promise since this only supports async code. |
- Source:
Returns:
A promise that fulfills when the key is added, or that
is rejected with ConsumerDb.Error if a key with the same keyName already
exists, or other database error.
- Type
- Promise
deleteKeyPromise(keyName, useSync) → {Promise}
Delete the key with keyName from the database. If there is no key with
keyName, do nothing.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The key name. |
useSync |
boolean | (optional) If true then return a rejected promise since this only supports async code. |
- Source:
Returns:
A promise that fulfills when the key is deleted (or there
is no such key), or that is rejected with ConsumerDb.Error for a database
error.
- Type
- Promise
getKeyPromise(keyName, useSync) → {Promise}
Get the key with keyName from the database.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The key name. |
useSync |
boolean | (optional) If true then return a rejected promise since this only supports async code. |
- Source:
Returns:
A promise that returns a Blob with the encoded key (or an
isNull Blob if cannot find the key with keyName), or that is
rejected with ConsumerDb.Error for a database error.
- Type
- Promise