new MemoryIdentityStorage()
MemoryIdentityStorage extends IdentityStorage and implements its methods to
store identity, public key and certificate objects in memory. The application
must get the objects through its own means and add the objects to the
MemoryIdentityStorage object. To use permanent file-based storage, see
BasicIdentityStorage.
Methods
addCertificatePromise(certificate) → {SyncPromise}
Add a certificate to the identity storage. Also call addKey to ensure that
the certificate key exists. If the certificate is already installed, don't
replace it.
Parameters:
Name | Type | Description |
---|---|---|
certificate |
IdentityCertificate | The certificate to be added. This makes a copy of the certificate. |
Returns:
A promise which fulfills when finished.
- Type
- SyncPromise
addIdentityPromise(identityName) → {SyncPromise}
Add a new identity. Do nothing if the identity already exists.
Parameters:
Name | Type | Description |
---|---|---|
identityName |
Name | The identity name to be added. |
Returns:
A promise which fulfills when the identity is added.
- Type
- SyncPromise
addKeyPromise(keyName, keyType, publicKeyDer) → {SyncPromise}
Add a public key to the identity storage. Also call addIdentity to ensure
that the identityName for the key exists. However, if the key already
exists, do nothing.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the public key to be added. |
keyType |
number | Type of the public key to be added from KeyType, such as KeyType.RSA.. |
publicKeyDer |
Blob | A blob of the public key DER to be added. |
Returns:
A promise which fulfills when complete.
- Type
- SyncPromise
deleteCertificateInfoPromise(certificateName) → {SyncPromise}
Delete a certificate.
Parameters:
Name | Type | Description |
---|---|---|
certificateName |
Name | The certificate name. |
Returns:
A promise which fulfills when the certificate
info is deleted.
- Type
- SyncPromise
deleteIdentityInfoPromise(identity) → {SyncPromise}
Delete an identity and related public keys and certificates.
Parameters:
Name | Type | Description |
---|---|---|
identity |
Name | The identity name. |
Returns:
A promise which fulfills when the identity info is
deleted.
- Type
- SyncPromise
deletePublicKeyInfoPromise(keyName) → {SyncPromise}
Delete a public key and related certificates.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The key name. |
Returns:
A promise which fulfills when the public key info is
deleted.
- Type
- SyncPromise
doesCertificateExistPromise(certificateName) → {SyncPromise}
Check if the specified certificate already exists.
Parameters:
Name | Type | Description |
---|---|---|
certificateName |
Name | The name of the certificate. |
Returns:
A promise which returns true if the certificate exists.
- Type
- SyncPromise
doesIdentityExistPromise(identityName) → {SyncPromise}
Check if the specified identity already exists.
Parameters:
Name | Type | Description |
---|---|---|
identityName |
Name | The identity name. |
Returns:
A promise which returns true if the identity exists.
- Type
- SyncPromise
doesKeyExistPromise(keyName) → {SyncPromise}
Check if the specified key already exists.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key. |
Returns:
A promise which returns true if the key exists.
- Type
- SyncPromise
getCertificatePromise(certificateName) → {SyncPromise}
Get a certificate from the identity storage.
Parameters:
Name | Type | Description |
---|---|---|
certificateName |
Name | The name of the requested certificate. |
Returns:
A promise which returns the requested
IdentityCertificate, or a promise rejected with SecurityException if the
certificate doesn't exist.
- Type
- SyncPromise
getDefaultCertificateNameForKeyPromise(keyName) → {SyncPromise}
Get the default certificate name for the specified key.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The key name. |
Returns:
A promise which returns the default certificate Name,
or a promise rejected with SecurityException if the default certificate name
for the key name is not set.
- Type
- SyncPromise
getDefaultIdentityPromise() → {SyncPromise}
Get the default identity.
Returns:
A promise which returns the Name of default identity,
or a promise rejected with SecurityException if the default identity is not
set.
- Type
- SyncPromise
getDefaultKeyNameForIdentityPromise(identityName) → {SyncPromise}
Get the default key name for the specified identity.
Parameters:
Name | Type | Description |
---|---|---|
identityName |
Name | The identity name. |
Returns:
A promise which returns the default key Name, or a
promise rejected with SecurityException if the default key name for the
identity is not set.
- Type
- SyncPromise
getKeyPromise(keyName) → {SyncPromise}
Get the public key DER blob from the identity storage.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the requested public key. |
Returns:
A promise which returns the DER Blob, or a promise
rejected with SecurityException if the key doesn't exist.
- Type
- SyncPromise
setDefaultCertificateNameForKeyPromise(keyName, certificateName) → {SyncPromise}
Set the default key name for the specified identity.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The key name. |
certificateName |
Name | The certificate name. |
Returns:
A promise which fulfills when the default certificate
name is set.
- Type
- SyncPromise
setDefaultIdentityPromise(identityName) → {SyncPromise}
Set the default identity. If the identityName does not exist, then clear the
default identity so that getDefaultIdentity() throws an exception.
Parameters:
Name | Type | Description |
---|---|---|
identityName |
Name | The default identity name. |
Returns:
A promise which fulfills when the default identity is set.
- Type
- SyncPromise
setDefaultKeyNameForIdentityPromise(keyName, identityNameCheck) → {SyncPromise}
Set a key as the default key of an identity. The identity name is inferred
from keyName.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The name of the key. |
identityNameCheck |
Name | (optional) The identity name to check that the keyName contains the same identity name. If an empty name, it is ignored. |
Returns:
A promise which fulfills when the default key name is
set.
- Type
- SyncPromise