Skip to content

Commit

Permalink
v2.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasroussel committed Apr 25, 2024
1 parent adbd3b7 commit 7988c7d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## 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)
- Fix invalid ECDSA signature for keys that are not a multiple of 8 (e.g. secp521r1) (https://github.com/jonasroussel/dart_jsonwebtoken/issues/51)

## 2.12.2

Expand Down
6 changes: 3 additions & 3 deletions lib/src/jwt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 7988c7d

Please sign in to comment.