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

x/jose/jwe/flattened/encrypt.ts>FlattenedEncrypt

"JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes.
Extremely Popular
Go to Latest
class FlattenedEncrypt
import { FlattenedEncrypt } from "https://deno.land/x/jose@v4.14.4/jwe/flattened/encrypt.ts";

The FlattenedEncrypt class is used to build and encrypt Flattened JWE objects.

Constructors

new
FlattenedEncrypt(plaintext: Uint8Array)

Properties

private
_aad: Uint8Array
private
_cek: Uint8Array
private
_iv: Uint8Array
private
_keyManagementParameters: JWEKeyManagementHeaderParameters
private
_plaintext: Uint8Array
private
_protectedHeader: JWEHeaderParameters
private
_sharedUnprotectedHeader: JWEHeaderParameters
private
_unprotectedHeader: JWEHeaderParameters

Methods

encrypt(key: KeyLike | Uint8Array, options?: EncryptOptions)

Encrypts and resolves the value of the Flattened JWE object.

Sets the Additional Authenticated Data on the FlattenedEncrypt object.

deprecated
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.

deprecated
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.

Sets the JWE Key Management parameters to be used when encrypting. Use of this is method is really only needed for ECDH based algorithms when utilizing the Agreement PartyUInfo or Agreement PartyVInfo parameters. Other parameters will always be randomly generated when needed and missing.

Sets the JWE Protected Header on the FlattenedEncrypt object.

Sets the JWE Shared Unprotected Header on the FlattenedEncrypt object.

Sets the JWE Per-Recipient Unprotected Header on the FlattenedEncrypt object.