All notable changes to this project will be documented in this file starting from version v4.0.0. This project adheres to Semantic Versioning.
options.clockTolerance
to jwt.verify
(65ddea934f226bf06bc9d6a55be9587515cfc38d)This was an immediate change after publishing 6.0.0.
Change .sign to standard async callback (50873c7d45d2733244d5da8afef3d1872e657a60)
Improved the options for the sign
method (53c3987b3cc34e95eb396b26fc9b051276e2f6f9)
expiresIn
when the payload is not an object (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), closes #136
update readme (53a88ecf4494e30e1d62a1cf3cc354650349f486)
this
referring to the global object instead of module.exports
in verify()
(93f554312e37129027fcf4916f48cb8d1b53588c)iat
if the user does not specify that argument.e900282a8d
35036b188b
954bd7a312
24a370080e
a77df6d49d
header.alg
mismatch exception to invalid algorithm
and adding more mismatch tests.As jws@3.0.0
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 librarynode-jws
when doingnpm install
.
634b8ed0ff
9f24ffd579
19e6cc6a1f
1e46234201
954bd7a312
24a370080e
a77df6d49d
jfromaniello - awlayton
)
402794663b
8df6aabbc7
jfromaniello
)
7017e74db9
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
)
c2bf7b2cd7
1bb584bc38
typ
property. 5290db1encoding
as a new option to sign
. 1fc385eignoreExpiration
to verify
. 8d4da27expiresInSeconds
to sign
. dd156cc