Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/jose/jwe/general/encrypt.ts>GeneralEncrypt

JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes.
Extremely Popular
Latest
class GeneralEncrypt
import { GeneralEncrypt } from "https://deno.land/x/jose@v5.9.6/jwe/general/encrypt.ts";

The GeneralEncrypt class is used to build and encrypt General JWE objects.

This class is exported (as a named export) from the main 'jose' module entry point as well as from its subpath export 'jose/jwe/general/encrypt'.

Constructors

new
GeneralEncrypt(plaintext: Uint8Array)

Properties

private
_aad: Uint8Array
private
_plaintext: Uint8Array
private
_protectedHeader: JWEHeaderParameters
private
_recipients: IndividualRecipient[]
private
_unprotectedHeader: JWEHeaderParameters

Methods

addRecipient(key: KeyLike | Uint8Array, options?: CritOption): Recipient

Adds an additional recipient for the General JWE object.

encrypt(): Promise<GeneralJWE>

Encrypts and resolves the value of the General JWE object.

setAdditionalAuthenticatedData(aad: Uint8Array): this

Sets the Additional Authenticated Data on the GeneralEncrypt object.

setProtectedHeader(protectedHeader: JWEHeaderParameters): this

Sets the JWE Protected Header on the GeneralEncrypt object.

setSharedUnprotectedHeader(sharedUnprotectedHeader: JWEHeaderParameters): this

Sets the JWE Shared Unprotected Header on the GeneralEncrypt object.