Class: IndexedDbPrivateKeyStorage

IndexedDbPrivateKeyStorage

new IndexedDbPrivateKeyStorage()

IndexedDbPrivateKeyStorage extends PrivateKeyStorage to implement private key storage using the browser's IndexedDB service.
Source:

Methods

(static) transformName()

Transform the key name into the base64 encoding of the hash (the same as in FilePrivateKeyStorage without the file name extension).
Source:

deleteKeyPairPromise(keyName, useSync) → {Promise}

Delete a pair of asymmetric keys. If the key doesn't exist, do nothing.
Parameters:
Name Type Description
keyName Name The name of the 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 key pair is deleted.
Type
Promise

doesKeyExistPromise(keyName, keyClass, useSync) → {Promise}

Check if a particular key exists.
Parameters:
Name Type Description
keyName Name The name of the key.
keyClass number The class of the key, e.g. KeyClass.PUBLIC, KeyClass.PRIVATE, or KeyClass.SYMMETRIC.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise which returns true if the key exists.
Type
Promise

generateKeyPairPromise(keyName, params, useSync) → {Promise}

Generate a pair of asymmetric keys.
Parameters:
Name Type Description
keyName Name The name of the key pair.
params KeyParams The parameters of the key.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the pair is generated.
Type
Promise

getPublicKeyPromise(keyName, useSync) → {Promise}

Get the public key
Parameters:
Name Type Description
keyName Name The name of public key.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns the PublicKey.
Type
Promise

signPromise(data, keyName, digestAlgorithm, useSync) → {Promise}

Fetch the private key for keyName and sign the data to produce a signature Blob.
Parameters:
Name Type Description
data Buffer Pointer to the input byte array.
keyName Name The name of the signing key.
digestAlgorithm number (optional) The digest algorithm from DigestAlgorithm, such as DigestAlgorithm.SHA256. If omitted, use DigestAlgorithm.SHA256.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns the signature Blob.
Type
Promise