Commit graph

45 commits

Author SHA1 Message Date
Filip Skokan
6fc1d4388c test,ci: refactor and add tests using node's experimental globals 2022-03-06 13:53:09 +01:00
Filip Skokan
80741cb32a refactor: substr > slice 2021-12-13 10:29:41 +01:00
Filip Skokan
4a5e89d4e1 test(node): refactor to run only cjs in node 12, else esm 2021-11-10 16:47:41 +01:00
Filip Skokan
92df7032fe
style: global prettierc 2021-10-27 17:47:13 +02:00
Filip Skokan
a51a9f6770
refactor: remove public API default exports in favour of named ones 2021-10-14 13:45:03 +02:00
Filip Skokan
49fb62cb96
feat: return resolved key when verify and decrypt resolve functions are used 2021-09-25 22:27:28 +02:00
Filip Skokan
5c7d2656b6 feat: experimental Deno build & publish 2021-08-20 12:01:17 +02:00
Filip Skokan
df56b942c6 feat: add verbose key type error messages 2021-07-01 14:48:53 +02:00
Filip Skokan
65fdec22be style: prettier lint 2021-07-01 09:54:21 +02:00
Filip Skokan
4103719c24 fix: guard SignJWT.prototype.sign() from missing protected header
fixes #221
2021-07-01 09:50:48 +02:00
Filip Skokan
5163116ca1 feat: support recognizing proprietary crit header parameters
closes #123
2020-12-06 17:54:38 +01:00
Filip Skokan
691b44ad47 fix: reject JWTs with b64: false
As per https://tools.ietf.org/html/rfc7797 abstract

This specification updates RFC 7519 by stating that JSON Web Tokens
(JWTs) MUST NOT use the unencoded payload option defined by this
specification.
2020-12-06 17:54:32 +01:00
Filip Skokan
e39c3dba75 feat: allow compact verify/decrypt tokens to be uint8array encoded
This means that when Nested JWT is used the decrypted plaintext can
be piped directly to verify.
2020-11-22 12:44:27 +01:00
Filip Skokan
a6fa15e64d test: add coverage 2020-11-22 12:35:38 +01:00
Filip Skokan
357fe0b964 feat: Revised API, No dependencies, Browser Support, Promises
BREAKING CHANGE: Revised, Promise-based API
BREAKING CHANGE: No dependencies
BREAKING CHANGE: Browser support (using [Web Cryptography API](https://www.w3.org/TR/WebCryptoAPI/))
BREAKING CHANGE: Support for verification using a remote JWKS endpoint
BREAKING CHANGE: Experimental Node.js libuv thread pool based runtime (non-blocking 🎉)
2020-11-14 18:26:46 +01:00
Filip Skokan
921737fa83 style: upgrade standard 2020-10-29 20:43:19 +01:00
Filip Skokan
97d46fb7c9 refactor: change JWT.decode error message for encrypted JWTs 2020-09-08 14:12:04 +02:00
Filip Skokan
fd69d7f509 refactor: move JWT profile specifics outside of generic JWT
BREAKING CHANGE: the `JWT.verify` profile option was removed, use e.g.
`JWT.IdToken.verify` instead.

BREAKING CHANGE: removed the `maxAuthAge` `JWT.verify` option, this
option is now only present at the specific JWT profile APIs where the
`auth_time` property applies.

BREAKING CHANGE: removed the `nonce` `JWT.verify` option, this
option is now only present at the specific JWT profile APIs where the
`nonce` property applies.

BREAKING CHANGE: the `acr`, `amr`, `nonce` and `azp` claim value types
will only be checked when verifying a specific JWT profile using its
dedicated API.

BREAKING CHANGE: using the draft implementing APIs will emit a one-time
warning per process using `process.emitWarning`
2020-09-08 14:12:04 +02:00
Filip Skokan
c4267cc655 refactor: removed nonce option from JWT.sign
BREAKING CHANGE: `JWT.sign` function options no longer accept a `nonce`
property. To create a JWT with a `nonce` just pass the value to the
payload.
2020-09-08 14:12:04 +02:00
sboys3
ce6836af88
feat: support for validating issuer from a list of values (#91)
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
2020-08-10 18:34:51 +02:00
Filip Skokan
7ba492237a fix: allow any JSON numeric value for timestamp values
> NumericDate
>    A JSON numeric value representing the number of seconds from
>    1970-01-01T00:00:00Z UTC until the specified UTC date/time,
>    ignoring leap seconds.  This is equivalent to the IEEE Std 1003.1,
>    2013 Edition [POSIX.1] definition "Seconds Since the Epoch", in
>    which each day is accounted for by exactly 86400 seconds, other
>    than that non-integer values can be represented.  See RFC 3339
>    [RFC3339] for details regarding date/times in general and UTC in
>    particular.
2020-06-01 14:58:25 +02:00
Filip Skokan
06915861b3 fix: "typ" content-type validation, case insensitive and handled prefix 2020-04-27 20:48:35 +02:00
Filip Skokan
8c0a8a950e feat: update JWT Profile for OAuth 2.0 Access Tokens to latest draft
BREAKING CHANGE: `at+JWT` JWT draft profile - in the draft's Section 2.2
the claims `iat` and `jti` are now REQUIRED (was RECOMMENDED).
2020-04-16 12:09:08 +02:00
Filip Skokan
bc77a15fab feat: update JWT Profile for OAuth 2.0 Access Tokens to latest draft 2020-03-11 15:29:56 +01:00
Filip Skokan
fc08426466 feat: add JWT.verify "typ" option for checking JWT Type Header parameter 2020-02-24 09:12:27 +01:00
Filip Skokan
470b4c7315 perf: base64url decode, JWT.verify, JWK.Key instance re-use
I'm done trying to educate other JOSE producers about interoperability
so i'm going to be accepting their non-conform base64url so that users
of this module don't suffer performance loss.
2020-01-29 20:33:30 +01:00
Filip Skokan
3a6d17fdd1 feat: add opt-in support for Unsecured JWS algorithm "none" 2020-01-23 18:38:00 +01:00
Filip Skokan
a0c0c7ad70
feat: add JWTExpired error and JWTClaimInvalid claim and reason props
Resolves #62
2020-01-16 08:49:37 +01:00
Filip Skokan
b1864e319d feat: exposed shorthands for JWT verification profiles 2020-01-12 16:40:51 +01:00
Filip Skokan
828ad5a33d fix: force iat past check when maxTokenAge option is used + JWT refactor 2020-01-01 21:23:05 +01:00
Filip Skokan
7bb5c953a9 feat: add JWT validation profiles for Access Tokens and Logout Tokens 2019-12-31 14:20:52 +01:00
Filip Skokan
0ed5025de3 fix: skip validating iat is in the past when exp is present
validating that iat is in the past is common sense but actually nowhere
defined, in most applications tokens will contain `exp` and for those
it seems requiring a few second leeway just to satisfy `iat` seems
inappropriate
2019-12-17 20:40:23 +01:00
Filip Skokan
8976027c97 refactor: improve error message when key use mismatches the operation 2019-12-06 15:35:15 +01:00
Filip Skokan
ce77388254 fix: default JWT.sign kid option value is false for HMAC signatures 2019-11-27 22:04:15 +01:00
Filip Skokan
1db9fc9cd1 refactor: don't swallow invalid encoding errors 2019-09-25 22:18:47 +02:00
Filip Skokan
6c98b61597 feat: validate JWTs according to a JWT profile - ID Token
It is now possible to pass a profile to `JWT.verify` and have the JWT
validated according to it. This makes sure you pass all the right
options and that required claims are present, prohibited claims are
missing and that the right JWT typ is used.

More profiles will be added in the future.
2019-07-23 14:50:16 +02:00
Filip Skokan
98af967ef6 test: test jwt sign options over existing payload 2019-07-22 22:38:03 +02:00
Filip Skokan
36c9ce20c5 fix: honour the JWT.sign jti option
fixes #33
2019-07-14 19:30:04 +03:00
Filip Skokan
dba1abdaf3 feat: add JWT.sign/verify/decode 2019-02-27 22:38:30 +01:00
Filip Skokan
775ea638b6 chore: cleanup 2019-02-10 17:45:55 +01:00
Filip Skokan
faa45bc03b refactor: remove generic errors 2019-01-20 19:37:27 +01:00
Filip Skokan
6862c78bed refactor: JWT verify errors 2019-01-20 19:25:36 +01:00
Filip Skokan
7080840f62 feat: verify and decode complete options 2019-01-20 14:26:09 +01:00
Filip Skokan
033a025a34 feat: jwt.verify 2019-01-19 16:33:17 +01:00
Filip Skokan
94b29d1c44 feat: jwt first commit 2019-01-19 00:33:45 +01:00