new PibCertificateContainer(keyName, pibImpl, certificateNames)
A PibCertificateContainer is used to search/enumerate the certificates of a
key. (A PibCertificateContainer object can only be created by PibKey.)
You should not call this private constructor. Instead, use
PibCertificateContainer.makePromise().
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key, which is copied. |
pibImpl |
PibImpl | The PIB backend implementation. |
certificateNames |
Array.<Name> | The set of certificate names as an array of Name, as returned by getCertificatesOfKeyPromise. |
Methods
(static) makePromise(keyName, pibImpl, useSync, A)
Create a PibCertificateContainer for a key with keyName.
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 PibKeyImpl.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key, which is copied. |
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 PibCertificateContainer. |
addPromise(certificate, useSync) → {Promise|SyncPromise}
Add certificate into the container. If the certificate already exists, this
replaces it.
Parameters:
Name | Type | Description |
---|---|---|
certificate |
CertificateV2 | The certificate to add. This copies the object. |
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. |
Returns:
A promise which fulfills when finished, or a
promise rejected with Error if the name of the certificate does not match the
key name.
- Type
- Promise | SyncPromise
getPromise(certificateName, useSync) → {SyncPromise}
Get the certificate with certificateName from the container.
Parameters:
Name | Type | Description |
---|---|---|
certificateName |
Name | The name of the certificate. |
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. |
Returns:
A promise which returns a copy of the CertificateV2, or
a promise rejected with Error if certificateName does not match the key name,
or a promise rejected with Pib.Error if the certificate does not exist.
- Type
- SyncPromise
removePromise(certificateName, useSync) → {Promise|SyncPromise}
Remove the certificate with name certificateName from the container. If the
certificate does not exist, do nothing.
Parameters:
Name | Type | Description |
---|---|---|
certificateName |
Name | The name of the certificate. |
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. |
Returns:
A promise which fulfills when finished, or a
promise rejected with Error if certificateName does not match the key name.
- Type
- Promise | SyncPromise
size() → {number}
Get the number of certificates in the container.
Returns:
The number of certificates.
- Type
- number