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

x/faster/vendor/jose/index.ts>FlattenedEncrypt

A fast and optimized middleware server with an absurdly small amount of code (300 lines) built on top of native HTTP APIs with no dependencies. It also has a collection of useful middlewares: log file, serve static, CORS, session, rate limit, token, body parsers, redirect, proxy and handle upload. For Deno Deploy and other enviroments!
Latest
class FlattenedEncrypt
import { FlattenedEncrypt } from "https://deno.land/x/faster@v12.1/vendor/jose/index.ts";

The FlattenedEncrypt class is used to build and encrypt Flattened 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/flattened/encrypt'.

Constructors

new
FlattenedEncrypt(plaintext: Uint8Array)

Properties

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

Methods

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

Encrypts and resolves the value of the Flattened JWE object.

setAdditionalAuthenticatedData(aad: Uint8Array): this

Sets the Additional Authenticated Data on the FlattenedEncrypt object.

deprecated
setContentEncryptionKey(cek: Uint8Array): this

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): this

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.

setProtectedHeader(protectedHeader: JWEHeaderParameters): this

Sets the JWE Protected Header on the FlattenedEncrypt object.

setSharedUnprotectedHeader(sharedUnprotectedHeader: JWEHeaderParameters): this

Sets the JWE Shared Unprotected Header on the FlattenedEncrypt object.

setUnprotectedHeader(unprotectedHeader: JWEHeaderParameters): this

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