Class: IndexedDbGroupManagerDb

IndexedDbGroupManagerDb(databaseName)

new IndexedDbGroupManagerDb(databaseName)

IndexedDbGroupManagerDb extends GroupManagerDb to implement the storage of data used by the GroupManager using the browser's IndexedDB service. Create an IndexedDbGroupManagerDb to use the given IndexedDB database name.
Parameters:
Name Type Description
databaseName string IndexedDB database name.
Source:

Methods

addEKeyPromise(eKeyName, publicKey, privateKey, useSync) → {Promise|SyncPromise}

Add the EKey with name eKeyName to the database. Add the EKey with name eKeyName to the database.
Parameters:
Name Type Description
eKeyName Name The name of the EKey. This copies the Name.
publicKey Blob The encoded public Key of the group key pair.
privateKey Blob The encoded private Key of the group key pair.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the EKey is added, or that is rejected with GroupManagerDb.Error if a key with name eKeyName already exists in the database, or other database error.
Type
Promise | SyncPromise

addMemberPromise(scheduleName, keyName, key, useSync) → {Promise}

Add a new member with the given key named keyName into a schedule named scheduleName. The member's identity name is keyName.getPrefix(-1).
Parameters:
Name Type Description
scheduleName string The schedule name.
keyName Name The name of the key.
key Blob A Blob of the public key DER.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the member is added, or that is rejected with GroupManagerDb.Error if there's no schedule named scheduleName, if the member's identity name already exists, or other database error.
Type
Promise

addSchedulePromise(name, schedule, useSync) → {Promise}

Add a schedule with the given name.
Parameters:
Name Type Description
name string The name of the schedule. The name cannot be empty.
schedule Schedule The Schedule to add.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the schedule is added, or that is rejected with GroupManagerDb.Error if a schedule with the same name already exists, if the name is empty, or other database error.
Type
Promise

cleanEKeysPromise(useSync) → {Promise|SyncPromise}

Delete all the EKeys in the database. The database will keep growing because EKeys will keep being added, so this method should be called periodically.
Parameters:
Name Type Description
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the EKeys are deleted, or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise | SyncPromise

deleteEKeyPromise(eKeyName, useSync) → {Promise|SyncPromise}

Delete the EKey with name eKeyName from the database. If no key with the name exists in the database, do nothing.
Parameters:
Name Type Description
eKeyName Name The name of the EKey.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the EKey is deleted (or there is no such key), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise | SyncPromise

deleteMemberPromise(identity, useSync) → {Promise}

Delete a member with the given identity name. If there is no member with the identity name, then do nothing.
Parameters:
Name Type Description
identity Name The member's identity 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 member is deleted (or there is no such member), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

deleteSchedulePromise(name, useSync) → {Promise}

Delete the schedule with the given name. Also delete members which use this schedule. If there is no schedule with the name, then do nothing.
Parameters:
Name Type Description
name string The name of the schedule.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the schedule is deleted (or there is no such schedule), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

getEKeyPromise(eKeyName, useSync) → {Promise|SyncPromise}

Get the group key pair with the name eKeyName from the database.
Parameters:
Name Type Description
eKeyName Name The name of the EKey.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns an object (where "publicKey" is the public key Blob and "privateKey" is the private key Blob), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise | SyncPromise

getMemberSchedulePromise(identity, useSync) → {Promise}

Get the name of the schedule for the given member's identity name.
Parameters:
Name Type Description
identity Name The member's identity name.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns the string schedule name, or that is rejected with GroupManagerDb.Error if there's no member with the given identity name in the database, or other database error.
Type
Promise

getScheduleIdPromise_(name) → {Promise}

Get the ID for the schedule.
Parameters:
Name Type Description
name string The schedule name.
Source:
Returns:
A promise that returns the ID (or -1 if not found), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

getScheduleMembersPromise(name, useSync) → {Promise}

For each member using the given schedule, get the name and public key DER of the member's key.
Parameters:
Name Type Description
name string The name of the schedule.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns a new array of object (where "keyName" is the Name of the public key and "publicKey" is the Blob of the public key DER), or that is rejected with GroupManagerDb.Error for a database error. Note that the member's identity name is keyName.getPrefix(-1). If the schedule name is not found, the list is empty.
Type
Promise

getSchedulePromise(name, useSync) → {Promise}

Get a schedule with the given name.
Parameters:
Name Type Description
name string The name of the schedule.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns a new Schedule object, or that is rejected with GroupManagerDb.Error if the schedule does not exist or other database error.
Type
Promise

hasEKeyPromise(eKeyName, useSync) → {Promise|SyncPromise}

Check if there is an EKey with the name eKeyName in the database.
Parameters:
Name Type Description
eKeyName Name The name of the EKey.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns true if the EKey exists (else false), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise | SyncPromise

hasMemberPromise(identity, useSync) → {Promise}

Check if there is a member with the given identity name.
Parameters:
Name Type Description
identity Name The member's identity name.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns true if there is a member (else false), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

hasSchedulePromise(name, useSync) → {Promise}

Check if there is a schedule with the given name.
Parameters:
Name Type Description
name string The name of the schedule.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns true if there is a schedule (else false), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

listAllMembersPromise(useSync) → {Promise}

List all the members.
Parameters:
Name Type Description
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns a new array of Name with the names of all members, or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

listAllScheduleNamesPromise(useSync) → {Promise}

List all the names of the schedules.
Parameters:
Name Type Description
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns a new array of string with the names of all schedules, or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

renameSchedulePromise(oldName, newName, useSync) → {Promise}

Rename a schedule with oldName to newName.
Parameters:
Name Type Description
oldName string The name of the schedule to be renamed.
newName string The new name of the schedule. The name cannot be empty.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the schedule is renamed, or that is rejected with GroupManagerDb.Error if a schedule with newName already exists, if the schedule with oldName does not exist, if newName is empty, or other database error.
Type
Promise

updateMemberSchedulePromise(identity, scheduleName, useSync) → {Promise}

Change the name of the schedule for the given member's identity name.
Parameters:
Name Type Description
identity Name The member's identity name.
scheduleName string The new schedule 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 member is updated, or that is rejected with GroupManagerDb.Error if there's no member with the given identity name in the database, or there's no schedule named scheduleName, or other database error.
Type
Promise

updateSchedulePromise(name, schedule, useSync) → {Promise}

Update the schedule with name and replace the old object with the given schedule. Otherwise, if no schedule with name exists, a new schedule with name and the given schedule will be added to database.
Parameters:
Name Type Description
name string The name of the schedule. The name cannot be empty.
schedule Schedule The Schedule to update or add.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the schedule is updated, or that is rejected with GroupManagerDb.Error if the name is empty, or other database error.
Type
Promise