sign method
Sign JSON Web Token
Implementation
String sign(
Map<String, dynamic> payload,
String secret, {
JWTAlgorithm algorithm = JWTAlgorithm.HS256,
Duration? expiresIn,
Duration? notBefore,
bool noIssueAt = false,
Audience? audience,
String? subject,
String? issuer,
String? jwtId,
Map<String, dynamic>? header,
}) {
final jwt = JWT(
payload,
audience: audience,
subject: subject,
issuer: issuer,
jwtId: jwtId,
header: header,
);
final key = SecretKey(secret);
return jwt.sign(
key,
algorithm: algorithm,
expiresIn: expiresIn,
notBefore: notBefore,
noIssueAt: noIssueAt,
);
}