wow
This commit is contained in:
-476
@@ -1,476 +0,0 @@
|
||||
# Change Log
|
||||
|
||||
|
||||
All notable changes to this project will be documented in this file starting from version **v4.0.0**.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 8.5.1 - 2019-03-18
|
||||
|
||||
### Bug fix
|
||||
|
||||
- fix: ensure correct PS signing and verification (#585) ([e5874ae428ffc0465e6bd4e660f89f78b56a74a6](https://github.com/auth0/node-jsonwebtoken/commit/e5874ae428ffc0465e6bd4e660f89f78b56a74a6)), closes [#585](https://github.com/auth0/node-jsonwebtoken/issues/585)
|
||||
|
||||
### Docs
|
||||
|
||||
- README: fix markdown for algorithms table ([84e03ef70f9c44a3aef95a1dc122c8238854f683](https://github.com/auth0/node-jsonwebtoken/commit/84e03ef70f9c44a3aef95a1dc122c8238854f683))
|
||||
|
||||
## 8.5.0 - 2019-02-20
|
||||
|
||||
### New Functionality
|
||||
|
||||
- feat: add PS JWA support for applicable node versions (#573) ([eefb9d9c6eec54718fa6e41306bda84788df7bec](https://github.com/auth0/node-jsonwebtoken/commit/eefb9d9c6eec54718fa6e41306bda84788df7bec)), closes [#573](https://github.com/auth0/node-jsonwebtoken/issues/573)
|
||||
- Add complete option in jwt.verify (#522) ([8737789dd330cf9e7870f4df97fd52479adbac22](https://github.com/auth0/node-jsonwebtoken/commit/8737789dd330cf9e7870f4df97fd52479adbac22)), closes [#522](https://github.com/auth0/node-jsonwebtoken/issues/522)
|
||||
|
||||
### Test Improvements
|
||||
|
||||
- Add tests for private claims in the payload (#555) ([5147852896755dc1291825e2e40556f964411fb2](https://github.com/auth0/node-jsonwebtoken/commit/5147852896755dc1291825e2e40556f964411fb2)), closes [#555](https://github.com/auth0/node-jsonwebtoken/issues/555)
|
||||
- Force use_strict during testing (#577) ([7b60c127ceade36c33ff33be066e435802001c94](https://github.com/auth0/node-jsonwebtoken/commit/7b60c127ceade36c33ff33be066e435802001c94)), closes [#577](https://github.com/auth0/node-jsonwebtoken/issues/577)
|
||||
- Refactor tests related to jti and jwtid (#544) ([7eebbc75ab89e01af5dacf2aae90fe05a13a1454](https://github.com/auth0/node-jsonwebtoken/commit/7eebbc75ab89e01af5dacf2aae90fe05a13a1454)), closes [#544](https://github.com/auth0/node-jsonwebtoken/issues/544)
|
||||
- ci: remove nsp from tests (#569) ([da8f55c3c7b4dd0bfc07a2df228500fdd050242a](https://github.com/auth0/node-jsonwebtoken/commit/da8f55c3c7b4dd0bfc07a2df228500fdd050242a)), closes [#569](https://github.com/auth0/node-jsonwebtoken/issues/569)
|
||||
|
||||
### Docs
|
||||
|
||||
- Fix 'cert' token which isn't a cert (#554) ([0c24fe68cd2866cea6322016bf993cd897fefc98](https://github.com/auth0/node-jsonwebtoken/commit/0c24fe68cd2866cea6322016bf993cd897fefc98)), closes [#554](https://github.com/auth0/node-jsonwebtoken/issues/554)
|
||||
|
||||
|
||||
## 8.4.0 - 2018-11-14
|
||||
|
||||
### New Functionality
|
||||
|
||||
- Add verify option for nonce validation (#540) ([e7938f06fdf2ed3aa88745b72b8ae4ee66c2d0d0](https://github.com/auth0/node-jsonwebtoken/commit/e7938f06fdf2ed3aa88745b72b8ae4ee66c2d0d0)), closes [#540](https://github.com/auth0/node-jsonwebtoken/issues/540)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Updating Node version in Engines spec in package.json (#528) ([cfd1079305170a897dee6a5f55039783e6ee2711](https://github.com/auth0/node-jsonwebtoken/commit/cfd1079305170a897dee6a5f55039783e6ee2711)), closes [#528](https://github.com/auth0/node-jsonwebtoken/issues/528) [#509](https://github.com/auth0/node-jsonwebtoken/issues/509)
|
||||
- Fixed error message when empty string passed as expiresIn or notBefore option (#531) ([7f9604ac98d4d0ff8d873c3d2b2ea64bd285cb76](https://github.com/auth0/node-jsonwebtoken/commit/7f9604ac98d4d0ff8d873c3d2b2ea64bd285cb76)), closes [#531](https://github.com/auth0/node-jsonwebtoken/issues/531)
|
||||
|
||||
### Docs
|
||||
|
||||
- Update README.md (#527) ([b76f2a80f5229ee5cde321dd2ff14aa5df16d283](https://github.com/auth0/node-jsonwebtoken/commit/b76f2a80f5229ee5cde321dd2ff14aa5df16d283)), closes [#527](https://github.com/auth0/node-jsonwebtoken/issues/527)
|
||||
- Update README.md (#538) ([1956c4006472fd285b8a85074257cbdbe9131cbf](https://github.com/auth0/node-jsonwebtoken/commit/1956c4006472fd285b8a85074257cbdbe9131cbf)), closes [#538](https://github.com/auth0/node-jsonwebtoken/issues/538)
|
||||
- Edited the README.md to make certain parts of the document for the api easier to read, emphasizing the examples. (#548) ([dc89a641293d42f72ecfc623ce2eabc33954cb9d](https://github.com/auth0/node-jsonwebtoken/commit/dc89a641293d42f72ecfc623ce2eabc33954cb9d)), closes [#548](https://github.com/auth0/node-jsonwebtoken/issues/548)
|
||||
- Document NotBeforeError (#529) ([29cd654b956529e939ae8f8c30b9da7063aad501](https://github.com/auth0/node-jsonwebtoken/commit/29cd654b956529e939ae8f8c30b9da7063aad501)), closes [#529](https://github.com/auth0/node-jsonwebtoken/issues/529)
|
||||
|
||||
### Test Improvements
|
||||
|
||||
- Use lolex for faking date in tests (#491) ([677ead6d64482f2067b11437dda07309abe73cfa](https://github.com/auth0/node-jsonwebtoken/commit/677ead6d64482f2067b11437dda07309abe73cfa)), closes [#491](https://github.com/auth0/node-jsonwebtoken/issues/491)
|
||||
- Update dependencies used for running tests (#518) ([5498bdc4865ffb2ba2fd44d889fad7e83873bb33](https://github.com/auth0/node-jsonwebtoken/commit/5498bdc4865ffb2ba2fd44d889fad7e83873bb33)), closes [#518](https://github.com/auth0/node-jsonwebtoken/issues/518)
|
||||
- Minor test refactoring for recently added tests (#504) ([e2860a9d2a412627d79741a95bc7159971b923b9](https://github.com/auth0/node-jsonwebtoken/commit/e2860a9d2a412627d79741a95bc7159971b923b9)), closes [#504](https://github.com/auth0/node-jsonwebtoken/issues/504)
|
||||
- Create and implement async/sync test helpers (#523) ([683d8a9b31ad6327948f84268bd2c8e4350779d1](https://github.com/auth0/node-jsonwebtoken/commit/683d8a9b31ad6327948f84268bd2c8e4350779d1)), closes [#523](https://github.com/auth0/node-jsonwebtoken/issues/523)
|
||||
- Refactor tests related to audience and aud (#503) ([53d405e0223cce7c83cb51ecf290ca6bec1e9679](https://github.com/auth0/node-jsonwebtoken/commit/53d405e0223cce7c83cb51ecf290ca6bec1e9679)), closes [#503](https://github.com/auth0/node-jsonwebtoken/issues/503)
|
||||
- Refactor tests related to expiresIn and exp (#501) ([72f0d9e5b11a99082250665d1200c58182903fa6](https://github.com/auth0/node-jsonwebtoken/commit/72f0d9e5b11a99082250665d1200c58182903fa6)), closes [#501](https://github.com/auth0/node-jsonwebtoken/issues/501)
|
||||
- Refactor tests related to iat and maxAge (#507) ([877bd57ab2aca9b7d230805b21f921baed3da169](https://github.com/auth0/node-jsonwebtoken/commit/877bd57ab2aca9b7d230805b21f921baed3da169)), closes [#507](https://github.com/auth0/node-jsonwebtoken/issues/507)
|
||||
- Refactor tests related to iss and issuer (#543) ([0906a3fa80f52f959ac1b6343d3024ce5c7e9dea](https://github.com/auth0/node-jsonwebtoken/commit/0906a3fa80f52f959ac1b6343d3024ce5c7e9dea)), closes [#543](https://github.com/auth0/node-jsonwebtoken/issues/543)
|
||||
- Refactor tests related to kid and keyid (#545) ([88645427a0adb420bd3e149199a2a6bf1e17277e](https://github.com/auth0/node-jsonwebtoken/commit/88645427a0adb420bd3e149199a2a6bf1e17277e)), closes [#545](https://github.com/auth0/node-jsonwebtoken/issues/545)
|
||||
- Refactor tests related to notBefore and nbf (#497) ([39adf87a6faef3df984140f88e6724ddd709fd89](https://github.com/auth0/node-jsonwebtoken/commit/39adf87a6faef3df984140f88e6724ddd709fd89)), closes [#497](https://github.com/auth0/node-jsonwebtoken/issues/497)
|
||||
- Refactor tests related to subject and sub (#505) ([5a7fa23c0b4ac6c25304dab8767ef840b43a0eca](https://github.com/auth0/node-jsonwebtoken/commit/5a7fa23c0b4ac6c25304dab8767ef840b43a0eca)), closes [#505](https://github.com/auth0/node-jsonwebtoken/issues/505)
|
||||
- Implement async/sync tests for exp claim (#536) ([9ae3f207ac64b7450ea0a3434418f5ca58d8125e](https://github.com/auth0/node-jsonwebtoken/commit/9ae3f207ac64b7450ea0a3434418f5ca58d8125e)), closes [#536](https://github.com/auth0/node-jsonwebtoken/issues/536)
|
||||
- Implement async/sync tests for nbf claim (#537) ([88bc965061ed65299a395f42a100fb8f8c3c683e](https://github.com/auth0/node-jsonwebtoken/commit/88bc965061ed65299a395f42a100fb8f8c3c683e)), closes [#537](https://github.com/auth0/node-jsonwebtoken/issues/537)
|
||||
- Implement async/sync tests for sub claim (#534) ([342b07bb105a35739eb91265ba5b9dd33c300fc6](https://github.com/auth0/node-jsonwebtoken/commit/342b07bb105a35739eb91265ba5b9dd33c300fc6)), closes [#534](https://github.com/auth0/node-jsonwebtoken/issues/534)
|
||||
- Implement async/sync tests for the aud claim (#535) ([1c8ff5a68e6da73af2809c9d87faaf78602c99bb](https://github.com/auth0/node-jsonwebtoken/commit/1c8ff5a68e6da73af2809c9d87faaf78602c99bb)), closes [#535](https://github.com/auth0/node-jsonwebtoken/issues/535)
|
||||
|
||||
### CI
|
||||
|
||||
- Added Istanbul to check test-coverage (#468) ([9676a8306428a045e34c3987bd0680fb952b44e3](https://github.com/auth0/node-jsonwebtoken/commit/9676a8306428a045e34c3987bd0680fb952b44e3)), closes [#468](https://github.com/auth0/node-jsonwebtoken/issues/468)
|
||||
- Complete ESLint conversion and cleanup (#490) ([cb1d2e1e40547f7ecf29fa6635041df6cbba7f40](https://github.com/auth0/node-jsonwebtoken/commit/cb1d2e1e40547f7ecf29fa6635041df6cbba7f40)), closes [#490](https://github.com/auth0/node-jsonwebtoken/issues/490)
|
||||
- Make code-coverage mandatory when running tests (#495) ([fb0084a78535bfea8d0087c0870e7e3614a2cbe5](https://github.com/auth0/node-jsonwebtoken/commit/fb0084a78535bfea8d0087c0870e7e3614a2cbe5)), closes [#495](https://github.com/auth0/node-jsonwebtoken/issues/495)
|
||||
|
||||
|
||||
## 8.3.0 - 2018-06-11
|
||||
|
||||
- docs: add some clarifications (#473) ([cd33cc81f06068b9df6c224d300dc6f70d8904ab](https://github.com/auth0/node-jsonwebtoken/commit/cd33cc81f06068b9df6c224d300dc6f70d8904ab)), closes [#473](https://github.com/auth0/node-jsonwebtoken/issues/473)
|
||||
- ci: fix ci execution, remove not needed script (#472) ([c8ff7b2c3ffcd954a64a0273c20a7d1b22339aa5](https://github.com/auth0/node-jsonwebtoken/commit/c8ff7b2c3ffcd954a64a0273c20a7d1b22339aa5)), closes [#472](https://github.com/auth0/node-jsonwebtoken/issues/472)
|
||||
- new feature: Secret callback revisited (#480) ([d01cc7bcbdeb606d997a580f967b3169fcc622ba](https://github.com/auth0/node-jsonwebtoken/commit/d01cc7bcbdeb606d997a580f967b3169fcc622ba)), closes [#480](https://github.com/auth0/node-jsonwebtoken/issues/480)
|
||||
- docs:Update README.md (#461) ([f0e0954505f274da95a8d9603598e455b4d2c894](https://github.com/auth0/node-jsonwebtoken/commit/f0e0954505f274da95a8d9603598e455b4d2c894)), closes [#461](https://github.com/auth0/node-jsonwebtoken/issues/461)
|
||||
|
||||
|
||||
## 8.2.2 - 2018-05-30
|
||||
|
||||
- security: deps: jws@3.1.5 (#477) ([ebde9b7cc75cb7ab5176de7ebc4a1d6a8f05bd51](https://github.com/auth0/node-jsonwebtoken/commit/ebde9b7cc75cb7ab5176de7ebc4a1d6a8f05bd51)), closes [#465](https://github.com/auth0/node-jsonwebtoken/issues/465)
|
||||
- docs: add some clarifications (#473) ([cd33cc81f06068b9df6c224d300dc6f70d8904ab](https://github.com/auth0/node-jsonwebtoken/commit/cd33cc81f06068b9df6c224d300dc6f70d8904ab)), closes [#473](https://github.com/auth0/node-jsonwebtoken/issues/473)
|
||||
- ci: fix ci execution, remove not needed script (#472) ([c8ff7b2c3ffcd954a64a0273c20a7d1b22339aa5](https://github.com/auth0/node-jsonwebtoken/commit/c8ff7b2c3ffcd954a64a0273c20a7d1b22339aa5)), closes [#472](https://github.com/auth0/node-jsonwebtoken/issues/472)
|
||||
- docs: Update README.md (#461) ([f0e0954505f274da95a8d9603598e455b4d2c894](https://github.com/auth0/node-jsonwebtoken/commit/f0e0954505f274da95a8d9603598e455b4d2c894)), closes [#461](https://github.com/auth0/node-jsonwebtoken/issues/461)
|
||||
|
||||
|
||||
## 8.2.1 - 2018-04-05
|
||||
|
||||
- bug fix: Check payload is not null when decoded. (#444) ([1232ae9352ce5fd1ca6c593291ce6ad0834a1ff5](https://github.com/auth0/node-jsonwebtoken/commit/1232ae9352ce5fd1ca6c593291ce6ad0834a1ff5))
|
||||
- docs: Clarify that buffer/string payloads must be JSON (#442) ([e8ac1be7565a3fd986d40cb5e31a9f6c4d9aed1b](https://github.com/auth0/node-jsonwebtoken/commit/e8ac1be7565a3fd986d40cb5e31a9f6c4d9aed1b))
|
||||
|
||||
|
||||
## 8.2.0 - 2018-03-02
|
||||
|
||||
- Add a new mutatePayload option (#446) ([d6d7c5e5103f05a92d3633ac190d3025a0455be0](https://github.com/auth0/node-jsonwebtoken/commit/d6d7c5e5103f05a92d3633ac190d3025a0455be0))
|
||||
|
||||
|
||||
## 8.1.1 - 2018-01-22
|
||||
|
||||
- ci: add newer node versions to build matrix (#428) ([83f3eee44e122da06f812d7da4ace1fa26c24d9d](https://github.com/auth0/node-jsonwebtoken/commit/83f3eee44e122da06f812d7da4ace1fa26c24d9d))
|
||||
- deps: Bump ms version to add support for negative numbers (#438) ([25e0e624545eaef76f3c324a134bf103bc394724](https://github.com/auth0/node-jsonwebtoken/commit/25e0e624545eaef76f3c324a134bf103bc394724))
|
||||
- docs: Minor typo (#424) ([dddcb73ac05de11b81feeb629f6cf78dd03d2047](https://github.com/auth0/node-jsonwebtoken/commit/dddcb73ac05de11b81feeb629f6cf78dd03d2047))
|
||||
- bug fix: Not Before (nbf) calculated based on iat/timestamp (#437) ([2764a64908d97c043d62eba0bf6c600674f9a6d6](https://github.com/auth0/node-jsonwebtoken/commit/2764a64908d97c043d62eba0bf6c600674f9a6d6)), closes [#435](https://github.com/auth0/node-jsonwebtoken/issues/435)
|
||||
|
||||
|
||||
## 8.1.0 - 2017-10-09
|
||||
|
||||
- #402: Don't fail if captureStackTrace is not a function (#410) ([77ee965d9081faaf21650f266399f203f69533c5](https://github.com/auth0/node-jsonwebtoken/commit/77ee965d9081faaf21650f266399f203f69533c5))
|
||||
- #403: Clarify error wording for "Expected object" error. (#409) ([bb27eb346f0ff675a320b2de16b391a7cfeadc58](https://github.com/auth0/node-jsonwebtoken/commit/bb27eb346f0ff675a320b2de16b391a7cfeadc58))
|
||||
- Enhance audience check to verify against regular expressions (#398) ([81501a17da230af7b74a3f7535ab5cd3a19c8315](https://github.com/auth0/node-jsonwebtoken/commit/81501a17da230af7b74a3f7535ab5cd3a19c8315))
|
||||
|
||||
|
||||
## 8.0.1 - 2017-09-12
|
||||
|
||||
- Remove `lodash.isarray` dependency (#394) ([7508e8957cb1c778f72fa9a363a7b135b3c9c36d](https://github.com/auth0/node-jsonwebtoken/commit/7508e8957cb1c778f72fa9a363a7b135b3c9c36d))
|
||||
|
||||
## 8.0.0 - 2017-09-06
|
||||
|
||||
**Breaking changes: See [Migration notes from v7](https://github.com/auth0/node-jsonwebtoken/wiki/Migration-Notes:-v7-to-v8)**
|
||||
|
||||
- docs: readme, migration notes ([12cd8f7f47224f904f6b8f39d1dee73775de4f6f](https://github.com/auth0/node-jsonwebtoken/commit/12cd8f7f47224f904f6b8f39d1dee73775de4f6f))
|
||||
- verify: remove process.nextTick (#302) ([3305cf04e3f674b9fb7e27c9b14ddd159650ff82](https://github.com/auth0/node-jsonwebtoken/commit/3305cf04e3f674b9fb7e27c9b14ddd159650ff82))
|
||||
- Reduce size of NPM package (#347) ([0be5409ac6592eeaae373dce91ec992fa101bd8a](https://github.com/auth0/node-jsonwebtoken/commit/0be5409ac6592eeaae373dce91ec992fa101bd8a))
|
||||
- Remove joi to shrink module size (#348) ([2e7e68dbd59e845cdd940afae0a296f48438445f](https://github.com/auth0/node-jsonwebtoken/commit/2e7e68dbd59e845cdd940afae0a296f48438445f))
|
||||
- maxAge: Add validation to timespan result ([66a4f8b996c8357727ce62a84605a005b2f5eb18](https://github.com/auth0/node-jsonwebtoken/commit/66a4f8b996c8357727ce62a84605a005b2f5eb18))
|
||||
|
||||
## 7.4.3 - 2017-08-17
|
||||
|
||||
- Fix breaking change on 7.4.2 for empty secret + "none" algorithm (sync code style) ([PR 386](https://github.com/auth0/node-jsonwebtoken/pull/386))
|
||||
|
||||
## 7.4.2 - 2017-08-04
|
||||
|
||||
- bugfix: sign: add check to be sure secret has a value ([c584d1cbc34b788977b36f17cd57ab2212f1230e](https://github.com/auth0/node-jsonwebtoken/commit/c584d1cbc34b788977b36f17cd57ab2212f1230e))
|
||||
- docs: about refreshing tokens ([016fc10b847bfbb76b82171cb530f32d7da2001b](https://github.com/auth0/node-jsonwebtoken/commit/016fc10b847bfbb76b82171cb530f32d7da2001b))
|
||||
- docs: verifying with base64 encoded secrets ([c25e9906801f89605080cc71b3ee23a5e45a5811](https://github.com/auth0/node-jsonwebtoken/commit/c25e9906801f89605080cc71b3ee23a5e45a5811))
|
||||
- tests: Add tests for ES256 ([89900ea00735f76b04f437c9f542285b420fa9cb](https://github.com/auth0/node-jsonwebtoken/commit/89900ea00735f76b04f437c9f542285b420fa9cb))
|
||||
- docs: document keyid as option (#361) ([00086c2c006d7fc1a47bae02fa87d194d79aa558](https://github.com/auth0/node-jsonwebtoken/commit/00086c2c006d7fc1a47bae02fa87d194d79aa558))
|
||||
- docs: readme: Using private key with passpharase (#353) ([27a7f1d4f35b662426ff0270526d48658da4c8b7](https://github.com/auth0/node-jsonwebtoken/commit/27a7f1d4f35b662426ff0270526d48658da4c8b7))
|
||||
|
||||
## 7.4.1 - 2017-05-17
|
||||
|
||||
- bump ms to v2 due a ReDoS vulnerability (#352) ([adcfd6ae4088c838769d169f8cd9154265aa13e0](https://github.com/auth0/node-jsonwebtoken/commit/adcfd6ae4088c838769d169f8cd9154265aa13e0))
|
||||
|
||||
## 7.4.0 - 2017-04-24
|
||||
|
||||
- Add docs about numeric date fields ([659f73119900a4d837650d9b3f5af4e64a2f843b](https://github.com/auth0/node-jsonwebtoken/commit/659f73119900a4d837650d9b3f5af4e64a2f843b))
|
||||
- Make Options object optional for callback-ish sign ([e202c4fd00c35a24e9ab606eab89186ade13d0cc](https://github.com/auth0/node-jsonwebtoken/commit/e202c4fd00c35a24e9ab606eab89186ade13d0cc))
|
||||
|
||||
## 7.3.0 - 2017-02-13
|
||||
|
||||
- Add more information to `maxAge` option in README ([1b0592e99cc8def293eed177e2575fa7f1cf7aa5](https://github.com/auth0/node-jsonwebtoken/commit/1b0592e99cc8def293eed177e2575fa7f1cf7aa5))
|
||||
- Add `clockTimestamp` option to `verify()` you can set the current time in seconds with it (#274) ([8fdc1504f4325e7003894ffea078da9cba5208d9](https://github.com/auth0/node-jsonwebtoken/commit/8fdc1504f4325e7003894ffea078da9cba5208d9))
|
||||
- Fix handling non string tokens on `verify()` input (#305) ([1b6ec8d466504f58c5a6e2dae3360c828bad92fb](https://github.com/auth0/node-jsonwebtoken/commit/1b6ec8d466504f58c5a6e2dae3360c828bad92fb)), closes [#305](https://github.com/auth0/node-jsonwebtoken/issues/305)
|
||||
- Fixed a simple typo in docs (#287) ([a54240384e24e18c00e75884295306db311d0cb7](https://github.com/auth0/node-jsonwebtoken/commit/a54240384e24e18c00e75884295306db311d0cb7)), closes [#287](https://github.com/auth0/node-jsonwebtoken/issues/287)
|
||||
- Raise jws.decode error to avoid confusion with "invalid token" error (#294) ([7f68fe06c88d5c5653785bd66bc68c5b20e1bd8e](https://github.com/auth0/node-jsonwebtoken/commit/7f68fe06c88d5c5653785bd66bc68c5b20e1bd8e))
|
||||
- rauchg/ms.js changed to zeit/ms (#303) ([35d84152a6b716d757cb5b1dd3c79fe3a1bc0628](https://github.com/auth0/node-jsonwebtoken/commit/35d84152a6b716d757cb5b1dd3c79fe3a1bc0628))
|
||||
|
||||
## 7.2.1 - 2016-12-07
|
||||
|
||||
- add nsp check to find vulnerabilities on npm test ([4219c34b5346811c07f520f10516cc495bcc70dd](https://github.com/auth0/node-jsonwebtoken/commit/4219c34b5346811c07f520f10516cc495bcc70dd))
|
||||
- revert to joi@^6 to keep ES5 compatibility ([51d4796c07344bf817687f7ccfeef78f00bf5b4f](https://github.com/auth0/node-jsonwebtoken/commit/51d4796c07344bf817687f7ccfeef78f00bf5b4f))
|
||||
|
||||
## 7.2.0 - 2016-12-06
|
||||
|
||||
- improve the documentation for expiration ([771e0b5f9bed90771fb79140eb38e51a3ecac8f0](https://github.com/auth0/node-jsonwebtoken/commit/771e0b5f9bed90771fb79140eb38e51a3ecac8f0))
|
||||
- Restructured a sentence ([ccc7610187a862f7a50177eadc9152eef26cd065](https://github.com/auth0/node-jsonwebtoken/commit/ccc7610187a862f7a50177eadc9152eef26cd065))
|
||||
- Allow `keyid` on `sign`. ([b412be91b89acb3a742bb609d3b54e47e1dfc441](https://github.com/auth0/node-jsonwebtoken/commit/b412be91b89acb3a742bb609d3b54e47e1dfc441))
|
||||
- upgrade joi ([715e3d928023d414d45c6dc3f096a7c8448139ae](https://github.com/auth0/node-jsonwebtoken/commit/715e3d928023d414d45c6dc3f096a7c8448139ae))
|
||||
- upgrade to latest nodes and Travis infrastructure ([3febcc1dd23ecdec1abbf89313959941d15eb47a](https://github.com/auth0/node-jsonwebtoken/commit/3febcc1dd23ecdec1abbf89313959941d15eb47a))
|
||||
|
||||
|
||||
## 7.1.10 - 2016-12-06
|
||||
|
||||
- Bump node-jws version number ([07813dd7194630c9f452684279178af76464a759](https://github.com/auth0/node-jsonwebtoken/commit/07813dd7194630c9f452684279178af76464a759))
|
||||
- improve the documentation for expiration ([771e0b5f9bed90771fb79140eb38e51a3ecac8f0](https://github.com/auth0/node-jsonwebtoken/commit/771e0b5f9bed90771fb79140eb38e51a3ecac8f0))
|
||||
|
||||
## 7.1.9 - 2016-08-11
|
||||
|
||||
- Revert "Merge branch 'venatir-master'" ([d06359ef3b4e619680e043ee7c16adda16598f52](https://github.com/auth0/node-jsonwebtoken/commit/d06359ef3b4e619680e043ee7c16adda16598f52))
|
||||
|
||||
|
||||
|
||||
## 7.1.8 - 2016-08-10
|
||||
|
||||
- Fixed tests, however typ: 'JWT' should not be in the options at all, so please review other tests ([01903bcdc61b4ed429acbbd1fe0ffe0db364473b](https://github.com/auth0/node-jsonwebtoken/commit/01903bcdc61b4ed429acbbd1fe0ffe0db364473b))
|
||||
- Removing unnecessary extra decoding. jwtString is already verified as valid and signature checked ([55d5834f7b637011e1d8b927ff78a92a5fd521cf](https://github.com/auth0/node-jsonwebtoken/commit/55d5834f7b637011e1d8b927ff78a92a5fd521cf))
|
||||
- update changelog ([5117aacd0118a10331889a64e61d8186112d8a23](https://github.com/auth0/node-jsonwebtoken/commit/5117aacd0118a10331889a64e61d8186112d8a23))
|
||||
|
||||
|
||||
## 7.1.7 - 2016-07-29
|
||||
|
||||
- Use lodash.once instead of unlicensed/unmaintained cb ([3ac95ad93ef3068a64e03d8d14deff231b1ed529](https://github.com/auth0/node-jsonwebtoken/commit/3ac95ad93ef3068a64e03d8d14deff231b1ed529))
|
||||
|
||||
## 7.1.6 - 2016-07-15
|
||||
|
||||
- fix issue with buffer payload. closes #216 ([6b50ff324b4dfd2cb0e49b666f14a6672d015b22](https://github.com/auth0/node-jsonwebtoken/commit/6b50ff324b4dfd2cb0e49b666f14a6672d015b22)), closes [#216](https://github.com/auth0/node-jsonwebtoken/issues/216)
|
||||
|
||||
|
||||
## 7.1.5 - 2016-07-15
|
||||
|
||||
- update jws in package.json ([b6260951eefc68aae5f4ede359210761f901ff7a](https://github.com/auth0/node-jsonwebtoken/commit/b6260951eefc68aae5f4ede359210761f901ff7a))
|
||||
|
||||
|
||||
## 7.1.4 - 2016-07-14
|
||||
|
||||
- add redundant test ([bece8816096f324511c3efcb8db0e64b75d757a1](https://github.com/auth0/node-jsonwebtoken/commit/bece8816096f324511c3efcb8db0e64b75d757a1))
|
||||
- fix an issue of double callback on error ([758ca5eeca2f1b06c32c9fce70642bf488b2e52b](https://github.com/auth0/node-jsonwebtoken/commit/758ca5eeca2f1b06c32c9fce70642bf488b2e52b))
|
||||
|
||||
## 7.1.2 - 2016-07-12
|
||||
|
||||
- do not stringify the payload when signing async - closes #224 ([084f537d3dfbcef2bea411cc0a1515899cc8aa21](https://github.com/auth0/node-jsonwebtoken/commit/084f537d3dfbcef2bea411cc0a1515899cc8aa21)), closes [#224](https://github.com/auth0/node-jsonwebtoken/issues/224)
|
||||
|
||||
## 7.1.1 - 2016-07-12
|
||||
|
||||
- do not mutate options in jwt.verify, closes #227 ([63263a28a268624dab0927b9ad86fffa44a10f84](https://github.com/auth0/node-jsonwebtoken/commit/63263a28a268624dab0927b9ad86fffa44a10f84)), closes [#227](https://github.com/auth0/node-jsonwebtoken/issues/227)
|
||||
- refactor into multiple files ([e11d505207fa33501298300c9accbfb809d8748d](https://github.com/auth0/node-jsonwebtoken/commit/e11d505207fa33501298300c9accbfb809d8748d))
|
||||
|
||||
## 7.1.0 - 2016-07-12
|
||||
|
||||
- Exp calculated based on iat. fix #217 ([757a16e0e35ad19f9e456820f55d5d9f3fc76aee](https://github.com/auth0/node-jsonwebtoken/commit/757a16e0e35ad19f9e456820f55d5d9f3fc76aee)), closes [#217](https://github.com/auth0/node-jsonwebtoken/issues/217)
|
||||
|
||||
## 7.0.0 - 2016-05-19
|
||||
|
||||
- change jwt.sign to return errors on callback instead of throwing errors ([1e46c5a42aa3dab8478efa4081d8f8f5c5485d56](https://github.com/auth0/node-jsonwebtoken/commit/1e46c5a42aa3dab8478efa4081d8f8f5c5485d56))
|
||||
|
||||
## 6.2.0 - 2016-04-29
|
||||
|
||||
- add support for `options.clockTolerance` to `jwt.verify` ([65ddea934f226bf06bc9d6a55be9587515cfc38d](https://github.com/auth0/node-jsonwebtoken/commit/65ddea934f226bf06bc9d6a55be9587515cfc38d))
|
||||
|
||||
## 6.1.2 - 2016-04-29
|
||||
|
||||
- fix sign method for node.js 0.12. closes #193 ([9c38374142d3929be3c9314b5e9bc5d963c5955f](https://github.com/auth0/node-jsonwebtoken/commit/9c38374142d3929be3c9314b5e9bc5d963c5955f)), closes [#193](https://github.com/auth0/node-jsonwebtoken/issues/193)
|
||||
- improve async test ([7b0981380ddc40a5f1208df520631785b5ffb85a](https://github.com/auth0/node-jsonwebtoken/commit/7b0981380ddc40a5f1208df520631785b5ffb85a))
|
||||
|
||||
## 6.1.0 - 2016-04-27
|
||||
|
||||
- verify unsigned tokens ([ec880791c10ed5ef7c8df7bf28ebb95c810479ed](https://github.com/auth0/node-jsonwebtoken/commit/ec880791c10ed5ef7c8df7bf28ebb95c810479ed))
|
||||
|
||||
## 6.0.1 - 2016-04-27
|
||||
|
||||
This was an immediate change after publishing 6.0.0.
|
||||
|
||||
- throw error on invalid options when the payload is not an object ([304f1b33075f79ed66f784e27dc4f5307aa39e27](https://github.com/auth0/node-jsonwebtoken/commit/304f1b33075f79ed66f784e27dc4f5307aa39e27))
|
||||
|
||||
## 6.0.0 - 2016-04-27
|
||||
|
||||
- Change .sign to standard async callback ([50873c7d45d2733244d5da8afef3d1872e657a60](https://github.com/auth0/node-jsonwebtoken/commit/50873c7d45d2733244d5da8afef3d1872e657a60))
|
||||
- Improved the options for the `sign` method ([53c3987b3cc34e95eb396b26fc9b051276e2f6f9](https://github.com/auth0/node-jsonwebtoken/commit/53c3987b3cc34e95eb396b26fc9b051276e2f6f9))
|
||||
|
||||
- throw error on invalid options like `expiresIn` when the payload is not an object ([304f1b33075f79ed66f784e27dc4f5307aa39e27](https://github.com/auth0/node-jsonwebtoken/commit/304f1b33075f79ed66f784e27dc4f5307aa39e27))
|
||||
- `expiresInMinutes` and `expiresInSeconds` are deprecated and no longer supported.
|
||||
- `notBeforeInMinutes` and `notBeforeInSeconds` are deprecated and no longer supported.
|
||||
- `options` are strongly validated.
|
||||
- `options.expiresIn`, `options.notBefore`, `options.audience`, `options.issuer`, `options.subject` and `options.jwtid` are mutually exclusive with `payload.exp`, `payload.nbf`, `payload.aud`, `payload.iss`
|
||||
- `options.algorithm` is properly validated.
|
||||
- `options.headers` is renamed to `options.header`.
|
||||
|
||||
- update CHANGELOG to reflect most of the changes. closes #136 ([b87a1a8d2e2533fbfab518765a54f00077918eb7](https://github.com/auth0/node-jsonwebtoken/commit/b87a1a8d2e2533fbfab518765a54f00077918eb7)), closes [#136](https://github.com/auth0/node-jsonwebtoken/issues/136)
|
||||
- update readme ([53a88ecf4494e30e1d62a1cf3cc354650349f486](https://github.com/auth0/node-jsonwebtoken/commit/53a88ecf4494e30e1d62a1cf3cc354650349f486))
|
||||
|
||||
## 5.7.0 - 2016-02-16
|
||||
|
||||
|
||||
- add support for validating multiples issuers. closes #163 ([39d9309ae05648dbd72e5fd1993df064ad0e8fa5](https://github.com/auth0/node-jsonwebtoken/commit/39d9309ae05648dbd72e5fd1993df064ad0e8fa5)), closes [#163](https://github.com/auth0/node-jsonwebtoken/issues/163)
|
||||
|
||||
|
||||
## 5.6.1 - 2016-02-16
|
||||
|
||||
|
||||
- 5.6.1 ([06d8209d499dbc9a8dd978ab6cbb9c6818fde203](https://github.com/auth0/node-jsonwebtoken/commit/06d8209d499dbc9a8dd978ab6cbb9c6818fde203))
|
||||
- fix wrong error when setting expiration on non-object payload. closes #153 ([7f7d76edfd918d6afc7c7cead888caa42ccaceb4](https://github.com/auth0/node-jsonwebtoken/commit/7f7d76edfd918d6afc7c7cead888caa42ccaceb4)), closes [#153](https://github.com/auth0/node-jsonwebtoken/issues/153)
|
||||
|
||||
|
||||
|
||||
## 5.6.0 - 2016-02-16
|
||||
|
||||
|
||||
- added missing validations of sub and jti ([a1affe960d0fc52e9042bcbdedb65734f8855580](https://github.com/auth0/node-jsonwebtoken/commit/a1affe960d0fc52e9042bcbdedb65734f8855580))
|
||||
- Fix tests in jwt.rs.tests.js which causes 4 to fail ([8aedf2b1f575b0d9575c1fc9f2ac7bc868f75ff1](https://github.com/auth0/node-jsonwebtoken/commit/8aedf2b1f575b0d9575c1fc9f2ac7bc868f75ff1))
|
||||
- Update README.md ([349b7cd00229789b138928ca060d3ef015aedaf9](https://github.com/auth0/node-jsonwebtoken/commit/349b7cd00229789b138928ca060d3ef015aedaf9))
|
||||
|
||||
|
||||
|
||||
## 5.5.4 - 2016-01-04
|
||||
|
||||
|
||||
- minor ([46552e7c45025c76e3f647680d7539a66bfac612](https://github.com/auth0/node-jsonwebtoken/commit/46552e7c45025c76e3f647680d7539a66bfac612))
|
||||
|
||||
|
||||
|
||||
## 5.5.3 - 2016-01-04
|
||||
|
||||
|
||||
- add a console.warn on invalid options for string payloads ([71200f14deba0533d3261266348338fac2d14661](https://github.com/auth0/node-jsonwebtoken/commit/71200f14deba0533d3261266348338fac2d14661))
|
||||
- minor ([65b1f580382dc58dd3da6f47a52713776fd7cdf2](https://github.com/auth0/node-jsonwebtoken/commit/65b1f580382dc58dd3da6f47a52713776fd7cdf2))
|
||||
|
||||
|
||||
|
||||
## 5.5.2 - 2016-01-04
|
||||
|
||||
|
||||
- fix signing method with sealed objects, do not modify the params object. closes #147 ([be9c09af83b09c9e72da8b2c6166fa51d92aeab6](https://github.com/auth0/node-jsonwebtoken/commit/be9c09af83b09c9e72da8b2c6166fa51d92aeab6)), closes [#147](https://github.com/auth0/node-jsonwebtoken/issues/147)
|
||||
|
||||
|
||||
|
||||
## 5.5.1 - 2016-01-04
|
||||
|
||||
|
||||
- fix nbf verification. fix #152 ([786d37b299c67771b5e71a2ca476666ab0f97d98](https://github.com/auth0/node-jsonwebtoken/commit/786d37b299c67771b5e71a2ca476666ab0f97d98)), closes [#152](https://github.com/auth0/node-jsonwebtoken/issues/152)
|
||||
|
||||
|
||||
|
||||
## 5.5.0 - 2015-12-28
|
||||
|
||||
|
||||
- improvements to nbf and jti claims ([46372e928f6d2e7398f9b88022ca617d2a3b0699](https://github.com/auth0/node-jsonwebtoken/commit/46372e928f6d2e7398f9b88022ca617d2a3b0699))
|
||||
- Remove duplicate payload line (fix bug in IE strict mode) ([8163d698e0c5ad8c44817a5dcd42a15d7e9c6bc8](https://github.com/auth0/node-jsonwebtoken/commit/8163d698e0c5ad8c44817a5dcd42a15d7e9c6bc8))
|
||||
- Remove duplicate require('ms') line ([7c00bcbcbf8f7503a1070b394a165eccd41de66f](https://github.com/auth0/node-jsonwebtoken/commit/7c00bcbcbf8f7503a1070b394a165eccd41de66f))
|
||||
- Update README to reflect addition of async sign ([d661d4b6f68eb417834c99b36769444723041ccf](https://github.com/auth0/node-jsonwebtoken/commit/d661d4b6f68eb417834c99b36769444723041ccf))
|
||||
|
||||
|
||||
|
||||
## 5.4.0 - 2015-10-02
|
||||
|
||||
|
||||
- deprecate expireInMinutes and expireInSeconds - in favor of expiresIn ([39ecc6f8f310f8462e082f1d53de0b4222b29b6f](https://github.com/auth0/node-jsonwebtoken/commit/39ecc6f8f310f8462e082f1d53de0b4222b29b6f))
|
||||
|
||||
|
||||
## 5.3.0 - 2015-10-02
|
||||
|
||||
|
||||
- 5.3.0 ([5d559ced3fbf10c1adae2e5792deda06ea89bcd3](https://github.com/auth0/node-jsonwebtoken/commit/5d559ced3fbf10c1adae2e5792deda06ea89bcd3))
|
||||
- minor ([6e81ff87a3799b0e56db09cbae42a97e784716c4](https://github.com/auth0/node-jsonwebtoken/commit/6e81ff87a3799b0e56db09cbae42a97e784716c4))
|
||||
|
||||
|
||||
|
||||
## 5.1.0 - 2015-10-02
|
||||
|
||||
|
||||
- added async signing ([9414fbcb15a1f9cf4fe147d070e9424c547dabba](https://github.com/auth0/node-jsonwebtoken/commit/9414fbcb15a1f9cf4fe147d070e9424c547dabba))
|
||||
- Update README.md ([40b2aaaa843442dfb8ee7b574f0a788177e7c904](https://github.com/auth0/node-jsonwebtoken/commit/40b2aaaa843442dfb8ee7b574f0a788177e7c904))
|
||||
|
||||
|
||||
|
||||
## 5.0.5 - 2015-08-19
|
||||
|
||||
|
||||
- add ms dep to package.json ([f13b3fb7f29dff787e7c91ebe2eb5adeeb05f251](https://github.com/auth0/node-jsonwebtoken/commit/f13b3fb7f29dff787e7c91ebe2eb5adeeb05f251))
|
||||
- add note to explain, related to #96 #101 #6 ([dd8969e0e6ed0bcb9cae905d2b1a96476bd85da3](https://github.com/auth0/node-jsonwebtoken/commit/dd8969e0e6ed0bcb9cae905d2b1a96476bd85da3))
|
||||
- add tests for options.headers ([7787dd74e705787c39a871ca29c75a2e0a3948ac](https://github.com/auth0/node-jsonwebtoken/commit/7787dd74e705787c39a871ca29c75a2e0a3948ac))
|
||||
- add tests for verify expires ([d7c5793d98c300603440ab460c11665f661ad3a0](https://github.com/auth0/node-jsonwebtoken/commit/d7c5793d98c300603440ab460c11665f661ad3a0))
|
||||
- add verify option maxAge (with tests) ([49d54e54f7e70b1c53a2e4ee67e116c907d75319](https://github.com/auth0/node-jsonwebtoken/commit/49d54e54f7e70b1c53a2e4ee67e116c907d75319))
|
||||
- fix spelling error in error message ([8078b11b224fa05ac9003ca5aa2c85e9f0128cfb](https://github.com/auth0/node-jsonwebtoken/commit/8078b11b224fa05ac9003ca5aa2c85e9f0128cfb))
|
||||
- Fix typo options.header is not a documented option + ([5feaa5b962ccbddeff054817a410f7b0c1e6ce7f](https://github.com/auth0/node-jsonwebtoken/commit/5feaa5b962ccbddeff054817a410f7b0c1e6ce7f))
|
||||
- update JWT spec link. closes #112 ([f5fa50f797456a12240589161835c7ea30807195](https://github.com/auth0/node-jsonwebtoken/commit/f5fa50f797456a12240589161835c7ea30807195)), closes [#112](https://github.com/auth0/node-jsonwebtoken/issues/112)
|
||||
|
||||
|
||||
## 5.0.3 - 2015-07-15
|
||||
|
||||
- Added nbf support ([f26ba4e2fa197a20497632b63ffcd13ae93aacc4](https://github.com/auth0/node-jsonwebtoken/commit/f26ba4e2fa197a20497632b63ffcd13ae93aacc4))
|
||||
- Added support for subject and jwt id ([ab76ec5bc554e2d1e25376ddb7cea711d86af651](https://github.com/auth0/node-jsonwebtoken/commit/ab76ec5bc554e2d1e25376ddb7cea711d86af651))
|
||||
- Fix `this` referring to the global object instead of `module.exports` in `verify()` ([93f554312e37129027fcf4916f48cb8d1b53588c](https://github.com/auth0/node-jsonwebtoken/commit/93f554312e37129027fcf4916f48cb8d1b53588c))
|
||||
- Fix typo, line 139 README, complete option for .decode. ([59c110aeb8c7c1847ef2ffd77702d13627c89e10](https://github.com/auth0/node-jsonwebtoken/commit/59c110aeb8c7c1847ef2ffd77702d13627c89e10))
|
||||
- minor ([61ff1172272b582902313e958058ff22413494af](https://github.com/auth0/node-jsonwebtoken/commit/61ff1172272b582902313e958058ff22413494af))
|
||||
|
||||
|
||||
|
||||
## 5.0.2 - 2015-06-15
|
||||
|
||||
|
||||
- fix typo in docs . closes #86 ([3d3413221f36acef4dfd1cbed87f1f3565cd6f84](https://github.com/auth0/node-jsonwebtoken/commit/3d3413221f36acef4dfd1cbed87f1f3565cd6f84)), closes [#86](https://github.com/auth0/node-jsonwebtoken/issues/86)
|
||||
|
||||
|
||||
|
||||
## 5.0.1 - 2015-05-15
|
||||
|
||||
|
||||
- Add option to return header and payload when decoding. ([7254e011b59f892d1947e6c11819281adac7069d](https://github.com/auth0/node-jsonwebtoken/commit/7254e011b59f892d1947e6c11819281adac7069d))
|
||||
- Avoid uncaught "SyntaxError: Unexpected token ͧ" error. ([0dc59cd6ee15d83a606acffa7909ee76176ae186](https://github.com/auth0/node-jsonwebtoken/commit/0dc59cd6ee15d83a606acffa7909ee76176ae186))
|
||||
- Document complete option in README. ([ec32b20241a74d9681ea26e1a7024b4642468c00](https://github.com/auth0/node-jsonwebtoken/commit/ec32b20241a74d9681ea26e1a7024b4642468c00))
|
||||
- Fix example in README, silence verbose logging. ([ba3174d10033c41e9c211a38f1cc67f74fbd7f69](https://github.com/auth0/node-jsonwebtoken/commit/ba3174d10033c41e9c211a38f1cc67f74fbd7f69))
|
||||
- Fix link to auth0.com in README ([1b3c5ff72c9bc25e9271646e679f3080f2a042a0](https://github.com/auth0/node-jsonwebtoken/commit/1b3c5ff72c9bc25e9271646e679f3080f2a042a0))
|
||||
- Immediate return if not decoded. ([851bda2b10168f3269c3da6e74d310742f31a193](https://github.com/auth0/node-jsonwebtoken/commit/851bda2b10168f3269c3da6e74d310742f31a193))
|
||||
- Prevent throw on undefined/null secret ([0fdf78d4dbf609455f3277d6169a987aef0384d4](https://github.com/auth0/node-jsonwebtoken/commit/0fdf78d4dbf609455f3277d6169a987aef0384d4))
|
||||
- Removed path from test ([d6240e24186732d368bffe21143becf44c38f0d6](https://github.com/auth0/node-jsonwebtoken/commit/d6240e24186732d368bffe21143becf44c38f0d6))
|
||||
- Simplified checking for missing key ([f1cffd033bffc44f20558eda4a797c3fa2f4ee05](https://github.com/auth0/node-jsonwebtoken/commit/f1cffd033bffc44f20558eda4a797c3fa2f4ee05))
|
||||
- Typo ([ffe68dbe0219bab535c1018448eb4c0b22f1f902](https://github.com/auth0/node-jsonwebtoken/commit/ffe68dbe0219bab535c1018448eb4c0b22f1f902))
|
||||
- Update CHANGELOG.md ([927cce0dad1bc9aad75aeef53e276cf4cfc0d776](https://github.com/auth0/node-jsonwebtoken/commit/927cce0dad1bc9aad75aeef53e276cf4cfc0d776))
|
||||
- Update CHANGELOG.md ([6879e0fdde222995c70a3a69a4af94993d9c667e](https://github.com/auth0/node-jsonwebtoken/commit/6879e0fdde222995c70a3a69a4af94993d9c667e))
|
||||
- Update CHANGELOG.md ([c5596c10e8705727fa13e0394184a606083078bc](https://github.com/auth0/node-jsonwebtoken/commit/c5596c10e8705727fa13e0394184a606083078bc))
|
||||
- Update CHANGELOG.md ([07541f0315f26d179e1cde92732b6124d6869b6f](https://github.com/auth0/node-jsonwebtoken/commit/07541f0315f26d179e1cde92732b6124d6869b6f))
|
||||
- Update CHANGELOG.md ([e6465d48ddd1dc2c3297229b28c78fd5490a2ba9](https://github.com/auth0/node-jsonwebtoken/commit/e6465d48ddd1dc2c3297229b28c78fd5490a2ba9))
|
||||
|
||||
## [5.0.0] - 2015-04-11
|
||||
|
||||
### Changed
|
||||
|
||||
- [sign] Only set defautl `iat` if the user does not specify that argument.
|
||||
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/e900282a8d2dff1d4dec815f7e6aa7782e867d91
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/35036b188b4ee6b42df553bbb93bc8a6b19eae9d
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/954bd7a312934f03036b6bb6f00edd41f29e54d9
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/24a370080e0b75f11d4717cd2b11b2949d95fc2e
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/a77df6d49d4ec688dfd0a1cc723586bffe753516
|
||||
|
||||
### Security
|
||||
|
||||
- [verify] Update to jws@^3.0.0 and renaming `header.alg` mismatch exception to `invalid algorithm` and adding more mismatch tests.
|
||||
|
||||
As `[email protected]` changed the verify method signature to be `jws.verify(signature, algorithm, secretOrKey)`, the token header must be decoded first in order to make sure that the `alg` field matches one of the allowed `options.algorithms`. After that, the now validated `header.alg` is passed to `jws.verify`
|
||||
|
||||
As the order of steps has changed, the error that was thrown when the JWT was invalid is no longer the `jws` one:
|
||||
```
|
||||
{ [Error: Invalid token: no header in signature 'a.b.c'] code: 'MISSING_HEADER', signature: 'a.b.c' }
|
||||
```
|
||||
|
||||
That old error (removed from jws) has been replaced by a `JsonWebTokenError` with message `invalid token`.
|
||||
|
||||
> Important: versions >= 4.2.2 this library are safe to use but we decided to deprecate everything `< 5.0.0` to prevent security warnings from library `node-jws` when doing `npm install`.
|
||||
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/634b8ed0ff5267dc25da5c808634208af109824e
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/9f24ffd5791febb449d4d03ff58d7807da9b9b7e
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/19e6cc6a1f2fd90356f89b074223b9665f2aa8a2
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/1e4623420159c6410616f02a44ed240f176287a9
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/954bd7a312934f03036b6bb6f00edd41f29e54d9
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/24a370080e0b75f11d4717cd2b11b2949d95fc2e
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/a77df6d49d4ec688dfd0a1cc723586bffe753516
|
||||
|
||||
## [4.2.2] - 2015-03-26
|
||||
### Fixed
|
||||
|
||||
- [asymmetric-keys] Fix verify for RSAPublicKey formated keys (`jfromaniello - awlayton`)
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/402794663b9521bf602fcc6f2e811e7d3912f9dc
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/8df6aabbc7e1114c8fb3917931078254eb52c222
|
||||
|
||||
## [4.2.1] - 2015-03-17
|
||||
### Fixed
|
||||
|
||||
- [asymmetric-keys] Fixed issue when public key starts with BEING PUBLIC KEY (https://github.com/auth0/node-jsonwebtoken/issues/70) (`jfromaniello`)
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/7017e74db9b194448ff488b3e16468ada60c4ee5
|
||||
|
||||
## [4.2.0] - 2015-03-16
|
||||
### Security
|
||||
|
||||
- [asymmetric-keys] Making sure a token signed with an asymmetric key will be verified using a asymmetric key.
|
||||
When the verification part was expecting a token digitally signed with an asymmetric key (RS/ES family) of algorithms an attacker could send a token signed with a symmetric algorithm (HS* family).
|
||||
|
||||
The issue was caused because the same signature was used to verify both type of tokens (`verify` method parameter: `secretOrPublicKey`).
|
||||
|
||||
This change adds a new parameter to the verify called `algorithms`. This can be used to specify a list of supported algorithms, but the default value depends on the secret used: if the secretOrPublicKey contains the string `BEGIN CERTIFICATE` the default is `[ 'RS256','RS384','RS512','ES256','ES384','ES512' ]` otherwise is `[ 'HS256','HS384','HS512' ]`. (`jfromaniello`)
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/c2bf7b2cd7e8daf66298c2d168a008690bc4bdd3
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/1bb584bc382295eeb7ee8c4452a673a77a68b687
|
||||
|
||||
## [4.1.0] - 2015-03-10
|
||||
### Changed
|
||||
- Assume the payload is JSON even when there is no `typ` property. [5290db1](https://github.com/auth0/node-jsonwebtoken/commit/5290db1bd74f74cd38c90b19e2355ef223a4d931)
|
||||
|
||||
## [4.0.0] - 2015-03-06
|
||||
### Changed
|
||||
- The default encoding is now utf8 instead of binary. [92d33bd](https://github.com/auth0/node-jsonwebtoken/commit/92d33bd99a3416e9e5a8897d9ad8ff7d70a00bfd)
|
||||
- Add `encoding` as a new option to `sign`. [1fc385e](https://github.com/auth0/node-jsonwebtoken/commit/1fc385ee10bd0018cd1441552dce6c2e5a16375f)
|
||||
- Add `ignoreExpiration` to `verify`. [8d4da27](https://github.com/auth0/node-jsonwebtoken/commit/8d4da279e1b351ac71ace276285c9255186d549f)
|
||||
- Add `expiresInSeconds` to `sign`. [dd156cc](https://github.com/auth0/node-jsonwebtoken/commit/dd156cc30f17028744e60aec0502897e34609329)
|
||||
|
||||
### Fixed
|
||||
- Fix wrong error message when the audience doesn't match. [44e3c8d](https://github.com/auth0/node-jsonwebtoken/commit/44e3c8d757e6b4e2a57a69a035f26b4abec3e327)
|
||||
- Fix wrong error message when the issuer doesn't match. [44e3c8d](https://github.com/auth0/node-jsonwebtoken/commit/44e3c8d757e6b4e2a57a69a035f26b4abec3e327)
|
||||
- Fix wrong `iat` and `exp` values when signing with `noTimestamp`. [331b7bc](https://github.com/auth0/node-jsonwebtoken/commit/331b7bc9cc335561f8806f2c4558e105cb53e0a6)
|
||||
+47
-26
@@ -1,7 +1,7 @@
|
||||
# jsonwebtoken
|
||||
|
||||
| **Build** | **Dependency** |
|
||||
|-----------|---------------|
|
||||
| **Build** | **Dependency** |
|
||||
|-----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
|
||||
| [](http://travis-ci.org/auth0/node-jsonwebtoken) | [](https://david-dm.org/auth0/node-jsonwebtoken) |
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ $ npm install jsonwebtoken
|
||||
|
||||
# Migration notes
|
||||
|
||||
* [From v8 to v9](https://github.com/auth0/node-jsonwebtoken/wiki/Migration-Notes:-v8-to-v9)
|
||||
* [From v7 to v8](https://github.com/auth0/node-jsonwebtoken/wiki/Migration-Notes:-v7-to-v8)
|
||||
|
||||
# Usage
|
||||
@@ -32,15 +33,16 @@ $ npm install jsonwebtoken
|
||||
|
||||
> If `payload` is not a buffer or a string, it will be coerced into a string using `JSON.stringify`.
|
||||
|
||||
`secretOrPrivateKey` is a string, buffer, or object containing either the secret for HMAC algorithms or the PEM
|
||||
`secretOrPrivateKey` is a string (utf-8 encoded), buffer, object, or KeyObject containing either the secret for HMAC algorithms or the PEM
|
||||
encoded private key for RSA and ECDSA. In case of a private key with passphrase an object `{ key, passphrase }` can be used (based on [crypto documentation](https://nodejs.org/api/crypto.html#crypto_sign_sign_private_key_output_format)), in this case be sure you pass the `algorithm` option.
|
||||
When signing with RSA algorithms the minimum modulus length is 2048 except when the allowInsecureKeySizes option is set to true. Private keys below this size will be rejected with an error.
|
||||
|
||||
`options`:
|
||||
|
||||
* `algorithm` (default: `HS256`)
|
||||
* `expiresIn`: expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms).
|
||||
* `expiresIn`: expressed in seconds or a string describing a time span [vercel/ms](https://github.com/vercel/ms).
|
||||
> Eg: `60`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
|
||||
* `notBefore`: expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms).
|
||||
* `notBefore`: expressed in seconds or a string describing a time span [vercel/ms](https://github.com/vercel/ms).
|
||||
> Eg: `60`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
|
||||
* `audience`
|
||||
* `issuer`
|
||||
@@ -50,6 +52,8 @@ encoded private key for RSA and ECDSA. In case of a private key with passphrase
|
||||
* `header`
|
||||
* `keyid`
|
||||
* `mutatePayload`: if true, the sign function will modify the payload object directly. This is useful if you need a raw reference to the payload after claims have been applied to it but before it has been encoded into a token.
|
||||
* `allowInsecureKeySizes`: if true allows private keys with a modulus below 2048 to be used for RSA
|
||||
* `allowInvalidAsymmetricKeyTypes`: if true, allows asymmetric keys which do not match the specified algorithm. This option is intended only for backwards compatability and should be avoided.
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +77,7 @@ Synchronous Sign with RSA SHA256
|
||||
```js
|
||||
// sign with RSA SHA256
|
||||
var privateKey = fs.readFileSync('private.key');
|
||||
var token = jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256'});
|
||||
var token = jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256' });
|
||||
```
|
||||
|
||||
Sign asynchronously
|
||||
@@ -125,9 +129,11 @@ jwt.sign({
|
||||
|
||||
(Synchronous) If a callback is not supplied, function acts synchronously. Returns the payload decoded if the signature is valid and optional expiration, audience, or issuer are valid. If not, it will throw the error.
|
||||
|
||||
> __Warning:__ When the token comes from an untrusted source (e.g. user input or external requests), the returned decoded payload should be treated like any other user input; please make sure to sanitize and only work with properties that are expected
|
||||
|
||||
`token` is the JsonWebToken string
|
||||
|
||||
`secretOrPublicKey` is a string or buffer containing either the secret for HMAC algorithms, or the PEM
|
||||
`secretOrPublicKey` is a string (utf-8 encoded), buffer, or KeyObject containing either the secret for HMAC algorithms, or the PEM
|
||||
encoded public key for RSA and ECDSA.
|
||||
If `jwt.verify` is called asynchronous, `secretOrPublicKey` can be a function that should fetch the secret or public key. See below for a detailed example
|
||||
|
||||
@@ -135,20 +141,26 @@ As mentioned in [this comment](https://github.com/auth0/node-jsonwebtoken/issues
|
||||
|
||||
`options`
|
||||
|
||||
* `algorithms`: List of strings with the names of the allowed algorithms. For instance, `["HS256", "HS384"]`.
|
||||
* `algorithms`: List of strings with the names of the allowed algorithms. For instance, `["HS256", "HS384"]`.
|
||||
> If not specified a defaults will be used based on the type of key provided
|
||||
> * secret - ['HS256', 'HS384', 'HS512']
|
||||
> * rsa - ['RS256', 'RS384', 'RS512']
|
||||
> * ec - ['ES256', 'ES384', 'ES512']
|
||||
> * default - ['RS256', 'RS384', 'RS512']
|
||||
* `audience`: if you want to check audience (`aud`), provide a value here. The audience can be checked against a string, a regular expression or a list of strings and/or regular expressions.
|
||||
> Eg: `"urn:foo"`, `/urn:f[o]{2}/`, `[/urn:f[o]{2}/, "urn:bar"]`
|
||||
* `complete`: return an object with the decoded `{ payload, header, signature }` instead of only the usual content of the payload.
|
||||
* `issuer` (optional): string or array of strings of valid values for the `iss` field.
|
||||
* `jwtid` (optional): if you want to check JWT ID (`jti`), provide a string value here.
|
||||
* `ignoreExpiration`: if `true` do not validate the expiration of the token.
|
||||
* `ignoreNotBefore`...
|
||||
* `subject`: if you want to check subject (`sub`), provide a value here
|
||||
* `clockTolerance`: number of seconds to tolerate when checking the `nbf` and `exp` claims, to deal with small clock differences among different servers
|
||||
* `maxAge`: the maximum allowed age for tokens to still be valid. It is expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms).
|
||||
* `maxAge`: the maximum allowed age for tokens to still be valid. It is expressed in seconds or a string describing a time span [vercel/ms](https://github.com/vercel/ms).
|
||||
> Eg: `1000`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
|
||||
* `clockTimestamp`: the time in seconds that should be used as the current time for all necessary comparisons.
|
||||
* `nonce`: if you want to check `nonce` claim, provide a string value here. It is used on Open ID for the ID Tokens. ([Open ID implementation notes](https://openid.net/specs/openid-connect-core-1_0.html#NonceNotes))
|
||||
|
||||
* `allowInvalidAsymmetricKeyTypes`: if true, allows asymmetric keys which do not match the specified algorithm. This option is intended only for backwards compatability and should be avoided.
|
||||
|
||||
```js
|
||||
// verify a token symmetric - synchronous
|
||||
@@ -228,12 +240,18 @@ jwt.verify(token, getKey, options, function(err, decoded) {
|
||||
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><em></em>Need to peek into a JWT without verifying it? (Click to expand)</summary>
|
||||
|
||||
### jwt.decode(token [, options])
|
||||
|
||||
(Synchronous) Returns the decoded payload without verifying if the signature is valid.
|
||||
|
||||
> __Warning:__ This will __not__ verify whether the signature is valid. You should __not__ use this for untrusted messages. You most likely want to use `jwt.verify` instead.
|
||||
|
||||
> __Warning:__ When the token comes from an untrusted source (e.g. user input or external request), the returned decoded payload should be treated like any other user input; please make sure to sanitize and only work with properties that are expected
|
||||
|
||||
|
||||
`token` is the JsonWebToken string
|
||||
|
||||
`options`:
|
||||
@@ -253,6 +271,8 @@ console.log(decoded.header);
|
||||
console.log(decoded.payload)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Errors & Codes
|
||||
Possible thrown errors during verification.
|
||||
Error is the first argument of the verification callback.
|
||||
@@ -286,7 +306,8 @@ Error object:
|
||||
|
||||
* name: 'JsonWebTokenError'
|
||||
* message:
|
||||
* 'jwt malformed'
|
||||
* 'invalid token' - the header or payload could not be parsed
|
||||
* 'jwt malformed' - the token does not have three components (delimited by a `.`)
|
||||
* 'jwt signature is required'
|
||||
* 'invalid signature'
|
||||
* 'jwt audience invalid. expected: [OPTIONS AUDIENCE]'
|
||||
@@ -335,21 +356,21 @@ jwt.verify(token, 'shhhhh', function(err, decoded) {
|
||||
|
||||
Array of supported algorithms. The following algorithms are currently supported.
|
||||
|
||||
alg Parameter Value | Digital Signature or MAC Algorithm
|
||||
----------------|----------------------------
|
||||
HS256 | HMAC using SHA-256 hash algorithm
|
||||
HS384 | HMAC using SHA-384 hash algorithm
|
||||
HS512 | HMAC using SHA-512 hash algorithm
|
||||
RS256 | RSASSA-PKCS1-v1_5 using SHA-256 hash algorithm
|
||||
RS384 | RSASSA-PKCS1-v1_5 using SHA-384 hash algorithm
|
||||
RS512 | RSASSA-PKCS1-v1_5 using SHA-512 hash algorithm
|
||||
PS256 | RSASSA-PSS using SHA-256 hash algorithm (only node ^6.12.0 OR >=8.0.0)
|
||||
PS384 | RSASSA-PSS using SHA-384 hash algorithm (only node ^6.12.0 OR >=8.0.0)
|
||||
PS512 | RSASSA-PSS using SHA-512 hash algorithm (only node ^6.12.0 OR >=8.0.0)
|
||||
ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm
|
||||
ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm
|
||||
ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm
|
||||
none | No digital signature or MAC value included
|
||||
| alg Parameter Value | Digital Signature or MAC Algorithm |
|
||||
|---------------------|------------------------------------------------------------------------|
|
||||
| HS256 | HMAC using SHA-256 hash algorithm |
|
||||
| HS384 | HMAC using SHA-384 hash algorithm |
|
||||
| HS512 | HMAC using SHA-512 hash algorithm |
|
||||
| RS256 | RSASSA-PKCS1-v1_5 using SHA-256 hash algorithm |
|
||||
| RS384 | RSASSA-PKCS1-v1_5 using SHA-384 hash algorithm |
|
||||
| RS512 | RSASSA-PKCS1-v1_5 using SHA-512 hash algorithm |
|
||||
| PS256 | RSASSA-PSS using SHA-256 hash algorithm (only node ^6.12.0 OR >=8.0.0) |
|
||||
| PS384 | RSASSA-PSS using SHA-384 hash algorithm (only node ^6.12.0 OR >=8.0.0) |
|
||||
| PS512 | RSASSA-PSS using SHA-512 hash algorithm (only node ^6.12.0 OR >=8.0.0) |
|
||||
| ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm |
|
||||
| ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm |
|
||||
| ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm |
|
||||
| none | No digital signature or MAC value included |
|
||||
|
||||
## Refreshing JWTs
|
||||
|
||||
|
||||
+5
-1
@@ -1,8 +1,12 @@
|
||||
module.exports = {
|
||||
decode: require('./decode'),
|
||||
verify: require('./verify'),
|
||||
sign: require('./sign'),
|
||||
JsonWebTokenError: require('./lib/JsonWebTokenError'),
|
||||
NotBeforeError: require('./lib/NotBeforeError'),
|
||||
TokenExpiredError: require('./lib/TokenExpiredError'),
|
||||
};
|
||||
|
||||
Object.defineProperty(module.exports, 'decode', {
|
||||
enumerable: false,
|
||||
value: require('./decode'),
|
||||
});
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
const semver = require('semver');
|
||||
|
||||
module.exports = semver.satisfies(process.version, '>=15.7.0');
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
const semver = require('semver');
|
||||
|
||||
module.exports = semver.satisfies(process.version, '>=16.9.0');
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
const ASYMMETRIC_KEY_DETAILS_SUPPORTED = require('./asymmetricKeyDetailsSupported');
|
||||
const RSA_PSS_KEY_DETAILS_SUPPORTED = require('./rsaPssKeyDetailsSupported');
|
||||
|
||||
const allowedAlgorithmsForKeys = {
|
||||
'ec': ['ES256', 'ES384', 'ES512'],
|
||||
'rsa': ['RS256', 'PS256', 'RS384', 'PS384', 'RS512', 'PS512'],
|
||||
'rsa-pss': ['PS256', 'PS384', 'PS512']
|
||||
};
|
||||
|
||||
const allowedCurves = {
|
||||
ES256: 'prime256v1',
|
||||
ES384: 'secp384r1',
|
||||
ES512: 'secp521r1',
|
||||
};
|
||||
|
||||
module.exports = function(algorithm, key) {
|
||||
if (!algorithm || !key) return;
|
||||
|
||||
const keyType = key.asymmetricKeyType;
|
||||
if (!keyType) return;
|
||||
|
||||
const allowedAlgorithms = allowedAlgorithmsForKeys[keyType];
|
||||
|
||||
if (!allowedAlgorithms) {
|
||||
throw new Error(`Unknown key type "${keyType}".`);
|
||||
}
|
||||
|
||||
if (!allowedAlgorithms.includes(algorithm)) {
|
||||
throw new Error(`"alg" parameter for "${keyType}" key type must be one of: ${allowedAlgorithms.join(', ')}.`)
|
||||
}
|
||||
|
||||
/*
|
||||
* Ignore the next block from test coverage because it gets executed
|
||||
* conditionally depending on the Node version. Not ignoring it would
|
||||
* prevent us from reaching the target % of coverage for versions of
|
||||
* Node under 15.7.0.
|
||||
*/
|
||||
/* istanbul ignore next */
|
||||
if (ASYMMETRIC_KEY_DETAILS_SUPPORTED) {
|
||||
switch (keyType) {
|
||||
case 'ec':
|
||||
const keyCurve = key.asymmetricKeyDetails.namedCurve;
|
||||
const allowedCurve = allowedCurves[algorithm];
|
||||
|
||||
if (keyCurve !== allowedCurve) {
|
||||
throw new Error(`"alg" parameter "${algorithm}" requires curve "${allowedCurve}".`);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'rsa-pss':
|
||||
if (RSA_PSS_KEY_DETAILS_SUPPORTED) {
|
||||
const length = parseInt(algorithm.slice(-3), 10);
|
||||
const { hashAlgorithm, mgf1HashAlgorithm, saltLength } = key.asymmetricKeyDetails;
|
||||
|
||||
if (hashAlgorithm !== `sha${length}` || mgf1HashAlgorithm !== hashAlgorithm) {
|
||||
throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${algorithm}.`);
|
||||
}
|
||||
|
||||
if (saltLength !== undefined && saltLength > length >> 3) {
|
||||
throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${algorithm}.`)
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-11
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jsonwebtoken",
|
||||
"version": "8.5.1",
|
||||
"version": "9.0.0",
|
||||
"description": "JSON Web Token implementation (symmetric and asymmetric)",
|
||||
"main": "index.js",
|
||||
"nyc": {
|
||||
@@ -37,15 +37,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"jws": "^3.2.2",
|
||||
"lodash.includes": "^4.3.0",
|
||||
"lodash.isboolean": "^3.0.3",
|
||||
"lodash.isinteger": "^4.0.4",
|
||||
"lodash.isnumber": "^3.0.3",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.isstring": "^4.0.1",
|
||||
"lodash.once": "^4.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"ms": "^2.1.1",
|
||||
"semver": "^5.6.0"
|
||||
"semver": "^7.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"atob": "^2.1.2",
|
||||
@@ -59,8 +53,8 @@
|
||||
"sinon": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"npm": ">=1.4.28",
|
||||
"node": ">=4"
|
||||
"npm": ">=6",
|
||||
"node": ">=12"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
|
||||
+65
-24
@@ -1,20 +1,16 @@
|
||||
var timespan = require('./lib/timespan');
|
||||
var PS_SUPPORTED = require('./lib/psSupported');
|
||||
var jws = require('jws');
|
||||
var includes = require('lodash.includes');
|
||||
var isBoolean = require('lodash.isboolean');
|
||||
var isInteger = require('lodash.isinteger');
|
||||
var isNumber = require('lodash.isnumber');
|
||||
var isPlainObject = require('lodash.isplainobject');
|
||||
var isString = require('lodash.isstring');
|
||||
var once = require('lodash.once');
|
||||
const timespan = require('./lib/timespan');
|
||||
const PS_SUPPORTED = require('./lib/psSupported');
|
||||
const validateAsymmetricKey = require('./lib/validateAsymmetricKey');
|
||||
const jws = require('jws');
|
||||
const {includes, isBoolean, isInteger, isNumber, isPlainObject, isString, once} = require('lodash')
|
||||
const { KeyObject, createSecretKey, createPrivateKey } = require('crypto')
|
||||
|
||||
var SUPPORTED_ALGS = ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'none']
|
||||
const SUPPORTED_ALGS = ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'none'];
|
||||
if (PS_SUPPORTED) {
|
||||
SUPPORTED_ALGS.splice(3, 0, 'PS256', 'PS384', 'PS512');
|
||||
}
|
||||
|
||||
var sign_options_schema = {
|
||||
const sign_options_schema = {
|
||||
expiresIn: { isValid: function(value) { return isInteger(value) || (isString(value) && value); }, message: '"expiresIn" should be a number of seconds or string representing a timespan' },
|
||||
notBefore: { isValid: function(value) { return isInteger(value) || (isString(value) && value); }, message: '"notBefore" should be a number of seconds or string representing a timespan' },
|
||||
audience: { isValid: function(value) { return isString(value) || Array.isArray(value); }, message: '"audience" must be a string or array' },
|
||||
@@ -26,10 +22,12 @@ var sign_options_schema = {
|
||||
jwtid: { isValid: isString, message: '"jwtid" must be a string' },
|
||||
noTimestamp: { isValid: isBoolean, message: '"noTimestamp" must be a boolean' },
|
||||
keyid: { isValid: isString, message: '"keyid" must be a string' },
|
||||
mutatePayload: { isValid: isBoolean, message: '"mutatePayload" must be a boolean' }
|
||||
mutatePayload: { isValid: isBoolean, message: '"mutatePayload" must be a boolean' },
|
||||
allowInsecureKeySizes: { isValid: isBoolean, message: '"allowInsecureKeySizes" must be a boolean'},
|
||||
allowInvalidAsymmetricKeyTypes: { isValid: isBoolean, message: '"allowInvalidAsymmetricKeyTypes" must be a boolean'}
|
||||
};
|
||||
|
||||
var registered_claims_schema = {
|
||||
const registered_claims_schema = {
|
||||
iat: { isValid: isNumber, message: '"iat" should be a number of seconds' },
|
||||
exp: { isValid: isNumber, message: '"exp" should be a number of seconds' },
|
||||
nbf: { isValid: isNumber, message: '"nbf" should be a number of seconds' }
|
||||
@@ -41,7 +39,7 @@ function validate(schema, allowUnknown, object, parameterName) {
|
||||
}
|
||||
Object.keys(object)
|
||||
.forEach(function(key) {
|
||||
var validator = schema[key];
|
||||
const validator = schema[key];
|
||||
if (!validator) {
|
||||
if (!allowUnknown) {
|
||||
throw new Error('"' + key + '" is not allowed in "' + parameterName + '"');
|
||||
@@ -62,14 +60,14 @@ function validatePayload(payload) {
|
||||
return validate(registered_claims_schema, true, payload, 'payload');
|
||||
}
|
||||
|
||||
var options_to_payload = {
|
||||
const options_to_payload = {
|
||||
'audience': 'aud',
|
||||
'issuer': 'iss',
|
||||
'subject': 'sub',
|
||||
'jwtid': 'jti'
|
||||
};
|
||||
|
||||
var options_for_objects = [
|
||||
const options_for_objects = [
|
||||
'expiresIn',
|
||||
'notBefore',
|
||||
'noTimestamp',
|
||||
@@ -87,10 +85,10 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
||||
options = options || {};
|
||||
}
|
||||
|
||||
var isObjectPayload = typeof payload === 'object' &&
|
||||
const isObjectPayload = typeof payload === 'object' &&
|
||||
!Buffer.isBuffer(payload);
|
||||
|
||||
var header = Object.assign({
|
||||
const header = Object.assign({
|
||||
alg: options.algorithm || 'HS256',
|
||||
typ: isObjectPayload ? 'JWT' : undefined,
|
||||
kid: options.keyid
|
||||
@@ -107,6 +105,32 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
||||
return failure(new Error('secretOrPrivateKey must have a value'));
|
||||
}
|
||||
|
||||
if (secretOrPrivateKey != null && !(secretOrPrivateKey instanceof KeyObject)) {
|
||||
try {
|
||||
secretOrPrivateKey = createPrivateKey(secretOrPrivateKey)
|
||||
} catch (_) {
|
||||
try {
|
||||
secretOrPrivateKey = createSecretKey(typeof secretOrPrivateKey === 'string' ? Buffer.from(secretOrPrivateKey) : secretOrPrivateKey)
|
||||
} catch (_) {
|
||||
return failure(new Error('secretOrPrivateKey is not valid key material'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (header.alg.startsWith('HS') && secretOrPrivateKey.type !== 'secret') {
|
||||
return failure(new Error((`secretOrPrivateKey must be a symmetric key when using ${header.alg}`)))
|
||||
} else if (/^(?:RS|PS|ES)/.test(header.alg)) {
|
||||
if (secretOrPrivateKey.type !== 'private') {
|
||||
return failure(new Error((`secretOrPrivateKey must be an asymmetric key when using ${header.alg}`)))
|
||||
}
|
||||
if (!options.allowInsecureKeySizes &&
|
||||
!header.alg.startsWith('ES') &&
|
||||
secretOrPrivateKey.asymmetricKeyDetails !== undefined && //KeyObject.asymmetricKeyDetails is supported in Node 15+
|
||||
secretOrPrivateKey.asymmetricKeyDetails.modulusLength < 2048) {
|
||||
return failure(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`));
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof payload === 'undefined') {
|
||||
return failure(new Error('payload is required'));
|
||||
} else if (isObjectPayload) {
|
||||
@@ -120,7 +144,7 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
||||
payload = Object.assign({},payload);
|
||||
}
|
||||
} else {
|
||||
var invalid_options = options_for_objects.filter(function (opt) {
|
||||
const invalid_options = options_for_objects.filter(function (opt) {
|
||||
return typeof options[opt] !== 'undefined';
|
||||
});
|
||||
|
||||
@@ -144,7 +168,15 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
||||
return failure(error);
|
||||
}
|
||||
|
||||
var timestamp = payload.iat || Math.floor(Date.now() / 1000);
|
||||
if (!options.allowInvalidAsymmetricKeyTypes) {
|
||||
try {
|
||||
validateAsymmetricKey(header.alg, secretOrPrivateKey);
|
||||
} catch (error) {
|
||||
return failure(error);
|
||||
}
|
||||
}
|
||||
|
||||
const timestamp = payload.iat || Math.floor(Date.now() / 1000);
|
||||
|
||||
if (options.noTimestamp) {
|
||||
delete payload.iat;
|
||||
@@ -177,7 +209,7 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
||||
}
|
||||
|
||||
Object.keys(options_to_payload).forEach(function (key) {
|
||||
var claim = options_to_payload[key];
|
||||
const claim = options_to_payload[key];
|
||||
if (typeof options[key] !== 'undefined') {
|
||||
if (typeof payload[claim] !== 'undefined') {
|
||||
return failure(new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.'));
|
||||
@@ -186,7 +218,7 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
||||
}
|
||||
});
|
||||
|
||||
var encoding = options.encoding || 'utf8';
|
||||
const encoding = options.encoding || 'utf8';
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
callback = callback && once(callback);
|
||||
@@ -198,9 +230,18 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
||||
encoding: encoding
|
||||
}).once('error', callback)
|
||||
.once('done', function (signature) {
|
||||
// TODO: Remove in favor of the modulus length check before signing once node 15+ is the minimum supported version
|
||||
if(!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
|
||||
return callback(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`))
|
||||
}
|
||||
callback(null, signature);
|
||||
});
|
||||
} else {
|
||||
return jws.sign({header: header, payload: payload, secret: secretOrPrivateKey, encoding: encoding});
|
||||
let signature = jws.sign({header: header, payload: payload, secret: secretOrPrivateKey, encoding: encoding});
|
||||
// TODO: Remove in favor of the modulus length check before signing once node 15+ is the minimum supported version
|
||||
if(!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
|
||||
throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`)
|
||||
}
|
||||
return signature
|
||||
}
|
||||
};
|
||||
|
||||
+71
-33
@@ -1,18 +1,21 @@
|
||||
var JsonWebTokenError = require('./lib/JsonWebTokenError');
|
||||
var NotBeforeError = require('./lib/NotBeforeError');
|
||||
var TokenExpiredError = require('./lib/TokenExpiredError');
|
||||
var decode = require('./decode');
|
||||
var timespan = require('./lib/timespan');
|
||||
var PS_SUPPORTED = require('./lib/psSupported');
|
||||
var jws = require('jws');
|
||||
const JsonWebTokenError = require('./lib/JsonWebTokenError');
|
||||
const NotBeforeError = require('./lib/NotBeforeError');
|
||||
const TokenExpiredError = require('./lib/TokenExpiredError');
|
||||
const decode = require('./decode');
|
||||
const timespan = require('./lib/timespan');
|
||||
const validateAsymmetricKey = require('./lib/validateAsymmetricKey');
|
||||
const PS_SUPPORTED = require('./lib/psSupported');
|
||||
const jws = require('jws');
|
||||
const {KeyObject, createSecretKey, createPublicKey} = require("crypto");
|
||||
|
||||
var PUB_KEY_ALGS = ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512'];
|
||||
var RSA_KEY_ALGS = ['RS256', 'RS384', 'RS512'];
|
||||
var HS_ALGS = ['HS256', 'HS384', 'HS512'];
|
||||
const PUB_KEY_ALGS = ['RS256', 'RS384', 'RS512'];
|
||||
const EC_KEY_ALGS = ['ES256', 'ES384', 'ES512'];
|
||||
const RSA_KEY_ALGS = ['RS256', 'RS384', 'RS512'];
|
||||
const HS_ALGS = ['HS256', 'HS384', 'HS512'];
|
||||
|
||||
if (PS_SUPPORTED) {
|
||||
PUB_KEY_ALGS.splice(3, 0, 'PS256', 'PS384', 'PS512');
|
||||
RSA_KEY_ALGS.splice(3, 0, 'PS256', 'PS384', 'PS512');
|
||||
PUB_KEY_ALGS.splice(PUB_KEY_ALGS.length, 0, 'PS256', 'PS384', 'PS512');
|
||||
RSA_KEY_ALGS.splice(RSA_KEY_ALGS.length, 0, 'PS256', 'PS384', 'PS512');
|
||||
}
|
||||
|
||||
module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
@@ -28,7 +31,7 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
//clone this object since we are going to mutate it.
|
||||
options = Object.assign({}, options);
|
||||
|
||||
var done;
|
||||
let done;
|
||||
|
||||
if (callback) {
|
||||
done = callback;
|
||||
@@ -47,7 +50,11 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
return done(new JsonWebTokenError('nonce must be a non-empty string'));
|
||||
}
|
||||
|
||||
var clockTimestamp = options.clockTimestamp || Math.floor(Date.now() / 1000);
|
||||
if (options.allowInvalidAsymmetricKeyTypes !== undefined && typeof options.allowInvalidAsymmetricKeyTypes !== 'boolean') {
|
||||
return done(new JsonWebTokenError('allowInvalidAsymmetricKeyTypes must be a boolean'));
|
||||
}
|
||||
|
||||
const clockTimestamp = options.clockTimestamp || Math.floor(Date.now() / 1000);
|
||||
|
||||
if (!jwtString){
|
||||
return done(new JsonWebTokenError('jwt must be provided'));
|
||||
@@ -57,13 +64,13 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
return done(new JsonWebTokenError('jwt must be a string'));
|
||||
}
|
||||
|
||||
var parts = jwtString.split('.');
|
||||
const parts = jwtString.split('.');
|
||||
|
||||
if (parts.length !== 3){
|
||||
return done(new JsonWebTokenError('jwt malformed'));
|
||||
}
|
||||
|
||||
var decodedToken;
|
||||
let decodedToken;
|
||||
|
||||
try {
|
||||
decodedToken = decode(jwtString, { complete: true });
|
||||
@@ -75,8 +82,8 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
return done(new JsonWebTokenError('invalid token'));
|
||||
}
|
||||
|
||||
var header = decodedToken.header;
|
||||
var getSecret;
|
||||
const header = decodedToken.header;
|
||||
let getSecret;
|
||||
|
||||
if(typeof secretOrPublicKey === 'function') {
|
||||
if(!callback) {
|
||||
@@ -96,7 +103,7 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
return done(new JsonWebTokenError('error in secret or public key callback: ' + err.message));
|
||||
}
|
||||
|
||||
var hasSignature = parts[2].trim() !== '';
|
||||
const hasSignature = parts[2].trim() !== '';
|
||||
|
||||
if (!hasSignature && secretOrPublicKey){
|
||||
return done(new JsonWebTokenError('jwt signature is required'));
|
||||
@@ -107,21 +114,52 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
}
|
||||
|
||||
if (!hasSignature && !options.algorithms) {
|
||||
options.algorithms = ['none'];
|
||||
return done(new JsonWebTokenError('please specify "none" in "algorithms" to verify unsigned tokens'));
|
||||
}
|
||||
|
||||
if (secretOrPublicKey != null && !(secretOrPublicKey instanceof KeyObject)) {
|
||||
try {
|
||||
secretOrPublicKey = createPublicKey(secretOrPublicKey);
|
||||
} catch (_) {
|
||||
try {
|
||||
secretOrPublicKey = createSecretKey(typeof secretOrPublicKey === 'string' ? Buffer.from(secretOrPublicKey) : secretOrPublicKey);
|
||||
} catch (_) {
|
||||
return done(new JsonWebTokenError('secretOrPublicKey is not valid key material'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.algorithms) {
|
||||
options.algorithms = ~secretOrPublicKey.toString().indexOf('BEGIN CERTIFICATE') ||
|
||||
~secretOrPublicKey.toString().indexOf('BEGIN PUBLIC KEY') ? PUB_KEY_ALGS :
|
||||
~secretOrPublicKey.toString().indexOf('BEGIN RSA PUBLIC KEY') ? RSA_KEY_ALGS : HS_ALGS;
|
||||
|
||||
if (secretOrPublicKey.type === 'secret') {
|
||||
options.algorithms = HS_ALGS;
|
||||
} else if (['rsa', 'rsa-pss'].includes(secretOrPublicKey.asymmetricKeyType)) {
|
||||
options.algorithms = RSA_KEY_ALGS
|
||||
} else if (secretOrPublicKey.asymmetricKeyType === 'ec') {
|
||||
options.algorithms = EC_KEY_ALGS
|
||||
} else {
|
||||
options.algorithms = PUB_KEY_ALGS
|
||||
}
|
||||
}
|
||||
|
||||
if (!~options.algorithms.indexOf(decodedToken.header.alg)) {
|
||||
if (options.algorithms.indexOf(decodedToken.header.alg) === -1) {
|
||||
return done(new JsonWebTokenError('invalid algorithm'));
|
||||
}
|
||||
|
||||
var valid;
|
||||
if (header.alg.startsWith('HS') && secretOrPublicKey.type !== 'secret') {
|
||||
return done(new JsonWebTokenError((`secretOrPublicKey must be a symmetric key when using ${header.alg}`)))
|
||||
} else if (/^(?:RS|PS|ES)/.test(header.alg) && secretOrPublicKey.type !== 'public') {
|
||||
return done(new JsonWebTokenError((`secretOrPublicKey must be an asymmetric key when using ${header.alg}`)))
|
||||
}
|
||||
|
||||
if (!options.allowInvalidAsymmetricKeyTypes) {
|
||||
try {
|
||||
validateAsymmetricKey(header.alg, secretOrPublicKey);
|
||||
} catch (e) {
|
||||
return done(e);
|
||||
}
|
||||
}
|
||||
|
||||
let valid;
|
||||
|
||||
try {
|
||||
valid = jws.verify(jwtString, decodedToken.header.alg, secretOrPublicKey);
|
||||
@@ -133,7 +171,7 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
return done(new JsonWebTokenError('invalid signature'));
|
||||
}
|
||||
|
||||
var payload = decodedToken.payload;
|
||||
const payload = decodedToken.payload;
|
||||
|
||||
if (typeof payload.nbf !== 'undefined' && !options.ignoreNotBefore) {
|
||||
if (typeof payload.nbf !== 'number') {
|
||||
@@ -154,10 +192,10 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
}
|
||||
|
||||
if (options.audience) {
|
||||
var audiences = Array.isArray(options.audience) ? options.audience : [options.audience];
|
||||
var target = Array.isArray(payload.aud) ? payload.aud : [payload.aud];
|
||||
const audiences = Array.isArray(options.audience) ? options.audience : [options.audience];
|
||||
const target = Array.isArray(payload.aud) ? payload.aud : [payload.aud];
|
||||
|
||||
var match = target.some(function (targetAudience) {
|
||||
const match = target.some(function (targetAudience) {
|
||||
return audiences.some(function (audience) {
|
||||
return audience instanceof RegExp ? audience.test(targetAudience) : audience === targetAudience;
|
||||
});
|
||||
@@ -169,7 +207,7 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
}
|
||||
|
||||
if (options.issuer) {
|
||||
var invalid_issuer =
|
||||
const invalid_issuer =
|
||||
(typeof options.issuer === 'string' && payload.iss !== options.issuer) ||
|
||||
(Array.isArray(options.issuer) && options.issuer.indexOf(payload.iss) === -1);
|
||||
|
||||
@@ -201,7 +239,7 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
return done(new JsonWebTokenError('iat required when maxAge is specified'));
|
||||
}
|
||||
|
||||
var maxAgeTimestamp = timespan(options.maxAge, payload.iat);
|
||||
const maxAgeTimestamp = timespan(options.maxAge, payload.iat);
|
||||
if (typeof maxAgeTimestamp === 'undefined') {
|
||||
return done(new JsonWebTokenError('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
||||
}
|
||||
@@ -211,7 +249,7 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
}
|
||||
|
||||
if (options.complete === true) {
|
||||
var signature = decodedToken.signature;
|
||||
const signature = decodedToken.signature;
|
||||
|
||||
return done(null, {
|
||||
header: header,
|
||||
|
||||
Reference in New Issue
Block a user