Jwt.encode constructor

Jwt.encode(
  1. String key,
  2. Map<String, String?> claims, {
  3. String subject = "jwt",
  4. String issuer = "fml.client",
  5. List<String>? audience,
  6. int shelflife = 60,
})

Implementation

factory Jwt.encode(String key, Map<String, String?> claims, {String subject = "jwt", String issuer = "fml.client", List<String>? audience, int shelflife = 60})
{
  // we could have done this quite simply ourselves, however, for the sake of time, use package
  // future todo - encode ourselves
  final _claims = JwtClaim(subject: subject, issuer: issuer, audience: audience, otherClaims: claims, maxAge: Duration(minutes: shelflife));
  String token = issueJwtHS256(_claims, key);
  return new Jwt(token);
}