mirror of
https://github.com/jonasroussel/dart_jsonwebtoken.git
synced 2025-08-02 10:23:56 +08:00
v0.2.1
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:jsonwebtoken/jsonwebtoken.dart';
|
||||
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
|
||||
|
||||
abstract class JWTAlgorithm {
|
||||
static const HS256 = HS256Algorithm();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:jsonwebtoken/jsonwebtoken.dart';
|
||||
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
|
||||
|
||||
import './utils.dart';
|
||||
|
||||
@ -39,8 +39,8 @@ class JWT {
|
||||
issuer: payload.remove('iss'),
|
||||
subject: payload.remove('sub'),
|
||||
);
|
||||
} on JWTError catch (ex) {
|
||||
throw ex;
|
||||
} on JWTError {
|
||||
rethrow;
|
||||
} catch (ex) {
|
||||
throw JWTInvalidError('jwt invalid');
|
||||
}
|
||||
@ -61,7 +61,7 @@ class JWT {
|
||||
String sign(
|
||||
String key, {
|
||||
JWTAlgorithm algorithm = JWTAlgorithm.HS256,
|
||||
Duration expiresIn = null,
|
||||
Duration expiresIn,
|
||||
bool noTimestamp = false,
|
||||
}) {
|
||||
final header = {'alg': algorithm.name, 'typ': 'JWT'};
|
||||
|
Reference in New Issue
Block a user