Static_StaticEXCHANGE_StaticINFOStaticTYPEStaticWRITE_The machine-readable name for this keypair.
Decrypt the given message. The encrypted message should be ephemeral public key + salt + iv + cipher text.
The ephemeral public key is extracted from the beginning of the message and used with our private key to derive the AES decryption key.
The encrypted content
OptionalaesAlgorithm: string | nullThe algorithm. Default is AES-GCM.
Optionalinfo: string | nullCustom "info" parameter
The decrypted content.
Decrypt and return as string using ECIES. The encrypted message should be ephemeral public key + salt + iv + cipher text.
The ephemeral public key is extracted from the beginning of the message and used with our private key to derive the AES decryption key.
The encrypted content
OptionalaesAlgorithm: string | nullThe algorithm. Default is AES-GCM.
Optionalinfo: string | nullCustom "info" parameter
The decrypted content as a string.
Delete the keys stored in indexedDB.
Encrypt the given content to the given public key, or encrypt to our own public key if a key is not passed in.
This does ECIES style encryption -- a new ephemeral keypair is generated and used to encrypt the message with ephemeral private + recipient public. The public key from the ephemeral keypair is prefixed to the cipher text.
Content to encrypt
Optionalrecipient: string | CryptoKey | nullTheir public key. Optional b/c we will use our own public key if not passed in. Can be a CryptoKey or a base64 encoded string.
Optionalinfo: string | nullinfo tag for HKDF. Default is the class property.
OptionalaesKey: string | Uint8Array<ArrayBufferLike> | CryptoKey | nullThis is not relevant for most use cases.
Optionalkeysize: SymmKeyLength | nullDefault is 256
Buffer of ephemeral-public-key + salt + iv + cipher text
Encrypt and return as base64 string.
Optionalrecipient: string | CryptoKey | nullOptionalinfo: string | nullOptionalaesKey: string | Uint8Array<ArrayBufferLike> | CryptoKey | nullOptionalkeysize: SymmKeyLength | nullDo DHKE, create a new AES-GCM key.
OptionalpublicKey: string | CryptoKey | nullPublic key to use in DHKE. Will use our public key if it is not passed in.
Optionalinfo: string | nullThe info parameter for DHKE. Will use the class
property INFO if it is not passed in.
New AES key
Return a 32-character, DNS friendly hash of the public signing key.
Save this keys instance to indexedDB.
Optionalformat: SupportedEncodingsOptionalformat: SupportedEncodingsSign the given content and return as base64 string.
Optional_charsize: CharSizeSerialize this keys instance. Will return an object of
{ DID, publicExchangeKey }, where DID is the public write key,
and publicExchangeKey is the encryption key, base64 encoded.
Optionalformat: SupportedEncodingsUnwrap a content key that was wrapped for this device using the add method.
The recipient device uses its private key + the ephemeral public key to rederive the KEK and decrypt the wrapped content key.
The ephemeral public key (base64) from the sender.
The wrapped content key (base64) - contains salt + iv + ciphertext.
Optionalinfo: stringOptional info parameter for HKDF. Must match what was used in add. Defaults to 'key-wrap'.
The unwrapped AES content key.
"Add a device," meaning, take an existing AES key and add the ability for a new keypair to decrypt/use the AES key.
This implements HPKE-style key wrapping:
The existing AES key used to encrypt the content. Can be a base64 encoded string.
The new device's public X25519 key.
Optionalinfo: stringOptional info parameter for HKDF. Defaults to 'key-wrap'.
The ephemeral public key (base64) and the wrapped AES key (base64).
Static_Static_StaticcreateFactory function.
Optionalsession: booleanSession only? i.e., not saved in indexedDB.
Default false.
Optionalextractable: booleanCan we extract the private keys? Default
false.
Optionalkeys: { exchangeKeys?: CryptoKeyPair | null; writeKeys?: CryptoKeyPair | null }A set of keys to use here.
A new class instance.
StaticdeviceReturn a 32-character, DNS-friendly hash of the given DID.
A DID format string
32 character, base32 hash of the DID
StaticexistStaticloadRestore some keys from indexedDB, or create a new keypair if it doesn't exist yet. Overrides base class to use ECC-specific key names.
Class for ECC keys