This commit is contained in:
Jonas Roussel
2021-06-14 13:14:27 +02:00
parent aeb3367c6c
commit b27cc2c5a8
5 changed files with 21 additions and 11 deletions

View File

@ -1,6 +1,10 @@
## 2.3.0
- Adding `header` in JWT class (you can now set your custom header)
## 2.2.0
- Fixing EdDSA incompatibility's with flutter web (https://github.com/jonasroussel/jsonwebtoken/issues/11)
- Fixing EdDSA incompatibility's with flutter web (https://github.com/jonasroussel/dart_jsonwebtoken/issues/11)
- Dependencies: `ed25519_edwards` have been removed, `convert` & `collection` have been added
## 2.1.1
@ -9,7 +13,7 @@
## 2.1.0
- When an undefined error occur `JWTUndefinedError` is thrown containing the original error in `error` property (https://github.com/jonasroussel/jsonwebtoken/issues/9)
- When an undefined error occur `JWTUndefinedError` is thrown containing the original error in `error` property (https://github.com/jonasroussel/dart_jsonwebtoken/issues/9)
- **BREAKING CHANGE**: `jwt.verify` no longer support `throwUndefinedErrors` parameter
## 2.0.1

View File

@ -26,7 +26,7 @@ final jwt = JWT(
'loc': 'euw-2',
}
},
issuer: 'https://github.com/jonasroussel/jsonwebtoken',
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
);
// Sign it (default with HS256 algorithm)

View File

@ -30,7 +30,7 @@ void hs256() {
'loc': 'euw-2',
}
},
issuer: 'https://github.com/jonasroussel/jsonwebtoken',
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
);
// Sign it
@ -67,7 +67,7 @@ void rs256() {
'loc': 'euw-2',
}
},
issuer: 'https://github.com/jonasroussel/jsonwebtoken',
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
);
// Sign it
@ -110,7 +110,7 @@ void es256() {
'loc': 'euw-2',
}
},
issuer: 'https://github.com/jonasroussel/jsonwebtoken',
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
);
// Sign it

View File

@ -119,6 +119,7 @@ class JWT {
return JWT(
payload,
header: header,
audience: payload.remove('aud'),
issuer: payload.remove('iss'),
subject: payload.remove('sub'),
@ -143,6 +144,7 @@ class JWT {
this.subject,
this.issuer,
this.jwtId,
this.header,
});
/// Custom claims
@ -160,6 +162,9 @@ class JWT {
/// JWT Id claim
String? jwtId;
/// JWT header
Map<String, dynamic>? header;
/// Sign and generate a new token.
///
/// `key` must be
@ -175,7 +180,8 @@ class JWT {
bool noIssueAt = false,
}) {
try {
final header = {'alg': algorithm.name, 'typ': 'JWT'};
header ??= {};
header!.addAll({'alg': algorithm.name, 'typ': 'JWT'});
if (payload is Map<String, dynamic> || payload is Map<dynamic, dynamic>) {
try {

View File

@ -1,15 +1,15 @@
name: dart_jsonwebtoken
description: A dart implementation of the famous javascript library 'jsonwebtoken' (JWT).
version: 2.2.0
repository: https://github.com/jonasroussel/jsonwebtoken
homepage: https://github.com/jonasroussel/jsonwebtoken#readme
version: 2.3.0
repository: https://github.com/jonasroussel/dart_jsonwebtoken
homepage: https://github.com/jonasroussel/dart_jsonwebtoken#readme
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
crypto: ^3.0.1
pointycastle: ^3.0.1
pointycastle: ^3.1.1
convert: ^3.0.0
collection: ^1.15.0