← Back to index
class CompactEncrypt

The CompactEncrypt class is used to build and encrypt Compact JWE strings.

Constructors

🔗
CompactEncrypt()

Methods

🔗
encrypt(key: KeyLike | Uint8Array, options?: EncryptOptions): Promise<string>

Encrypts and resolves the value of the Compact JWE string.

🔗
setContentEncryptionKey(cek: Uint8Array)

Sets a content encryption key to use, by default a random suitable one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.

🔗
setInitializationVector(iv: Uint8Array)

Sets the JWE Initialization Vector to use for content encryption, by default a random suitable one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.

🔗
setKeyManagementParameters(parameters: JWEKeyManagementHeaderParameters)

Sets the JWE Key Management parameters to be used when encrypting the Content Encryption Key. You do not need to invoke this method, it is only really intended for test and vector validation purposes.

🔗
setProtectedHeader(protectedHeader: CompactJWEHeaderParameters)

Sets the JWE Protected Header on the CompactEncrypt object.