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

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

A fast and optimized middleware server with an absurdly small amount of code (300 lines) built on top of Deno's 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. Fully compatible with Deno Deploy.
Latest
class CompactEncrypt
import { CompactEncrypt } from "https://deno.land/x/faster@v11.7/vendor/jose/index.ts";

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

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

Constructors

new
CompactEncrypt(plaintext: Uint8Array)

Properties

private
_flattened: FlattenedEncrypt

Methods

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

Encrypts and resolves the value of the Compact JWE string.

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 the Content Encryption Key. You do not need to invoke this method, it is only really intended for test and vector validation purposes.

Sets the JWE Protected Header on the CompactEncrypt object.