diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d3dd6d..6becbac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/src/jwt.dart b/lib/src/jwt.dart index 2f607e8..77ff376 100644 --- a/lib/src/jwt.dart +++ b/lib/src/jwt.dart @@ -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'); diff --git a/pubspec.yaml b/pubspec.yaml index 4a03dd8..5692ba6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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