Class: PibIdentityContainer

PibIdentityContainer(pibImpl, identityNames)

new PibIdentityContainer(pibImpl, identityNames)

A PibIdentityContainer is used to search/enumerate the identities in a PIB. (A PibIdentityContainer object can only be created by the Pib class.) You should not call this private constructor. Instead, use PibIdentityContainer.makePromise().
Parameters:
Name Type Description
pibImpl PibImpl The PIB backend implementation.
identityNames Array.<Name> The set of identity names as an array of Name, as returned by getIdentitiesPromise.
Source:

Methods

(static) makePromise(pibImpl, useSync, A)

Create a PibIdentityContainer using to use the pibImpl backend implementation. This method that returns a Promise is needed instead of a normal constructor since it uses asynchronous PibImpl methods to initialize the object. This method should only be called by Pib.
Parameters:
Name Type Description
pibImpl PibImpl The PIB backend implementation.
useSync boolean (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise.
A Promise | SyncPromise promise which returns the new PibIdentityContainer.
Source:

addPromise(identityName, useSync) → {Promise|SyncPromise}

Add an identity with name identityName into the container. Create the identity if it does not exist.
Parameters:
Name Type Description
identityName Name The name of the identity, which is copied.
useSync boolean (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise.
Source:
Returns:
A promise which returns the PibIdentity object.
Type
Promise | SyncPromise

getPromise(identityName, useSync) → {SyncPromise}

Get the identity with name identityName from the container.
Parameters:
Name Type Description
identityName Name The name of the identity.
useSync boolean (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise.
Source:
Returns:
A promise which returns the PibIdentity object, or a promise rejected with Pib.Error if the identity does not exist.
Type
SyncPromise

removePromise(identityName, useSync) → {Promise|SyncPromise}

Remove the identity with name identityName from the container, and its related keys and certificates. If the default identity is being removed, no default identity will be selected. If the identity does not exist, do nothing.
Parameters:
Name Type Description
identityName Name The name of the identity.
useSync boolean (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise.
Source:
Returns:
A promise which fulfills when finished.
Type
Promise | SyncPromise

resetPromise(useSync) → {SyncPromise}

Reset the state of the container. This method removes all loaded identities and retrieves identity names from the PIB implementation.
Parameters:
Name Type Description
useSync boolean (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise.
Source:
Returns:
A promise which fulfills when finished.
Type
SyncPromise

size() → {number}

Get the number of identities in the container.
Source:
Returns:
The number of identities.
Type
number