Skip to content

Commit 161de46

Browse files
committed
refactor!: WebCryptoAPI is now the only crypto used
BREAKING CHANGE: CJS-style require is now only possible when require(esm) support is present in the Node.js runtime BREAKING CHANGE: private KeyObject instances can no longer be used for verify operations BREAKING CHANGE: private KeyObject instances can no longer be used for encryption operations BREAKING CHANGE: generateSecret, generateKeyPair, importPKCS8, importSPKI, importJWK, and importX509 now yield a CryptoKey instead of a KeyObject in Node.js BREAKING CHANGE: drop support for Node.js 18.x and earlier BREAKING CHANGE: runtime-specific npm releases (jose-browser-runtime, jose-node-cjs-runtime, and jose-node-esm-runtime) are no longer maintained or supported
1 parent e2b58a5 commit 161de46

File tree

140 files changed

+771
-2898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+771
-2898
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ jobs:
1414
runs-on: ubuntu-latest
1515
permissions:
1616
id-token: write
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
prepare-script:
21-
- browser
22-
- node-cjs
23-
- node-esm
24-
- universal
2517
steps:
2618
- name: Checkout
2719
uses: actions/checkout@v4
@@ -41,7 +33,7 @@ jobs:
4133
key: dist-${{ hashFiles('src/**/*.ts', 'tsconfig/*.json', '.github/workflows/*.yml', 'package-lock.json') }}
4234
fail-on-cache-miss: true
4335
- name: Prepare distribution
44-
run: node tools/publish-${{ matrix.prepare-script }}
36+
run: node tools/publish.cjs
4537
- run: npm publish --provenance
4638
env:
4739
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -79,6 +71,6 @@ jobs:
7971
with:
8072
node-version: lts/*
8173
cache: 'npm'
82-
- run: node tools/release-notes
74+
- run: node tools/release-notes.cjs
8375
env:
8476
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# crypto runtime copies
2-
src/runtime/*.ts
3-
!src/runtime/*.d.ts
4-
51
# Logs
62
logs
73
*.log

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,18 @@ Support from the community to continue maintaining and improving this module is
1818

1919
## Dependencies: 0
2020

21-
`jose` has no dependencies and it exports tree-shakeable ESM. CJS is also supported.
21+
`jose` has no dependencies and it exports tree-shakeable ESM[^cjs].
2222

2323
## Documentation
2424

2525
`jose` is distributed via [npmjs.com](https://www.npmjs.com/package/jose), [deno.land/x](https://deno.land/x/jose), [cdnjs.com](https://cdnjs.com/libraries/jose), [jsdelivr.com](https://www.jsdelivr.com/package/npm/jose), and [github.com](https://github.com/panva/jose).
2626

27-
**`example`** ESM import
27+
**`example`** ESM import[^cjs]
2828

2929
```js
3030
import * as jose from 'jose'
3131
```
3232

33-
**`example`** CJS require
34-
35-
```js
36-
const jose = require('jose')
37-
```
38-
3933
### JSON Web Tokens (JWT)
4034

4135
The `jose` module supports JSON Web Tokens (JWT) and provides functionality for signing and verifying tokens, as well as their JWT Claims Set validation.
@@ -122,11 +116,12 @@ Please note that certain algorithms may not be available depending on the runtim
122116

123117
## Supported Versions
124118

125-
| Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ |
126-
| ----------------------------------------------- | ----------------- | ------------------ | --------------- |
127-
| [v5.x](https://github.com/panva/jose/tree/v5.x) ||||
128-
| [v4.x](https://github.com/panva/jose/tree/v4.x) ||||
129-
| [v2.x](https://github.com/panva/jose/tree/v2.x) ||||
119+
| Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ | Runtime and Module type |
120+
| ----------------------------------------------- | ----------------- | ------------------ | --------------- | ------------------------------- |
121+
| [v6.x](https://github.com/panva/jose/tree/v6.x) |||| Universal[^universal] ESM[^cjs] |
122+
| [v5.x](https://github.com/panva/jose/tree/v5.x) |||| Universal[^universal] CJS + ESM |
123+
| [v4.x](https://github.com/panva/jose/tree/v4.x) |||| Universal[^universal] CJS + ESM |
124+
| [v2.x](https://github.com/panva/jose/tree/v2.x) |||| Node.js CJS |
130125

131126
## Specifications
132127

@@ -148,3 +143,9 @@ The algorithm implementations in `jose` have been tested using test vectors from
148143
</details>
149144

150145
[sponsor-auth0]: https://a0.to/signup/panva
146+
[WebCryptoAPI]: https://w3c.github.io/webcrypto/
147+
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
148+
149+
[^cjs]: CJS style `let jose = require('jose')` is possible in Node.js versions where `process.features.require_module` is `true` by default (^20.19.0 || ^22.12.0 || >= 23.0.0) or with the `--experimental-require-module` Node.js CLI flag.
150+
151+
[^universal]: Assumes runtime support of [WebCryptoAPI][] and [Fetch API][]

docs/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ Support from the community to continue maintaining and improving this module is
2020

2121
`jose` is distributed via [npmjs.com](https://www.npmjs.com/package/jose), [deno.land/x](https://deno.land/x/jose), [cdnjs.com](https://cdnjs.com/libraries/jose), [jsdelivr.com](https://www.jsdelivr.com/package/npm/jose), [github.com](https://github.com/panva/jose).
2222

23-
**`example`** ESM import
24-
```js
25-
import * as jose from 'jose'
26-
```
23+
**`example`** ESM import[^cjs]
2724

28-
**`example`** CJS require
2925
```js
30-
const jose = require('jose')
26+
import * as jose from 'jose'
3127
```
3228

3329
### JSON Web Tokens (JWT)
@@ -99,3 +95,5 @@ The following are additional features and utilities provided by the `jose` modul
9995
- [JOSE Errors](util/errors/README.md)
10096

10197
[sponsor-auth0]: https://a0.to/signup/panva
98+
99+
[^cjs]: CJS style `let jose = require('jose')` is possible in Node.js versions where `process.features.require_module` is `true` or with the `--experimental-require-module` Node.js CLI flag.

0 commit comments

Comments
 (0)