Skip to content

Commit 67a8601

Browse files
committed
feat: added Node.js lts/dubnium support for runtime supported features
1 parent 1d6d55f commit 67a8601

Some content is hidden

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

45 files changed

+888
-224
lines changed

.codecov.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
coverage:
22
status:
3-
project: no
4-
patch: yes
5-
changes: yes
3+
project: off
4+
patch: off
5+
changes: off
66

77
comment:
88
layout: diff

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ jobs:
2020
test:
2121
runs-on: ${{ matrix.os }}
2222
strategy:
23+
fail-fast: false
2324
matrix:
2425
node-version:
26+
- 10.13.0
27+
- 10
2528
- 12.0.0
2629
- 12
2730
os:
@@ -58,6 +61,7 @@ jobs:
5861
test-electron:
5962
runs-on: ${{ matrix.os }}
6063
strategy:
64+
fail-fast: false
6165
matrix:
6266
electron-version:
6367
- 6.0.0

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ its original on-by-default form - v1.1.0 and v1.2.0
155155
wrapKey/unwrapKey/deriveKey returns
156156
* keystore.all and keystore.get `operation` option was
157157
removed, `key_ops: string[]` supersedes it
158-
* node.js minimal version is now v12.0.0 due to its
158+
* Node.js minimal version is now v12.0.0 due to its
159159
added EdDSA support (crypto.sign, crypto.verify and eddsa key objects)
160160

161161

@@ -323,7 +323,7 @@ Initial release
323323
| AES || A128KW, A192KW, A256KW |
324324
| AES GCM || A128GCMKW, A192GCMKW, A256GCMKW |
325325
| Direct Key Agreement || dir |
326-
| RSAES OAEP | ✓<sup>*</sup> | RSA-OAEP <sub>(<sup>*</sup>RSA-OAEP-256 is not supported due to its lack of support in Node.JS)</sub> |
326+
| RSAES OAEP | ✓<sup>*</sup> | RSA-OAEP <sub>(<sup>*</sup>RSA-OAEP-256 is not supported due to its lack of support in Node.js)</sub> |
327327
| RSAES-PKCS1-v1_5 || RSA1_5 |
328328
| PBES2 || PBES2-HS256+A128KW, PBES2-HS384+A192KW, PBES2-HS512+A256KW |
329329
| ECDH-ES || ECDH-ES, ECDH-ES+A128KW, ECDH-ES+A192KW, ECDH-ES+A256KW |

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ Legend:
8080
| JARM - [JWT Secured Authorization Response Mode for OAuth 2.0][draft-jarm] |||
8181

8282
Notes
83-
- RSA-OAEP-256 is only supported when Node.js >= 12.9.0 runtime is detected
83+
- RSA-OAEP-256 JWE algorithm is only supported when Node.js >= 12.9.0 runtime is detected
84+
- Importing X.509 certificates and handling `x5c` is only supported when Node.js >= 12.0.0 runtime is detected
85+
- OKP keys are only supported when Node.js >= 12.0.0 runtime is detected
8486
- See [#electron-support](#electron-support) for electron exceptions
8587

8688
---
@@ -126,7 +128,8 @@ If you or your business use @panva/jose, please consider becoming a [sponsor][su
126128

127129
## Usage
128130

129-
For its improvements in the crypto module ⚠️ the minimal Node.js version required is **v12.0.0** ⚠️
131+
For the best performance Node.js version **>=12.0.0** is recommended, but **^10.13.0** lts/dubnium
132+
is also supported.
130133

131134
Installing @panva/jose
132135

@@ -318,7 +321,7 @@ Electron v6.x runtime is supported to the extent of the crypto engine BoringSSL
318321
standard Node.js OpenSSL. The following is disabled in Electron runtime because of its lack of
319322
[support](https://github.com/panva/jose/blob/master/test/electron/electron.test.js).
320323

321-
- JWE `A128KW`, `A192KW` and `A256KW` algs are not available, this also means that other JWAs
324+
- JWE `A128KW`, `A192KW` and `A256KW` algorithms are not available, this also means that other JWAs
322325
depending on those are not working, those are `ECDH-ES+A128KW`, `ECDH-ES+A192KW`,
323326
`ECDH-ES+A256KW`, `PBES2-HS256+A128KW`, `PBES2-HS384+A192KW`, `PBES2-HS512+A256KW`)
324327
- OKP curves `Ed448`, `X25519` and `X448` are not supported
@@ -335,8 +338,9 @@ private API and is subject to change between any versions.
335338

336339
#### How do I use it outside of Node.js
337340

338-
It is **only built for Node.js** environment - it builds on top of the `crypto` module and requires
339-
the KeyObject API that was added in Node.js v11.6.0 and one-shot sign/verify API added in v12.0.0
341+
It is **only built for ^10.13.0 || >=12.0.0 Node.js** environment - including @panva/jose in
342+
transpiled browser-environment targetted projects is not supported and may result in unexpected
343+
results.
340344

341345
#### How is it different from [`jws`](https://github.com/brianloveswords/node-jws), [`jwa`](https://github.com/brianloveswords/node-jwa) or [`jsonwebtoken`](https://github.com/auth0/node-jsonwebtoken)?
342346

lib/errors.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,17 @@ class JOSEError extends Error {
3737

3838
const isMulti = e => e instanceof JOSEMultiError
3939
class JOSEMultiError extends JOSEError {
40-
#errors
41-
4240
constructor (errors) {
4341
super()
4442
let i
4543
while ((i = errors.findIndex(isMulti)) && i !== -1) {
4644
errors.splice(i, 1, ...errors[i])
4745
}
48-
this.#errors = errors
46+
Object.defineProperty(this, 'errors', { value: errors })
4947
}
5048

5149
* [Symbol.iterator] () {
52-
for (const error of this.#errors) {
50+
for (const error of this.errors) {
5351
yield error
5452
}
5553
}

lib/help/asn1/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,10 @@ types.set('RSAPrivateKey', RSAPrivateKey)
2626
const RSAPublicKey = asn1.define('RSAPublicKey', require('./rsa_public_key'))
2727
types.set('RSAPublicKey', RSAPublicKey)
2828

29+
const OID = asn1.define('OID', function () {
30+
return this.objid()
31+
})
32+
types.set('OID', OID)
33+
2934
module.exports = types
3035
module.exports.bignum = asn1.bignum

0 commit comments

Comments
 (0)