Protected_Protected_Have these keys been deleted? A deleted keypair is terminal -- the key material is gone, and any use of it throws.
ReadonlyexchangeThe indexedDB names this keypair was loaded from, and the names
persist and delete will use.
ReadonlywriteStatic_StaticEXCHANGE_StaticINFOStaticTYPEStaticWRITE_The machine-readable name for this keypair.
Drop the in-memory key material. Internal -- call delete instead.
Decrypt the given message. Expects encrypted AES key + encrypted content.
The RSA-encrypted AES key is always exactly one RSA-modulus-sized block, so the split point between it and the AES-encrypted content is derived from this instance's RSA modulus length -- not from the (unrelated) AES key size.
Optional_keysize: string | CryptoKey | SymmKeyLengthOptional_aesAlgorithm: stringDecrypt and return as string.
Optionalkeysize: string | CryptoKey | SymmKeyLengthOptional_aesAlgorithm: stringDelete this keypair. This deletes the keys from indexedDB, drops the
in-memory key material, and clears the instance cache, so load will
not hand out these keys again.
After this, the instance is destroyed -- using it throws
a KeysDeletedError.
Encrypt content using hybrid encryption (RSA + AES).
Optionalrecipient: string | CryptoKeyOptionalaesKeyOrInfo: string | Uint8Array<ArrayBufferLike> | CryptoKeyOptionalkeysizeOrAesKey: string | Uint8Array<ArrayBufferLike> | CryptoKey | SymmKeyLengthOptionalkeysize: SymmKeyLengthEncrypt and return as base64 string.
Optionalrecipient: string | CryptoKeyOptionalaesKeyOrInfo: string | Uint8Array<ArrayBufferLike> | CryptoKeyOptionalkeysizeOrAesKey: string | Uint8Array<ArrayBufferLike> | CryptoKey | SymmKeyLengthOptionalkeysize: SymmKeyLengthGet the relevant AES key for RSA - decrypt the given encrypted key.
OptionalencryptedKey: string | CryptoKey | nullOptional_info: string | nullReturn a 32-character, DNS friendly hash of the public signing key.
Save this keys instance to indexedDB.
Optionalformat: SupportedEncodingsOptionalformat: SupportedEncodingsSerialize this keys instance. Will return an object of
{ DID, publicExchangeKey }, where DID is the public signature key,
and publicExchangeKey is the encryption key, base64 encoded.
Optionalformat: SupportedEncodingsStatic_Static_Static_If the cached instance was loaded from the given names, then its keys are gone too. Destroy it, and clear the cache. Internal.
Static_The indexedDB names for this class, optionally prefixed with dbKey.
Pure -- never writes to the class statics.
OptionaldbKey: stringStaticcreateFactory function.
Optionalsession: boolean
Session only? i.e., not saved in indexedDB.
Default false.
Optionalextractable: boolean
Can we extract the private keys? Default
false.
Optionalkeys: {Key options.
dbKey prefixes the IndexedDB names used for both keypairs.
A new class instance.
StaticdeleteDelete a stored keypair without loading it first. Deletes the keys from indexedDB, and destroys the cached instance, if there is one for these names.
Optionalopts: { encryptionKeyName?: string; writeKeyName?: string } = {}
The indexedDB names to delete. Defaults to this class's names.
StaticdeviceReturn a 32-character, DNS-friendly hash of the given DID.
A DID format string
32 character, base32 hash of the DID
StaticexistStaticloadRestore keys from indexedDB using the RSA key names.
Optionalopts: Partial<Prefix for both IndexedDB key names.
The parent key. Doesn't implement the encrypt/sign functions.