
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@rdeak/jwe
Advanced tools
This repo exposes functions for encrypting JSON payloads, and decrypting JWE tokens into JSON from Node.js.
By default, dir algorithm is used for encryption of CEK, and A128GCM for encryption of a payload.
Underhood it uses jose library.
npm install @rdeak/jwe
or
npm install https://github.com/rdeak/jwe
import { encrypt, decrypt } from "@rdeak/jwe";
const jwe = JWE("0123456789123456");
const jweToken = await jwe.encrypt({ name: "John Doe" });
console.log("JWE:", jweToken);
const payload = await jwe.decrypt(jweToken);
console.table(payload);
Create handler for encrypting and decrypting JWE tokens.
| Name | Type |
|---|---|
secret | string |
options | Options |
type Options = {
/***
* cryptographic algorithm used to encrypt CEK
*/
alg?: string;
/***
* cryptographic algorithm used to encrypt payload
*/
enc?: string;
/***
* default content is converted to JSON
*/
transform?: Transform<PAYLOAD>;
/***
* @deprecated https://www.rfc-editor.org/rfc/rfc8725#name-avoid-compression-of-encryp
*/
compression?: Compression;
};
▸ encrypt(payload): Promise<string>
Encrypts and resolves the value of the Compact JWE string.
| Name | Type |
|---|---|
payload | Record<string, unknown> |
Promise<string>
decrypt("jwe token....", "0123456789123456");
▸ decrypt(jweToken): Promise<string>
Decrypts a Compact JWE into object.
| Name | Type |
|---|---|
jweToken | string |
Promise<Record<string, unknown>>
This project is licensed under the terms of the MIT license.
FAQs
JWE with compression
We found that @rdeak/jwe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.