mirror of
https://github.com/jonasroussel/dart_jsonwebtoken.git
synced 2025-08-06 13:51:08 +08:00
v2.3.0
This commit is contained in:
@ -1,6 +1,10 @@
|
|||||||
|
## 2.3.0
|
||||||
|
|
||||||
|
- Adding `header` in JWT class (you can now set your custom header)
|
||||||
|
|
||||||
## 2.2.0
|
## 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
|
- Dependencies: `ed25519_edwards` have been removed, `convert` & `collection` have been added
|
||||||
|
|
||||||
## 2.1.1
|
## 2.1.1
|
||||||
@ -9,7 +13,7 @@
|
|||||||
|
|
||||||
## 2.1.0
|
## 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
|
- **BREAKING CHANGE**: `jwt.verify` no longer support `throwUndefinedErrors` parameter
|
||||||
|
|
||||||
## 2.0.1
|
## 2.0.1
|
||||||
|
@ -26,7 +26,7 @@ final jwt = JWT(
|
|||||||
'loc': 'euw-2',
|
'loc': 'euw-2',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issuer: 'https://github.com/jonasroussel/jsonwebtoken',
|
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Sign it (default with HS256 algorithm)
|
// Sign it (default with HS256 algorithm)
|
||||||
|
@ -30,7 +30,7 @@ void hs256() {
|
|||||||
'loc': 'euw-2',
|
'loc': 'euw-2',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issuer: 'https://github.com/jonasroussel/jsonwebtoken',
|
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Sign it
|
// Sign it
|
||||||
@ -67,7 +67,7 @@ void rs256() {
|
|||||||
'loc': 'euw-2',
|
'loc': 'euw-2',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issuer: 'https://github.com/jonasroussel/jsonwebtoken',
|
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Sign it
|
// Sign it
|
||||||
@ -110,7 +110,7 @@ void es256() {
|
|||||||
'loc': 'euw-2',
|
'loc': 'euw-2',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issuer: 'https://github.com/jonasroussel/jsonwebtoken',
|
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Sign it
|
// Sign it
|
||||||
|
@ -119,6 +119,7 @@ class JWT {
|
|||||||
|
|
||||||
return JWT(
|
return JWT(
|
||||||
payload,
|
payload,
|
||||||
|
header: header,
|
||||||
audience: payload.remove('aud'),
|
audience: payload.remove('aud'),
|
||||||
issuer: payload.remove('iss'),
|
issuer: payload.remove('iss'),
|
||||||
subject: payload.remove('sub'),
|
subject: payload.remove('sub'),
|
||||||
@ -143,6 +144,7 @@ class JWT {
|
|||||||
this.subject,
|
this.subject,
|
||||||
this.issuer,
|
this.issuer,
|
||||||
this.jwtId,
|
this.jwtId,
|
||||||
|
this.header,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Custom claims
|
/// Custom claims
|
||||||
@ -160,6 +162,9 @@ class JWT {
|
|||||||
/// JWT Id claim
|
/// JWT Id claim
|
||||||
String? jwtId;
|
String? jwtId;
|
||||||
|
|
||||||
|
/// JWT header
|
||||||
|
Map<String, dynamic>? header;
|
||||||
|
|
||||||
/// Sign and generate a new token.
|
/// Sign and generate a new token.
|
||||||
///
|
///
|
||||||
/// `key` must be
|
/// `key` must be
|
||||||
@ -175,7 +180,8 @@ class JWT {
|
|||||||
bool noIssueAt = false,
|
bool noIssueAt = false,
|
||||||
}) {
|
}) {
|
||||||
try {
|
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>) {
|
if (payload is Map<String, dynamic> || payload is Map<dynamic, dynamic>) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
name: dart_jsonwebtoken
|
name: dart_jsonwebtoken
|
||||||
description: A dart implementation of the famous javascript library 'jsonwebtoken' (JWT).
|
description: A dart implementation of the famous javascript library 'jsonwebtoken' (JWT).
|
||||||
version: 2.2.0
|
version: 2.3.0
|
||||||
repository: https://github.com/jonasroussel/jsonwebtoken
|
repository: https://github.com/jonasroussel/dart_jsonwebtoken
|
||||||
homepage: https://github.com/jonasroussel/jsonwebtoken#readme
|
homepage: https://github.com/jonasroussel/dart_jsonwebtoken#readme
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
crypto: ^3.0.1
|
crypto: ^3.0.1
|
||||||
pointycastle: ^3.0.1
|
pointycastle: ^3.1.1
|
||||||
convert: ^3.0.0
|
convert: ^3.0.0
|
||||||
collection: ^1.15.0
|
collection: ^1.15.0
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user