import { GeneralEncrypt } from "https://deno.land/x/jose@v4.10.0/jwe/general/encrypt.ts";
The GeneralEncrypt class is a utility for creating General JWE objects.
Examples
Usage
Usage
const jwe = await new jose.GeneralEncrypt(
new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
)
.setProtectedHeader({ enc: 'A256GCM' })
.addRecipient(ecPublicKey)
.setUnprotectedHeader({ alg: 'ECDH-ES+A256KW' })
.addRecipient(rsaPublicKey)
.setUnprotectedHeader({ alg: 'RSA-OAEP-384' })
.encrypt()
console.log(jwe)
Properties
private
_protectedHeader: JWEHeaderParametersprivate
_unprotectedHeader: JWEHeaderParametersMethods
addRecipient(key: KeyLike | Uint8Array, options?: CritOption): Recipient
Adds an additional recipient for the General JWE object.
encrypt(options?: DeflateOption): Promise<GeneralJWE>
Encrypts and resolves the value of the General JWE object.
setAdditionalAuthenticatedData(aad: Uint8Array)
Sets the Additional Authenticated Data on the GeneralEncrypt object.
setProtectedHeader(protectedHeader: JWEHeaderParameters): this
Sets the JWE Protected Header on the GeneralEncrypt object.