19 Commits
Author SHA1 Message Date
david-renaud-oktaandGitHub 44ce6fd923 fix!: Prevent accidental use of insecure key sizes & misconfiguration of secrets (#852)
* fix!: Disable use of weak RSA key sizes for asymmetric algorithms

Added checks to prevent invalid secrets from being used with the HS*** algorithms when signing and verifying
Added checks to prevent the use of insecure asymmetric key sizes except when explicitly overriden via options
Prevented Buffers containing malicious objects from being used as key material.

BREAKING CHANGE: Requires node 12.x or later to allow use of `KeyObject`
2022-11-29 11:58:59 -05:00
Filip SkokanandEduardo Diaz 11a0453c51 feat: add PS JWA support for applicable node versions (#573) 2019-02-20 13:42:37 +01:00
Tim OramandEduardo Diaz 477e4f7426 Update dependencies used for running tests (#518)
Update chai and mocha to the latest versions and update nyc to the
latest version that supports Node 4.
2018-09-10 11:48:41 +02:00
Tim OramandEduardo Diaz c86e573d16 Complete ESLint conversion and cleanup (#490)
* Add extension to ESLint config file

The .eslintrc file without an extension was deprecated a few years ago,
so this change renames the file to add the required extension.

See: https://github.com/eslint/eslint/commit/c9a8883d450d63a8d044a9e66d275f5b1973a3ba

* Add ESLint to package.json

This change adds ESLint as a dev-dependency and adds a lint script that
will run ESLint.

* Complete switch from JSHint to ESLint

Convert all the JSHint rules to the ESLint equivalents where possible.
The no-undef rule in ESLint caught a few cases of undefined usages in
the tests, so they were also fixed.

* Add a .eslintignore file

The HTML coverage report is currently being linted, which causes a lot
if invalid linting errors. This change adds a ignore file to ensure these
files are properly skipped during linting.
2018-06-25 19:54:04 +02:00
Jonathan Gros-DuboisandEduardo Diaz cab1c43ee4 Add a new mutatePayload option (#446)
This option allows you to keep a reference to the raw token payload after claims have been applied to it but before it has been encoded.
2018-03-02 13:48:25 +01:00
Eduardo Diaz d63c87dc7c add test & modify guard code 2017-08-17 13:50:26 +02:00
Rhys Anthony McCaig 7ff56f77f3 Fixed alg non + secret set unit test 2017-08-11 17:32:06 -07:00
Rhys Anthony McCaig 95e73a269a Fix for #381. Set secret string before using jws when alg is none 2017-08-11 17:25:55 -07:00
Eduardo Diaz 4cc2615033 sign: add check to be sure secret has a value 2017-07-24 16:59:07 -05:00
Eduardo Diaz 87d9e777ed Make Options object optional for callback-ish sign 2017-03-08 14:09:04 +01:00
José F. Romaniello 758ca5eeca temporarly fix an issue of double callback in JWS 2016-07-14 17:30:25 -03:00
José F. Romaniello bece881609 add redundant test 2016-07-14 17:18:41 -03:00
José F. Romaniello 084f537d3d do not stringify the payload when signing async - closes #224 2016-07-12 10:06:23 -03:00
José F. Romaniello 1e46c5a42a change jwt.sign to return errors on callback instead of throwing errors 2016-05-19 12:47:24 -03:00
José F. Romaniello 7b0981380d improve async test 2016-04-29 08:54:48 -03:00
José F. Romaniello 53c3987b3c Improved the sign method
Notable changes:

1.  `expiresInMinutes` and `expiresInSeconds` are deprecated and no longer supported.
2.  `notBeforeInMinutes` and `notBeforeInSeconds` are deprecated and no longer supported.
3.  options are properly validated.
4.  `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`, `payload.sub` and `payload.jti` respectively.
5.  `options.algorithm` is properly validated.
6.  `options.headers` is renamed to `options.header`.
2016-04-27 12:40:28 -03:00
José F. Romaniello e32043b8e9 make payload.exp and options.expiresIn exclusive 2016-04-27 11:43:22 -03:00
popomore 50873c7d45 feat: change .sign to standard async callback
- subscribe error event
- change the first argument of the callback as error
2016-04-27 17:24:51 +08:00
Luke William Westby 9414fbcb15 added async signing 2015-09-27 12:48:44 -05:00