jose 2.0.3 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,20 @@
4
4
 
5
5
  <p align="center"><img src="/img/demo.gif?raw=true"/></p>
6
6
 
7
+ ## New major version is available
8
+
9
+ `v2.x` continues being supported. It will continue receiving
10
+ bug fixes until 2022-04-30. It will not be receiving any new
11
+ features.
12
+
13
+ `v3.x` is [available](https://github.com/panva/jose) with
14
+
15
+ - Revised API
16
+ - No dependencies
17
+ - Browser support
18
+ - Promise-based API
19
+ - experimental (non-blocking 🎉) Node.js libuv thread pool based runtime
20
+
7
21
  ## Implemented specs & features
8
22
 
9
23
  The following specifications are implemented by `jose`
@@ -49,7 +63,7 @@ is also supported.
49
63
  Installing `jose`
50
64
 
51
65
  ```console
52
- npm install jose
66
+ npm install jose@2
53
67
  ```
54
68
 
55
69
  Usage
@@ -303,9 +317,9 @@ jose.JWE.decrypt(
303
317
 
304
318
  | JWT profile validation | Supported | Stable profile | |
305
319
  | -- | -- | -- | -- |
306
- | JWT Access Tokens - [JWT Profile for OAuth 2.0 Access Tokens][draft-ietf-oauth-access-token-jwt] | ✓ | ✕<sup>5</sup> | see [`JWT.AccessToken.verify`](/docs/README.md#jwtaccesstokenverifytoken-keyorstore-options) |
307
- | ID Token - [OpenID Connect Core 1.0][spec-oidc-id_token] | ✓ | ✓ | see [`JWT.IdToken.verify`](/docs/README.md#jwtidtokenverifytoken-keyorstore-options) |
308
- | Logout Token - [OpenID Connect Back-Channel Logout 1.0][spec-oidc-logout_token] | ✓ | ✕<sup>5</sup> | see [`JWT.LogoutToken.verify`](/docs/README.md#jwtlogouttokenverifytoken-keyorstore-options) |
320
+ | JWT Access Tokens - [JWT Profile for OAuth 2.0 Access Tokens][draft-ietf-oauth-access-token-jwt] | ✓ | ✕<sup>5</sup> | see [`JWT.AccessToken.verify`]([/docs/README.md](https://github.com/panva/jose/blob/v2.x/docs/README.md)#jwtaccesstokenverifytoken-keyorstore-options) |
321
+ | ID Token - [OpenID Connect Core 1.0][spec-oidc-id_token] | ✓ | ✓ | see [`JWT.IdToken.verify`]([/docs/README.md](https://github.com/panva/jose/blob/v2.x/docs/README.md)#jwtidtokenverifytoken-keyorstore-options) |
322
+ | Logout Token - [OpenID Connect Back-Channel Logout 1.0][spec-oidc-logout_token] | ✓ | ✕<sup>5</sup> | see [`JWT.LogoutToken.verify`]([/docs/README.md](https://github.com/panva/jose/blob/v2.x/docs/README.md)#jwtlogouttokenverifytoken-keyorstore-options) |
309
323
  | JARM - [JWT Secured Authorization Response Mode for OAuth 2.0][draft-jarm] | ◯ |||
310
324
  | [JWT Response for OAuth Token Introspection][draft-jwtintrospection] | ◯ |||
311
325
  | [OAuth 2.0 DPoP][draft-dpop] | ◯ |||
@@ -327,6 +341,13 @@ attention to changelog and the drafts themselves.
327
341
 
328
342
  ## FAQ
329
343
 
344
+ #### Supported Versions
345
+
346
+ | Version | Bug Fixes 🐞 | New Features ⭐ |
347
+ | ------- | --------- | -------- |
348
+ | [3.x.x](https://github.com/panva/jose) | ✅ | ✅ |
349
+ | [2.x.x](https://github.com/panva/jose/tree/v2.x) | ✅ until 2022-04-30 | ❌ |
350
+
330
351
  #### Semver?
331
352
 
332
353
  **Yes.** Everything that's either exported in the TypeScript definitions file or
@@ -377,13 +398,13 @@ in terms of performance and API (not having well defined errors).
377
398
 
378
399
  &plus; this was an amazing opportunity to learn JOSE as a whole
379
400
 
380
- [documentation-jwe]: /docs/README.md#jwe-json-web-encryption
381
- [documentation-jwk]: /docs/README.md#jwk-json-web-key
382
- [documentation-jwks]: /docs/README.md#jwks-json-web-key-set
383
- [documentation-jws]: /docs/README.md#jws-json-web-signature
384
- [documentation-jwt]: /docs/README.md#jwt-json-web-token
385
- [documentation-none]: /docs/README.md#jwknone
386
- [documentation]: /docs/README.md
401
+ [documentation-jwe]: https://github.com/panva/jose/blob/v2.x/docs/README.md#jwe-json-web-encryption
402
+ [documentation-jwk]: https://github.com/panva/jose/blob/v2.x/docs/README.md#jwk-json-web-key
403
+ [documentation-jwks]: https://github.com/panva/jose/blob/v2.x/docs/README.md#jwks-json-web-key-set
404
+ [documentation-jws]: https://github.com/panva/jose/blob/v2.x/docs/README.md#jws-json-web-signature
405
+ [documentation-jwt]: https://github.com/panva/jose/blob/v2.x/docs/README.md#jwt-json-web-token
406
+ [documentation-none]: https://github.com/panva/jose/blob/v2.x/docs/README.md#jwknone
407
+ [documentation]: https://github.com/panva/jose/blob/v2.x/docs/README.md
387
408
  [node-jose]: https://github.com/cisco/node-jose
388
409
  [spec-b64]: https://tools.ietf.org/html/rfc7797
389
410
  [spec-cookbook]: https://tools.ietf.org/html/rfc7520
@@ -1,13 +1,12 @@
1
- const fromBase64 = (base64) => {
2
- return base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_')
3
- }
4
-
5
- const encode = (input, encoding = 'utf8') => {
6
- return fromBase64(Buffer.from(input, encoding).toString('base64'))
7
- }
8
-
9
- const encodeBuffer = (buf) => {
10
- return fromBase64(buf.toString('base64'))
1
+ let encode
2
+ let encodeBuffer
3
+ if (Buffer.isEncoding('base64url')) {
4
+ encode = (input, encoding = 'utf8') => Buffer.from(input, encoding).toString('base64url')
5
+ encodeBuffer = (buf) => buf.toString('base64url')
6
+ } else {
7
+ const fromBase64 = (base64) => base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_')
8
+ encode = (input, encoding = 'utf8') => fromBase64(Buffer.from(input, encoding).toString('base64'))
9
+ encodeBuffer = (buf) => fromBase64(buf.toString('base64'))
11
10
  }
12
11
 
13
12
  const decodeToBuffer = (input) => {
@@ -44,13 +44,17 @@ const decrypt = (size, sign, { [KEYOBJECT]: keyObject }, ciphertext, { iv, tag =
44
44
  const expectedTag = sign({ [KEYOBJECT]: macKey }, macData, tag).slice(0, keySize)
45
45
  const macCheckPassed = timingSafeEqual(tag, expectedTag)
46
46
 
47
+ if (!macCheckPassed) {
48
+ throw new JWEDecryptionFailed()
49
+ }
50
+
47
51
  let cleartext
48
52
  try {
49
53
  const cipher = createDecipheriv(`aes-${size}-cbc`, encKey, iv)
50
54
  cleartext = Buffer.concat([cipher.update(ciphertext), cipher.final()])
51
55
  } catch (err) {}
52
56
 
53
- if (!cleartext || !macCheckPassed) {
57
+ if (!cleartext) {
54
58
  throw new JWEDecryptionFailed()
55
59
  }
56
60
 
@@ -52,7 +52,7 @@ const validateAlgorithms = (algorithms, option) => {
52
52
  /*
53
53
  * @public
54
54
  */
55
- const jweDecrypt = (skipValidateHeaders, serialization, jwe, key, { crit = [], complete = false, keyManagementAlgorithms, contentEncryptionAlgorithms } = {}) => {
55
+ const jweDecrypt = (skipValidateHeaders, serialization, jwe, key, { crit = [], complete = false, keyManagementAlgorithms, contentEncryptionAlgorithms, maxPBES2Count = 10000 } = {}) => {
56
56
  key = getKey(key, true)
57
57
 
58
58
  keyManagementAlgorithms = validateAlgorithms(keyManagementAlgorithms, 'keyManagementAlgorithms')
@@ -142,6 +142,12 @@ const jweDecrypt = (skipValidateHeaders, serialization, jwe, key, { crit = [], c
142
142
 
143
143
  check(key, ...(alg === 'dir' ? ['decrypt', enc] : ['keyManagementDecrypt', alg]))
144
144
 
145
+ if (alg.startsWith('PBES2')) {
146
+ if (opts && opts.p2c > maxPBES2Count) {
147
+ throw new errors.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds')
148
+ }
149
+ }
150
+
145
151
  try {
146
152
  if (alg === 'dir') {
147
153
  cek = JWK.asKey(key, { alg: enc, use: 'enc' })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "2.0.3",
3
+ "version": "2.0.6",
4
4
  "description": "JSON Web Almost Everything - JWA, JWS, JWE, JWK, JWT, JWKS for Node.js with minimal dependencies",
5
5
  "keywords": [
6
6
  "access token",
@@ -131,7 +131,8 @@
131
131
  },
132
132
  {
133
133
  "type": "perf",
134
- "hidden": true
134
+ "section": "Performance",
135
+ "hidden": false
135
136
  },
136
137
  {
137
138
  "type": "test",
package/types/index.d.ts CHANGED
@@ -401,6 +401,7 @@ export namespace JWE {
401
401
  crit?: string[];
402
402
  contentEncryptionAlgorithms?: string[];
403
403
  keyManagementAlgorithms?: string[];
404
+ maxPBES2Count?: number;
404
405
  }
405
406
 
406
407
  interface completeDecrypt {
package/CHANGELOG.md DELETED
@@ -1,826 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ## [2.0.3](https://github.com/panva/jose/compare/v2.0.2...v2.0.3) (2020-10-29)
6
-
7
-
8
- ### Bug Fixes
9
-
10
- * allow stubbing of the JWT.decode function ([6c3b92f](https://github.com/panva/jose/commit/6c3b92f4394a5d7092d7336922eda61e311e6f8c))
11
-
12
- ## [2.0.2](https://github.com/panva/jose/compare/v2.0.1...v2.0.2) (2020-09-14)
13
-
14
-
15
- ### Bug Fixes
16
-
17
- * **esm:** include esm files in the published package ([1956746](https://github.com/panva/jose/commit/1956746df6542c00bc33af750f93394805b5d603))
18
-
19
- ## [2.0.1](https://github.com/panva/jose/compare/v2.0.0...v2.0.1) (2020-09-10)
20
-
21
-
22
- ### Bug Fixes
23
-
24
- * allow plugins such as jose-chacha to work in newer node runtime ([30f1dc2](https://github.com/panva/jose/commit/30f1dc2c41e5554d322167b84b610a99bf5e69c5))
25
-
26
- ## [2.0.0](https://github.com/panva/jose/compare/v1.28.0...v2.0.0) (2020-09-08)
27
-
28
-
29
- ### ⚠ BREAKING CHANGES
30
-
31
- * the `JWE.decrypt` option `algorithms` was removed and
32
- replaced with contentEncryptionAlgorithms (handles `enc` allowlist) and
33
- keyManagementAlgorithms (handles `alg` allowlist)
34
- * the `JWT.verify` profile option was removed, use e.g.
35
- `JWT.IdToken.verify` instead.
36
- * removed the `maxAuthAge` `JWT.verify` option, this
37
- option is now only present at the specific JWT profile APIs where the
38
- `auth_time` property applies.
39
- * removed the `nonce` `JWT.verify` option, this
40
- option is now only present at the specific JWT profile APIs where the
41
- `nonce` property applies.
42
- * the `acr`, `amr`, `nonce` and `azp` claim value types
43
- will only be checked when verifying a specific JWT profile using its
44
- dedicated API.
45
- * using the draft implementing APIs will emit a one-time
46
- warning per process using `process.emitWarning`
47
- * `JWT.sign` function options no longer accept a `nonce`
48
- property. To create a JWT with a `nonce` just pass the value to the
49
- payload.
50
- * due to added ESM module support Node.js version with
51
- ESM implementation bugs are no longer supported, this only affects early
52
- v13.x versions. The resulting Node.js semver range is
53
- `>=10.13.0 < 13 || >=13.7.0`
54
- * deprecated method `JWK.importKey` was removed
55
- * deprecated method `JWKS.KeyStore.fromJWKS` was removed
56
- * the use of unregistered curve name P-256K for secp256k1
57
- was removed
58
- * jose.JWE.Encrypt constructor aad and unprotectedHeader
59
- arguments swapped places
60
- * jose.JWE.encrypt.flattened header (unprotectedHeader)
61
- and aad arguments swapped places
62
- * jose.JWE.encrypt.general header (unprotectedHeader)
63
- and aad arguments swapped places
64
- * JWS.verify returned payloads are now always buffers
65
- * JWS.verify options `encoding` and `parse` were removed
66
-
67
- ### Features
68
-
69
- * added support for ESM (ECMAScript modules) ([1aa9035](https://github.com/panva/jose/commit/1aa9035552bbcb34b95e092d0f082cc6d94465ab))
70
- * decrypt allowlists for both key management and content encryption ([30e5c46](https://github.com/panva/jose/commit/30e5c46ecf00a498e65a551ced88bc897531c2a4))
71
-
72
-
73
- ### Bug Fixes
74
-
75
- * **typescript:** allow Buffer when verifying detached signature ([cadbd04](https://github.com/panva/jose/commit/cadbd047ca953d6d8171439f2efd7bb98a5d8e73))
76
- * **typescript:** properly type all decode/verify/decrypt fn options ([4c23bd6](https://github.com/panva/jose/commit/4c23bd65fe6fa634726a5eb73c6d590f7348a97e))
77
-
78
-
79
- ### Refactor
80
-
81
- * encrypt APIs unprotectedHeader and aad arguments swapped ([70bd4ae](https://github.com/panva/jose/commit/70bd4ae6b2e6ba94bbe0b3dc1a17b2990af3a18b))
82
- * move JWT profile specifics outside of generic JWT ([fd69d7f](https://github.com/panva/jose/commit/fd69d7f5093d0b3a231d7d79aa3bca3a8a64464c))
83
- * removed `nonce` option from `JWT.sign` ([c4267cc](https://github.com/panva/jose/commit/c4267cc655bc2721d846c98f8a40640d1a12e9ad))
84
- * removed deprecated methods and utilities ([6c35c51](https://github.com/panva/jose/commit/6c35c519c9181f8246b36ad02572adb609d6de1d))
85
- * removed payload parsing from JWS.verify ([ba5c897](https://github.com/panva/jose/commit/ba5c89791915a2a3cd56b3dab1f3328778152d33))
86
-
87
- ## [1.28.0](https://github.com/panva/jose/compare/v1.27.3...v1.28.0) (2020-08-10)
88
-
89
-
90
- ### Features
91
-
92
- * support for validating issuer from a list of values ([#91](https://github.com/panva/jose/issues/91)) ([ce6836a](https://github.com/panva/jose/commit/ce6836af88c9e73c29560233f15ed1760c7dcc13))
93
-
94
-
95
-
96
- ## [1.27.3](https://github.com/panva/jose/compare/v1.27.2...v1.27.3) (2020-08-04)
97
-
98
-
99
- ### Bug Fixes
100
-
101
- * do not mutate unencoded payload when signing for multiple parties ([1695423](https://github.com/panva/jose/commit/169542363f884e4028db9f80086d631e626eb469)), closes [#89](https://github.com/panva/jose/issues/89)
102
- * ensure "b64" is the same for all recipients edge cases ([d56ec9f](https://github.com/panva/jose/commit/d56ec9f5ddc2612e5ff21fe35d45a56e7153e0e4))
103
-
104
-
105
-
106
- ## [1.27.2](https://github.com/panva/jose/compare/v1.27.1...v1.27.2) (2020-07-01)
107
-
108
-
109
- ### Bug Fixes
110
-
111
- * handle private EC keys without public component ([#86](https://github.com/panva/jose/issues/86)) ([e8ad389](https://github.com/panva/jose/commit/e8ad38993e29747098f7fd1594dde4ce893ba802)), closes [#85](https://github.com/panva/jose/issues/85)
112
-
113
-
114
-
115
- ## [1.27.1](https://github.com/panva/jose/compare/v1.27.0...v1.27.1) (2020-06-01)
116
-
117
-
118
- ### Bug Fixes
119
-
120
- * allow any JSON numeric value for timestamp values ([7ba4922](https://github.com/panva/jose/commit/7ba492237aaf788914166c134d50fb046041efa0))
121
-
122
-
123
-
124
- ## [1.27.0](https://github.com/panva/jose/compare/v1.26.1...v1.27.0) (2020-05-05)
125
-
126
-
127
- ### Features
128
-
129
- * add opt-in objects to verify using embedded JWS Header public keys ([7c1cab1](https://github.com/panva/jose/commit/7c1cab196edc409ec6cc4741bdf7e06c5aaf5dab))
130
-
131
-
132
-
133
- ## [1.26.1](https://github.com/panva/jose/compare/v1.26.0...v1.26.1) (2020-04-27)
134
-
135
-
136
- ### Bug Fixes
137
-
138
- * **typescript:** types of key generate functions without overloads ([7e60722](https://github.com/panva/jose/commit/7e60722ae7054f8acf833e015c22679d56fbc0ca)), closes [#80](https://github.com/panva/jose/issues/80)
139
- * "typ" content-type validation, case insensitive and handled prefix ([0691586](https://github.com/panva/jose/commit/06915861b32c0ae252dcc84791050bc3716ce102))
140
-
141
-
142
-
143
- ## [1.26.0](https://github.com/panva/jose/compare/v1.25.2...v1.26.0) (2020-04-16)
144
-
145
-
146
- ### Features
147
-
148
- * update JWT Profile for OAuth 2.0 Access Tokens to latest draft ([8c0a8a9](https://github.com/panva/jose/commit/8c0a8a950e4503cb7a756589e307286fe1116b05))
149
-
150
-
151
- ### BREAKING CHANGES
152
-
153
- * `at+JWT` JWT draft profile - in the draft's Section 2.2
154
- the claims `iat` and `jti` are now REQUIRED (was RECOMMENDED).
155
-
156
-
157
-
158
- ## [1.25.2](https://github.com/panva/jose/compare/v1.25.1...v1.25.2) (2020-04-15)
159
-
160
-
161
- ### Bug Fixes
162
-
163
- * **build:** don't publish junk files ([6e98c1a](https://github.com/panva/jose/commit/6e98c1a5f994224b9412fc47c4065b468c89fe2c))
164
-
165
-
166
-
167
- ## [1.25.1](https://github.com/panva/jose/compare/v1.25.0...v1.25.1) (2020-04-15)
168
-
169
-
170
- ### Bug Fixes
171
-
172
- * use native openssl AES Key Wrap 🤦 ([dcf8d75](https://github.com/panva/jose/commit/dcf8d75a8aca4f05fe04df64fdd2ba50bbc75bc9))
173
-
174
-
175
-
176
- ## [1.25.0](https://github.com/panva/jose/compare/v1.24.1...v1.25.0) (2020-03-11)
177
-
178
-
179
- ### Features
180
-
181
- * update JWT Profile for OAuth 2.0 Access Tokens to latest draft ([bc77a15](https://github.com/panva/jose/commit/bc77a15fab10f8a29561ef667a923b2f074fa9b3))
182
-
183
-
184
-
185
- ## [1.24.1](https://github.com/panva/jose/compare/v1.24.0...v1.24.1) (2020-03-05)
186
-
187
-
188
- ### Bug Fixes
189
-
190
- * allow importing simpler passphrases as `oct` keys ([f86bda3](https://github.com/panva/jose/commit/f86bda3bb709f29e4264fb8de45242f518128744))
191
-
192
-
193
-
194
- ## [1.24.0](https://github.com/panva/jose/compare/v1.23.0...v1.24.0) (2020-02-25)
195
-
196
-
197
- ### Features
198
-
199
- * add JWT.verify "typ" option for checking JWT Type Header parameter ([fc08426](https://github.com/panva/jose/commit/fc08426466233709b442ba21232768ddeeb94e56))
200
-
201
-
202
-
203
- ## [1.23.0](https://github.com/panva/jose/compare/v1.22.2...v1.23.0) (2020-02-18)
204
-
205
-
206
- ### Bug Fixes
207
-
208
- * **typescript:** add optional JWK.Key props and make them readonly ([b92079c](https://github.com/panva/jose/commit/b92079cb64216b8ea91082adc07ac03972dbbb0e)), closes [#67](https://github.com/panva/jose/issues/67)
209
-
210
-
211
- ### Features
212
-
213
- * add ECDH-ES with X25519 and X448 OKP keys ([38369ea](https://github.com/panva/jose/commit/38369ea3d72812abe7ecebd6dc7da164b0a2e29d))
214
- * add RSA-OAEP-384 and RSA-OAEP-512 JWE Key Management Algorithms ([7477f08](https://github.com/panva/jose/commit/7477f0831b38765a9a916b35b1d40aaf11f0e6b8))
215
-
216
-
217
-
218
- ## [1.22.2](https://github.com/panva/jose/compare/v1.22.1...v1.22.2) (2020-02-06)
219
-
220
-
221
- ### Performance Improvements
222
-
223
- * various codepaths refactored ([3e3d7dd](https://github.com/panva/jose/commit/3e3d7dd38168159e188e54c48a9f83e3a02a8fe1))
224
-
225
-
226
-
227
- ## [1.22.1](https://github.com/panva/jose/compare/v1.22.0...v1.22.1) (2020-02-03)
228
-
229
-
230
- ### Bug Fixes
231
-
232
- * actually remove the base64url proper encoding check ([eae01b5](https://github.com/panva/jose/commit/eae01b57ab9f33e8c621ffcd2a77d513a51d22b2))
233
-
234
-
235
-
236
- ## [1.22.0](https://github.com/panva/jose/compare/v1.21.1...v1.22.0) (2020-01-29)
237
-
238
-
239
- ### Features
240
-
241
- * keystore filtering by JWK Key thumbprint ([a9f6f71](https://github.com/panva/jose/commit/a9f6f7135005d6231d6f42d95c02414139a89d17))
242
-
243
-
244
- ### Performance Improvements
245
-
246
- * base64url decode, JWT.verify, JWK.Key instance re-use ([470b4c7](https://github.com/panva/jose/commit/470b4c73154e1fcf8b92726d521940e5e11c9d94))
247
-
248
-
249
-
250
- ## [1.21.1](https://github.com/panva/jose/compare/v1.21.0...v1.21.1) (2020-01-25)
251
-
252
-
253
- ### Bug Fixes
254
-
255
- * contactKDF iteration count fixed for key sizes larger than 256 bits ([70ff222](https://github.com/panva/jose/commit/70ff22227ad303e57228dc8351688531499a833a))
256
-
257
-
258
-
259
- ## [1.21.0](https://github.com/panva/jose/compare/v1.20.0...v1.21.0) (2020-01-23)
260
-
261
-
262
- ### Bug Fixes
263
-
264
- * **typescript:** don't expose non existant classes, fix decode key ([0f8bf88](https://github.com/panva/jose/commit/0f8bf886da1b5d02cd0d968d0ec02a58673df258))
265
-
266
-
267
- ### Features
268
-
269
- * add opt-in support for Unsecured JWS algorithm "none" ([3a6d17f](https://github.com/panva/jose/commit/3a6d17fdd18d8bbd074c07c2dd08f0406c16a8f1))
270
-
271
-
272
-
273
- ## [1.20.0](https://github.com/panva/jose/compare/v1.19.0...v1.20.0) (2020-01-16)
274
-
275
-
276
- ### Features
277
-
278
- * add JWTExpired error and JWTClaimInvalid claim and reason props ([a0c0c7a](https://github.com/panva/jose/commit/a0c0c7ad70f42d9b23b3e71de43599a8ac6fe1ff)), closes [#62](https://github.com/panva/jose/issues/62)
279
-
280
-
281
-
282
- ## [1.19.0](https://github.com/panva/jose/compare/v1.18.2...v1.19.0) (2020-01-13)
283
-
284
-
285
- ### Features
286
-
287
- * exposed shorthands for JWT verification profiles ([b1864e3](https://github.com/panva/jose/commit/b1864e319d1a7a42eadfa0c4b0145952e7814726))
288
-
289
-
290
-
291
- ## [1.18.2](https://github.com/panva/jose/compare/v1.18.1...v1.18.2) (2020-01-08)
292
-
293
-
294
- ### Bug Fixes
295
-
296
- * ensure asn1.js version to remove Buffer deprecation notice ([13b1106](https://github.com/panva/jose/commit/13b1106048fdeae00b09d54f05245dded85b14a7))
297
- * expose JOSENotSupported key import errors on unsupported runtimes ([bc81e5d](https://github.com/panva/jose/commit/bc81e5dec2987f6ce6dc3fa5daa23dfe620c0a34))
298
- * typo in JOSENotSupported error when x509 certs are not supported ([bb58c9c](https://github.com/panva/jose/commit/bb58c9ce52e807ca4cfad6bcbf1ab96b91778b1f))
299
-
300
-
301
-
302
- ## [1.18.1](https://github.com/panva/jose/compare/v1.18.0...v1.18.1) (2020-01-01)
303
-
304
-
305
- ### Bug Fixes
306
-
307
- * force iat past check when maxTokenAge option is used + JWT refactor ([828ad5a](https://github.com/panva/jose/commit/828ad5a33dc0cc0049923b69f43f97463295456e))
308
-
309
-
310
-
311
- ## [1.18.0](https://github.com/panva/jose/compare/v1.17.2...v1.18.0) (2019-12-31)
312
-
313
-
314
- ### Features
315
-
316
- * add JWT validation profiles for Access Tokens and Logout Tokens ([7bb5c95](https://github.com/panva/jose/commit/7bb5c953a9c6d9bd915e8ebc0608bc0649427745))
317
-
318
-
319
-
320
- ## [1.17.2](https://github.com/panva/jose/compare/v1.17.1...v1.17.2) (2019-12-17)
321
-
322
-
323
- ### Bug Fixes
324
-
325
- * skip validating iat is in the past when exp is present ([0ed5025](https://github.com/panva/jose/commit/0ed5025de30a754de95ae2587ce0f4573909b006))
326
-
327
-
328
-
329
- ## [1.17.1](https://github.com/panva/jose/compare/v1.17.0...v1.17.1) (2019-12-10)
330
-
331
-
332
- ### Bug Fixes
333
-
334
- * properly fail to import unsupported openssh keys ([bee5744](https://github.com/panva/jose/commit/bee574457f29597ccab09d51ac61b85dd7a7146a))
335
-
336
-
337
-
338
- ## [1.17.0](https://github.com/panva/jose/compare/v1.16.2...v1.17.0) (2019-12-10)
339
-
340
-
341
- ### Features
342
-
343
- * importing a certificate populates x5c and x5t thumbprints ([25a7a71](https://github.com/panva/jose/commit/25a7a71915c4f7514536cec9e7e162d0ad3b670c)), closes [#59](https://github.com/panva/jose/issues/59)
344
-
345
-
346
-
347
- ## [1.16.2](https://github.com/panva/jose/compare/v1.16.1...v1.16.2) (2019-12-05)
348
-
349
-
350
- ### Bug Fixes
351
-
352
- * handle Unencoded Payload (b64:false) with arbitrary buffer payloads ([daabedc](https://github.com/panva/jose/commit/daabedc776617f4fde427b3a5e79d8c176293132)), closes [#57](https://github.com/panva/jose/issues/57)
353
-
354
-
355
-
356
- ## [1.16.1](https://github.com/panva/jose/compare/v1.16.0...v1.16.1) (2019-12-05)
357
-
358
-
359
- ### Bug Fixes
360
-
361
- * allow PBES2 for the correct JWK `use` values ([f0d7194](https://github.com/panva/jose/commit/f0d719416ec9ca041ea88b8a983b5d899a6aa107))
362
-
363
-
364
-
365
- ## [1.16.0](https://github.com/panva/jose/compare/v1.15.1...v1.16.0) (2019-12-04)
366
-
367
-
368
- ### Features
369
-
370
- * two official jose plugins/extensions for those living on the edge ([5b27c97](https://github.com/panva/jose/commit/5b27c97ac8836ffa9f3880e009c8db5afbfbaa2c)), closes [#56](https://github.com/panva/jose/issues/56)
371
-
372
-
373
-
374
- ## [1.15.1](https://github.com/panva/jose/compare/v1.15.0...v1.15.1) (2019-11-30)
375
-
376
-
377
- ### Bug Fixes
378
-
379
- * **typescript:** export Key Input types ([0277fcd](https://github.com/panva/jose/commit/0277fcd1896af497e79190212b0719f7e62366c1))
380
-
381
-
382
-
383
- ## [1.15.0](https://github.com/panva/jose/compare/v1.14.0...v1.15.0) (2019-11-27)
384
-
385
-
386
- ### Bug Fixes
387
-
388
- * default JWT.sign `kid` option value is false for HMAC signatures ([ce77388](https://github.com/panva/jose/commit/ce7738825403f8cdb8f99cb51c096baf0dfa3af7))
389
-
390
-
391
- ### Features
392
-
393
- * allow JWK.asKey inputs for sign/verify/encrypt/decrypt operations ([5e1009a](https://github.com/panva/jose/commit/5e1009a63e4bc829009cc46d6295c00f8431024c))
394
-
395
-
396
-
397
- ## [1.14.0](https://github.com/panva/jose/compare/v1.13.0...v1.14.0) (2019-11-26)
398
-
399
-
400
- ### Features
401
-
402
- * allow JWKS.KeyStore .all and .get to filter for key curves ([ea60338](https://github.com/panva/jose/commit/ea60338ca6f58f2626992a38da76812477ce4540))
403
-
404
-
405
-
406
- ## [1.13.0](https://github.com/panva/jose/compare/v1.12.1...v1.13.0) (2019-11-23)
407
-
408
-
409
- ### Features
410
-
411
- * return the CEK from JWE.decrypt operation with { complete: true } ([c3eb845](https://github.com/panva/jose/commit/c3eb8450b98b2f5ecc127d69afe85a7ae2cc5aaa))
412
-
413
-
414
-
415
- ## [1.12.1](https://github.com/panva/jose/compare/v1.12.0...v1.12.1) (2019-11-14)
416
-
417
-
418
-
419
- ## [1.12.0](https://github.com/panva/jose/compare/v1.11.0...v1.12.0) (2019-11-05)
420
-
421
-
422
- ### Features
423
-
424
- * add JWS.verify encoding and parsing options ([6bb66d4](https://github.com/panva/jose/commit/6bb66d4f0b4c96f2da8ac5f14fda6bc4f53f2994))
425
-
426
-
427
-
428
- ## [1.11.0](https://github.com/panva/jose/compare/v1.10.2...v1.11.0) (2019-11-03)
429
-
430
-
431
- ### Features
432
-
433
- * expose crypto.KeyObject instances in supported runtimes ([8ea9683](https://github.com/panva/jose/commit/8ea968312e97ed0f992fab909a20e7993159ec45))
434
-
435
-
436
-
437
- ## [1.10.2](https://github.com/panva/jose/compare/v1.10.1...v1.10.2) (2019-10-29)
438
-
439
-
440
- ### Bug Fixes
441
-
442
- * only use secp256k1 keys for signing/verification ([9588223](https://github.com/panva/jose/commit/95882232d6d409a321b6a8c168f5b78ebbdabf95))
443
-
444
-
445
-
446
- ## [1.10.1](https://github.com/panva/jose/compare/v1.10.0...v1.10.1) (2019-10-04)
447
-
448
-
449
- ### Bug Fixes
450
-
451
- * throw proper error when runtime doesn't support OKP ([0a16efb](https://github.com/panva/jose/commit/0a16efb)), closes [#48](https://github.com/panva/jose/issues/48)
452
-
453
-
454
-
455
- ## [1.10.0](https://github.com/panva/jose/compare/v1.9.2...v1.10.0) (2019-10-01)
456
-
457
-
458
- ### Features
459
-
460
- * rename package ([26f4cf2](https://github.com/panva/jose/commit/26f4cf2))
461
-
462
-
463
-
464
- ## [1.9.2](https://github.com/panva/jose/compare/v1.9.1...v1.9.2) (2019-09-16)
465
-
466
-
467
- ### Bug Fixes
468
-
469
- * keystore.toJWKS(true) does not throw on public keys ([81abdfa](https://github.com/panva/jose/commit/81abdfa)), closes [#42](https://github.com/panva/jose/issues/42)
470
-
471
-
472
-
473
- ## [1.9.1](https://github.com/panva/jose/compare/v1.9.0...v1.9.1) (2019-09-10)
474
-
475
-
476
-
477
- ## [1.9.0](https://github.com/panva/jose/compare/v1.8.0...v1.9.0) (2019-08-24)
478
-
479
-
480
- ### Features
481
-
482
- * allow JWKS.asKeyStore to swallow errors ([78398d3](https://github.com/panva/jose/commit/78398d3))
483
-
484
-
485
-
486
- ## [1.8.0](https://github.com/panva/jose/compare/v1.7.0...v1.8.0) (2019-08-22)
487
-
488
-
489
- ### Features
490
-
491
- * added Node.js lts/dubnium support for runtime supported features ([67a8601](https://github.com/panva/jose/commit/67a8601))
492
-
493
-
494
-
495
- ## [1.7.0](https://github.com/panva/jose/compare/v1.6.1...v1.7.0) (2019-08-20)
496
-
497
-
498
- ### Features
499
-
500
- * add RSA-OAEP-256 support (when a node version supports it) ([28d7cf8](https://github.com/panva/jose/commit/28d7cf8)), closes [#29](https://github.com/panva/jose/issues/29)
501
-
502
-
503
-
504
- ## [1.6.1](https://github.com/panva/jose/compare/v1.6.0...v1.6.1) (2019-07-29)
505
-
506
-
507
- ### Bug Fixes
508
-
509
- * properly pad calculated RSA primes ([dd121ce](https://github.com/panva/jose/commit/dd121ce))
510
-
511
-
512
-
513
- ## [1.6.0](https://github.com/panva/jose/compare/v1.5.2...v1.6.0) (2019-07-27)
514
-
515
-
516
- ### Bug Fixes
517
-
518
- * use the correct ECPrivateKey version when importing EC JWK ([24acd20](https://github.com/panva/jose/commit/24acd20))
519
-
520
-
521
- ### Features
522
-
523
- * electron v6.x support ([e7ad82c](https://github.com/panva/jose/commit/e7ad82c))
524
-
525
-
526
-
527
- ## [1.5.2](https://github.com/panva/jose/compare/v1.5.1...v1.5.2) (2019-07-27)
528
-
529
-
530
- ### Bug Fixes
531
-
532
- * importing x5c in electron requires the input split ([181fd09](https://github.com/panva/jose/commit/181fd09))
533
-
534
-
535
-
536
- ## [1.5.1](https://github.com/panva/jose/compare/v1.5.0...v1.5.1) (2019-07-27)
537
-
538
-
539
- ### Bug Fixes
540
-
541
- * correctly pad integers when importing RSA JWK ([1dc7f35](https://github.com/panva/jose/commit/1dc7f35))
542
-
543
-
544
-
545
- ## [1.5.0](https://github.com/panva/jose/compare/v1.4.1...v1.5.0) (2019-07-23)
546
-
547
-
548
- ### Features
549
-
550
- * validate JWTs according to a JWT profile - ID Token ([6c98b61](https://github.com/panva/jose/commit/6c98b61))
551
-
552
-
553
-
554
- ## [1.4.1](https://github.com/panva/jose/compare/v1.4.0...v1.4.1) (2019-07-14)
555
-
556
-
557
- ### Bug Fixes
558
-
559
- * honour the JWT.sign `jti` option ([36c9ce2](https://github.com/panva/jose/commit/36c9ce2)), closes [#33](https://github.com/panva/jose/issues/33)
560
-
561
-
562
-
563
- ## [1.4.0](https://github.com/panva/jose/compare/v1.3.0...v1.4.0) (2019-07-08)
564
-
565
-
566
- ### Features
567
-
568
- * add secp256k1 EC Key curve and ES256K ([211d7af](https://github.com/panva/jose/commit/211d7af))
569
-
570
-
571
-
572
- ## [1.3.0](https://github.com/panva/jose/compare/v1.0.2...c51dc28) (2019-06-21)
573
-
574
-
575
- ### Features
576
-
577
- * compute private RSA key p, q, dp, dq, qi when omitted ([6e3d6fd](https://github.com/panva/jose/commit/6e3d6fd)), closes [#26](https://github.com/panva/jose/issues/26)
578
- * add support for JWK x5c, x5t and x5t#S256 ([9d46c48](https://github.com/panva/jose/commit/9d46c48))
579
- * instances of JWKS.KeyStore are now iterable (e.g. for ... of) ([2eae293](https://github.com/panva/jose/commit/2eae293))
580
-
581
- ### Bug Fixes
582
-
583
- * limit calculation of missing RSA private components ([5b53cb0](https://github.com/panva/jose/commit/5b53cb0))
584
- * reject rsa keys without all factors and exponents with a specific message ([b0ff436](https://github.com/panva/jose/commit/b0ff436))
585
-
586
- ### Deprecations
587
-
588
- - this deprecates the use of `JWK.importKey` in favor of
589
- `JWK.asKey`
590
- - this deprecates the use of `JWKS.KeyStore.fromJWKS` in favor of
591
- `JWKS.asKeyStore`
592
-
593
- Both `JWK.importKey` and `JWKS.KeyStore.fromJWKS` could have resulted
594
- in the process getting blocked when large bitsize RSA private keys
595
- were missing their components and could also result in an endless
596
- calculation loop when the private key's private exponent was outright
597
- invalid or tampered with.
598
-
599
- The new methods still allow to import private RSA keys with these
600
- optimization key parameters missing but it is disabled by default and one
601
- should choose to enable it when working with keys from trusted sources
602
-
603
- It is recommended not to use `jose` versions with this feature in
604
- its original on-by-default form - v1.1.0 and v1.2.0
605
-
606
-
607
-
608
- ## [1.0.2](https://github.com/panva/jose/compare/v1.0.1...v1.0.2) (2019-05-13)
609
-
610
-
611
- ### Bug Fixes
612
-
613
- * add missing keystore.toJWKS() .d.ts definition ([c7a8606](https://github.com/panva/jose/commit/c7a8606)), closes [#25](https://github.com/panva/jose/issues/25)
614
-
615
-
616
-
617
- ## [1.0.1](https://github.com/panva/jose/compare/v1.0.0...v1.0.1) (2019-04-27)
618
-
619
-
620
- ### Bug Fixes
621
-
622
- * oct key ts "k" type fix ([0750d2c](https://github.com/panva/jose/commit/0750d2c))
623
-
624
-
625
-
626
- ## [1.0.0](https://github.com/panva/jose/compare/v0.12.0...v1.0.0) (2019-04-23)
627
-
628
-
629
- ### Bug Fixes
630
-
631
- * fail to import invalid PEM formatted strings and buffers ([857dc2b](https://github.com/panva/jose/commit/857dc2b))
632
-
633
-
634
- ### Features
635
-
636
- * add JWK key_ops support, fix .algorithms() op returns ([23b874c](https://github.com/panva/jose/commit/23b874c))
637
- * add key.toPEM() export function with optional encryption ([1159b0d](https://github.com/panva/jose/commit/1159b0d))
638
- * add OKP Key and EdDSA sign/verify support ([2dbd3ed](https://github.com/panva/jose/commit/2dbd3ed)), closes [#12](https://github.com/panva/jose/issues/12)
639
-
640
-
641
- ### BREAKING CHANGES
642
-
643
- * key.algorithms(op) un+wrapKey was split into correct
644
- wrapKey/unwrapKey/deriveKey returns
645
- * keystore.all and keystore.get `operation` option was
646
- removed, `key_ops: string[]` supersedes it
647
- * Node.js minimal version is now v12.0.0 due to its
648
- added EdDSA support (crypto.sign, crypto.verify and eddsa key objects)
649
-
650
-
651
-
652
- ## [0.12.0](https://github.com/panva/jose/compare/v0.11.5...v0.12.0) (2019-04-07)
653
-
654
-
655
- ### Reverts
656
-
657
- * add EC P-256K JWK and ES256K sign/verify support ([e21fea1](https://github.com/panva/jose/commit/e21fea1))
658
-
659
-
660
- ### BREAKING CHANGES
661
-
662
- * removing ES256K alg and EC P-256K crv support until the
663
- IETF WG decides on what the final names will be.
664
-
665
-
666
-
667
- ## [0.11.5](https://github.com/panva/jose/compare/v0.11.4...v0.11.5) (2019-04-04)
668
-
669
-
670
- ### Features
671
-
672
- * add key.secret<boolean> and key.type<string> for completeness ([2dd7053](https://github.com/panva/jose/commit/2dd7053))
673
- * add key.thumbprint always returning the JWK Thumbprint (RFC7638) ([65db7e0](https://github.com/panva/jose/commit/65db7e0))
674
-
675
-
676
-
677
- ## [0.11.4](https://github.com/panva/jose/compare/v0.11.3...v0.11.4) (2019-03-28)
678
-
679
-
680
- ### Bug Fixes
681
-
682
- * properly restrict EC curves in generate(Sync) ([764b863](https://github.com/panva/jose/commit/764b863))
683
- * remove unintended exposure of private material via enumerables ([946d9df](https://github.com/panva/jose/commit/946d9df))
684
-
685
-
686
-
687
- ## [0.11.3](https://github.com/panva/jose/compare/v0.11.2...v0.11.3) (2019-03-27)
688
-
689
-
690
- ### Bug Fixes
691
-
692
- * throw on unsupported EC curves ([cfa4222](https://github.com/panva/jose/commit/cfa4222))
693
-
694
-
695
- ### Features
696
-
697
- * add EC P-256K JWK and ES256K sign/verify support ([2e33e1c](https://github.com/panva/jose/commit/2e33e1c))
698
-
699
-
700
-
701
- ## [0.11.2](https://github.com/panva/jose/compare/v0.11.1...v0.11.2) (2019-03-19)
702
-
703
-
704
- ### Bug Fixes
705
-
706
- * internal symbol method is now really a symbol ([925d47c](https://github.com/panva/jose/commit/925d47c))
707
- * key.toJWK() fixed on windows ([57f1692](https://github.com/panva/jose/commit/57f1692)), closes [#17](https://github.com/panva/jose/issues/17)
708
-
709
-
710
- ## [0.11.1](https://github.com/panva/jose/compare/v0.11.0...v0.11.1) (2019-03-17)
711
-
712
-
713
- ### Bug Fixes
714
-
715
- * restrict RS key algorithms by the key's bit size ([9af295b](https://github.com/panva/jose/commit/9af295b))
716
-
717
-
718
- ## [0.11.0](https://github.com/panva/jose/compare/v0.10.0...v0.11.0) (2019-03-16)
719
-
720
-
721
- ### Bug Fixes
722
-
723
- * all JWA defined RSA operations require key of 2048 or more ([cc70c5d](https://github.com/panva/jose/commit/cc70c5d))
724
- * use correct salt length for RSASSA-PSS ([e936d54](https://github.com/panva/jose/commit/e936d54))
725
-
726
-
727
- ### BREAKING CHANGES
728
-
729
- * all [JWA](https://tools.ietf.org/html/rfc7518) defined
730
- RSA based operations require key size of 2048 bits or more.
731
-
732
-
733
-
734
- ## [0.10.0](https://github.com/panva/jose/compare/v0.9.2...v0.10.0) (2019-03-12)
735
-
736
-
737
- ### Bug Fixes
738
-
739
- * do not list "dir" under wrap/unwrapKey operations ([17b37d3](https://github.com/panva/jose/commit/17b37d3))
740
-
741
-
742
- ### Features
743
-
744
- * keystore .all and .get operation option ([d349ba9](https://github.com/panva/jose/commit/d349ba9))
745
-
746
-
747
- ### BREAKING CHANGES
748
-
749
- * "dir" is no longer returned as wrap/unwrapKey key
750
- operation
751
-
752
-
753
-
754
- ## [0.9.2](https://github.com/panva/jose/compare/v0.9.1...v0.9.2) (2019-03-05)
755
-
756
-
757
- ### Bug Fixes
758
-
759
- * "dir" is only available on keys with correct lengths ([6854860](https://github.com/panva/jose/commit/6854860))
760
- * do not 'in' operator when importing keys as string ([be3f4e4](https://github.com/panva/jose/commit/be3f4e4))
761
-
762
-
763
-
764
- ## [0.9.1](https://github.com/panva/jose/compare/v0.9.0...v0.9.1) (2019-03-02)
765
-
766
-
767
- ### Bug Fixes
768
-
769
- * only import RSA, EC and oct successfully ([e5e02fc](https://github.com/panva/jose/commit/e5e02fc))
770
-
771
-
772
- # 0.9.0 (2019-03-02)
773
-
774
- Initial release
775
-
776
- ### Implemented Features
777
-
778
- - JSON Web Signature (JWS) - [RFC7515][spec-jws]
779
- - JSON Web Encryption (JWE) - [RFC7516][spec-jwe]
780
- - JSON Web Key (JWK) - [RFC7517][spec-jwk]
781
- - JSON Web Algorithms (JWA) - [RFC7518][spec-jwa]
782
- - JSON Web Token (JWT) - [RFC7519][spec-jwt]
783
- - JSON Web Key (JWK) Thumbprint - [RFC7638][spec-thumbprint]
784
- - JWS Unencoded Payload Option - [RFC7797][spec-b64]
785
-
786
- | JWK Key Types | Supported ||
787
- | -- | -- | -- |
788
- | RSA | ✓ | RSA |
789
- | Elliptic Curve | ✓ | EC |
790
- | Octet sequence | ✓ | oct |
791
-
792
- | Serialization | JWS Sign | JWS Verify | JWE Encrypt | JWE Decrypt |
793
- | -- | -- | -- | -- | -- |
794
- | Compact | ✓ | ✓ | ✓ | ✓ |
795
- | General JSON | ✓ | ✓ | ✓ | ✓ |
796
- | Flattened JSON | ✓ | ✓ | ✓ | ✓ |
797
-
798
- | JWS Algorithms | Supported ||
799
- | -- | -- | -- |
800
- | RSASSA-PKCS1-v1_5 | ✓ | RS256, RS384, RS512 |
801
- | RSASSA-PSS | ✓ | PS256, PS384, PS512 |
802
- | ECDSA | ✓ | ES256, ES384, ES512 |
803
- | HMAC with SHA-2 | ✓ | HS256, HS384, HS512 |
804
-
805
- | JWE Key Management Algorithms | Supported ||
806
- | -- | -- | -- |
807
- | AES | ✓ | A128KW, A192KW, A256KW |
808
- | AES GCM | ✓ | A128GCMKW, A192GCMKW, A256GCMKW |
809
- | Direct Key Agreement | ✓ | dir |
810
- | 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> |
811
- | RSAES-PKCS1-v1_5 | ✓ | RSA1_5 |
812
- | PBES2 | ✓ | PBES2-HS256+A128KW, PBES2-HS384+A192KW, PBES2-HS512+A256KW |
813
- | ECDH-ES | ✓ | ECDH-ES, ECDH-ES+A128KW, ECDH-ES+A192KW, ECDH-ES+A256KW |
814
-
815
- | JWE Content Encryption Algorithms | Supported ||
816
- | -- | -- | -- |
817
- | AES GCM | ✓ | A128GCM, A192GCM, A256GCM |
818
- | AES_CBC_HMAC_SHA2 | ✓ | A128CBC-HS256, A192CBC-HS384, A256CBC-HS512 |
819
-
820
- [spec-b64]: https://tools.ietf.org/html/rfc7797
821
- [spec-jwa]: https://tools.ietf.org/html/rfc7518
822
- [spec-jwe]: https://tools.ietf.org/html/rfc7516
823
- [spec-jwk]: https://tools.ietf.org/html/rfc7517
824
- [spec-jws]: https://tools.ietf.org/html/rfc7515
825
- [spec-jwt]: https://tools.ietf.org/html/rfc7519
826
- [spec-thumbprint]: https://tools.ietf.org/html/rfc7638