expressSign function
Issues a HMAC SHA-256 signed JWT.
Creates a JWT using the claimSet
for the payload and signing it using
the hmacKey
with the HMAC SHA-256 algorithm.
Throws a JsonUnsupportedObjectError if any of the Claim Values are not suitable for a JWT.
id
is the user id you are trying to encrypt
secretKey
is your personal encryption key. Should be kept save.
Implementation
String expressSign(String id, String secretKey,
{String? issuer,
List<String>? audience,
Map<String, dynamic>? otherClaims,
Duration? maxAge}) {
final claimSet = JwtExpress(
subject: id,
issuer: issuer ?? null,
audience: audience ?? null,
otherClaims: otherClaims ?? null,
maxAge: maxAge ?? null);
String token = issueExpressToken(claimSet, secretKey);
return token;
}