Class: PibImpl

PibImpl()

new PibImpl()

PibImpl is an abstract base class for the PIB implementation used by the Pib class. This class defines the interface that an actual PIB implementation should provide, for example PibMemory.
Source:

Classes

Error

Methods

addCertificatePromise(certificate, useSync) → {Promise|SyncPromise}

Add the certificate. If a certificate with the same name (without implicit digest) already exists, then overwrite the certificate. If the key or identity does not exist, they will be created. If no default certificate for the key has been set, then set the added certificate as the default for the key. If no default key was set for the identity, it will be set as the default key for the identity. If no default identity was selected, the certificate's identity becomes the default.
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.
Source:
Returns:
A promise which fulfills when the certificate is added.
Type
Promise | SyncPromise

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

Add the identity. If the identity already exists, do nothing. If no default identity has been set, set the added identity as the default.
Parameters:
Name Type Description
identityName Name The name of the identity to add. This copies the name.
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 the identity is added.
Type
Promise | SyncPromise

addKeyPromise(identityName, keyName, key, useSync) → {Promise|SyncPromise}

Add the key. If a key with the same name already exists, overwrite the key. If the identity does not exist, it will be created. If no default key for the identity has been set, then set the added key as the default for the identity. If no default identity has been set, identity becomes the default.
Parameters:
Name Type Description
identityName Name The name of the identity that the key belongs to. This copies the name.
keyName Name The name of the key. This copies the name.
key Buffer The public key bits. This copies the array.
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 the key is added.
Type
Promise | SyncPromise

clearIdentitiesPromise(useSync) → {Promise|SyncPromise}

Erase all certificates, keys, and identities.
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 the identities are cleared.
Type
Promise | SyncPromise

getCertificatePromise(certificateName, useSync) → {Promise|SyncPromise}

Get the certificate with name certificateName.
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.
Source:
Returns:
A promise which returns the CertificateV2, or a promise rejected with Pib.Error if the certificate does not exist.
Type
Promise | SyncPromise

getCertificatesOfKeyPromise(keyName, useSync) → {Promise|SyncPromise}

Get a list of certificate names of the key with id keyName. The returned certificate names can be used to create a PibCertificateContainer. With a certificate name and a backend implementation, one can obtain the certificate.
Parameters:
Name Type Description
keyName Name The name of the key.
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 set of certificate names as an array of Name. The Name objects are fresh copies. If the key does not exist, return an empty array.
Type
Promise | SyncPromise

getDefaultCertificateOfKeyPromise(keyName, useSync) → {Promise|SyncPromise}

Get the default certificate for the key with eyName.
Parameters:
Name Type Description
keyName Name The name of the key.
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 a copy of the default CertificateV2, or a promise rejected with Pib.Error if the default certificate does not exist.
Type
Promise | SyncPromise

getDefaultIdentityPromise(useSync) → {Promise|SyncPromise}

Get the default identity.
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 returns the Name of the default identity as a fresh copy, or a promise rejected with Pib.Error for no default identity.
Type
Promise | SyncPromise

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

Get the name of the default key for the identity with name identityName.
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 name of the default key as a fresh copy, or a promise rejected with Pib.Error if the identity does not exist.
Type
Promise | SyncPromise

getIdentitiesPromise(useSync) → {Promise|SyncPromise}

Get the names of all the identities.
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 returns a fresh set of identity names as an array of Name. The Name objects are fresh copies.
Type
Promise | SyncPromise

getKeyBitsPromise(keyName, useSync) → {Promise|SyncPromise}

Get the key bits of a key with name keyName.
Parameters:
Name Type Description
keyName Name The name of the key.
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 key bits as a Blob, or a promise rejected with Pib.Error if the key does not exist.
Type
Promise | SyncPromise

getKeysOfIdentityPromise(identityName, useSync)

Get all the key names of the identity with the name identityName. The returned key names can be used to create a KeyContainer. With a key name and a backend implementation, one can create a Key front end instance.
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:
SyncPromise} A promise which returns the set of key names as an array of Name. The Name objects are fresh copies. If the identity does not exist, return an empty array.

getTpmLocatorPromise(useSync) → {Promise|SyncPromise}

Get the TPM Locator.
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 returns the TPM locator string.
Type
Promise | SyncPromise

hasCertificatePromise(certificateName, useSync) → {Promise|SyncPromise}

Check for the existence of a certificate with name certificateName.
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.
Source:
Returns:
A promise which returns true if the certificate exists, otherwise false.
Type
Promise | SyncPromise

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

Check for the existence of an identity.
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 true if the identity exists, otherwise false.
Type
Promise | SyncPromise

hasKeyPromise(keyName, useSync) → {Promise|SyncPromise}

Check for the existence of a key with keyName.
Parameters:
Name Type Description
keyName Name The name of the key.
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 true if the key exists, otherwise false. Return false if the identity does not exist.
Type
Promise | SyncPromise

removeCertificatePromise(certificateName, useSync) → {Promise|SyncPromise}

Remove the certificate with name certificateName. 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.
Source:
Returns:
A promise which fulfills when the certificate is removed.
Type
Promise | SyncPromise

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

Remove the identity 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 to remove.
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 the identity is removed.
Type
Promise | SyncPromise

removeKeyPromise(keyName, useSync) → {Promise|SyncPromise}

Remove the key with keyName and its related certificates. If the key does not exist, do nothing.
Parameters:
Name Type Description
keyName Name The name of the key.
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 the key is removed.
Type
Promise | SyncPromise

setDefaultCertificateOfKeyPromise(keyName, certificateName, useSync) → {Promise|SyncPromise}

Set the cert with name certificateName as the default for the key with keyName.
Parameters:
Name Type Description
keyName Name The name of the key.
certificateName Name The name of the certificate. This copies the name.
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 the default certificate is set, or a promise rejected with Pib.Error if the certificate with name certificateName does not exist.
Type
Promise | SyncPromise

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

Set the identity with the identityName as the default identity. If the identity with identityName does not exist, then it will be created.
Parameters:
Name Type Description
identityName Name The name for the default identity. This copies the name.
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 the default identity is set.
Type
Promise | SyncPromise

setDefaultKeyOfIdentityPromise(identityName, keyName, useSync) → {Promise|SyncPromise}

Set the key with keyName as the default key for the identity with name identityName.
Parameters:
Name Type Description
identityName Name The name of the identity. This copies the name.
keyName Name The name of the key. This copies the name.
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 the default key is set, or a promise rejected with Pib.Error if the key does not exist.
Type
Promise | SyncPromise

setTpmLocatorPromise(tpmLocator, useSync) → {Promise|SyncPromise}

Set the corresponding TPM information to tpmLocator. This method does not reset the contents of the PIB.
Parameters:
Name Type Description
tpmLocator string The TPM locator string.
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 the TPM locator is set.
Type
Promise | SyncPromise