This commit is contained in:
Jonas Roussel
2024-04-25 18:12:39 +02:00
parent adbd3b7046
commit 7988c7d103
3 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
## 2.14.0
- Add support for base64 encoded secrets (https://github.com/jonasroussel/dart_jsonwebtoken/pull/54)
- Fix `exp`, `nbf` and `iat` checks by casting the value to `int`
## 2.13.0
- Fix invalid ECDSA signature for keys that are not a multiple of 8 (e.g. secp521r1) (https://github.com/jonasroussel/dart_jsonwebtoken/issues/51)

View File

@ -63,7 +63,7 @@ class JWT {
// exp
if (checkExpiresIn && payload.containsKey('exp')) {
final exp = DateTime.fromMillisecondsSinceEpoch(
payload['exp'] * 1000,
(payload['exp'] * 1000).toInt(),
);
if (exp.isBefore(clock.now())) {
throw JWTExpiredException();
@ -73,7 +73,7 @@ class JWT {
// nbf
if (checkNotBefore && payload.containsKey('nbf')) {
final nbf = DateTime.fromMillisecondsSinceEpoch(
payload['nbf'] * 1000,
(payload['nbf'] * 1000).toInt(),
);
if (nbf.isAfter(clock.now())) {
throw JWTNotActiveException();
@ -86,7 +86,7 @@ class JWT {
throw JWTInvalidException('invalid issue at');
}
final iat = DateTime.fromMillisecondsSinceEpoch(
payload['iat'] * 1000,
(payload['iat'] * 1000).toInt(),
);
if (!iat.isAtSameMomentAs(clock.now())) {
throw JWTInvalidException('invalid issue at');

View File

@ -1,6 +1,6 @@
name: dart_jsonwebtoken
description: A dart implementation of the famous javascript library 'jsonwebtoken' (JWT).
version: 2.13.0
version: 2.14.0
repository: https://github.com/jonasroussel/dart_jsonwebtoken
homepage: https://github.com/jonasroussel/dart_jsonwebtoken#readme