{"id":19386528,"url":"https://github.com/rdeak/jwe","last_synced_at":"2026-05-14T18:05:20.058Z","repository":{"id":216112706,"uuid":"740396188","full_name":"rdeak/jwe","owner":"rdeak","description":"JWE with compression","archived":false,"fork":false,"pushed_at":"2024-05-27T07:24:14.000Z","size":202,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T18:44:48.581Z","etag":null,"topics":["jwe"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rdeak.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-08T09:04:48.000Z","updated_at":"2024-05-27T07:23:27.000Z","dependencies_parsed_at":"2024-01-15T18:21:43.210Z","dependency_job_id":null,"html_url":"https://github.com/rdeak/jwe","commit_stats":null,"previous_names":["rdeak/jwe-demo","rdeak/jwe"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/rdeak/jwe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdeak%2Fjwe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdeak%2Fjwe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdeak%2Fjwe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdeak%2Fjwe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdeak","download_url":"https://codeload.github.com/rdeak/jwe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdeak%2Fjwe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33037063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jwe"],"created_at":"2024-11-10T10:06:20.736Z","updated_at":"2026-05-14T18:05:20.025Z","avatar_url":"https://github.com/rdeak.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JWE\n\n[![npm version](https://img.shields.io/npm/v/@rdeak/jwe/latest.svg)](https://www.npmjs.com/package/@rdeak/jwe)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nThis repo exposes functions for encrypting JSON payloads, and decrypting JWE tokens into JSON from Node.js.\n\nBy default, `dir` algorithm is used for encryption of CEK, and `A128GCM` for encryption of a payload.\n\nUnderhood it uses [jose](https://github.com/panva/jose) library.\n\n## Installation\n\n```bash\nnpm install @rdeak/jwe\n```\n\nor\n\n```bash\nnpm install https://github.com/rdeak/jwe\n```\n\n## Usage\n\n```javascript\nimport { encrypt, decrypt } from \"@rdeak/jwe\";\n\nconst jwe = JWE(\"0123456789123456\");\n\nconst jweToken = await jwe.encrypt({ name: \"John Doe\" });\nconsole.log(\"JWE:\", jweToken);\n\nconst payload = await jwe.decrypt(jweToken);\nconsole.table(payload);\n```\n\n## API Documentation\n\n### JWE\n\nCreate handler for encrypting and decrypting JWE tokens.\n\n#### Parameters\n\n| Name      | Type      |\n| :-------- | :-------- |\n| `secret`  | `string`  |\n| `options` | `Options` |\n\n```typescript\ntype Options = {\n  /***\n   * cryptographic algorithm used to encrypt CEK\n   */\n  alg?: string;\n  /***\n   * cryptographic algorithm used to encrypt payload\n   */\n  enc?: string;\n  /***\n   * default content is converted to JSON\n   */\n  transform?: Transform\u003cPAYLOAD\u003e;\n  /***\n   * @deprecated https://www.rfc-editor.org/rfc/rfc8725#name-avoid-compression-of-encryp\n   */\n  compression?: Compression;\n};\n```\n\n### encrypt\n\n▸ **encrypt**(`payload`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\\u003c`string`\\\u003e\n\nEncrypts and resolves the value of the Compact JWE string.\n\n#### Parameters\n\n| Name      | Type                      |\n| :-------- | :------------------------ |\n| `payload` | `Record\u003cstring, unknown\u003e` |\n\n#### Returns\n\n[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u003c`string`\u003e\n\n### decrypt\n\n```javascript\ndecrypt(\"jwe token....\", \"0123456789123456\");\n```\n\n▸ **decrypt**(`jweToken`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\\u003c`string`\\\u003e\n\nDecrypts a Compact JWE into object.\n\n#### Parameters\n\n| Name       | Type     |\n| :--------- | :------- |\n| `jweToken` | `string` |\n\n#### Returns\n\n[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u003c`Record\u003cstring, unknown\u003e`\u003e\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdeak%2Fjwe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdeak%2Fjwe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdeak%2Fjwe/lists"}