JwtCodec class final
Signs and verifies JWTs (RFC 7519) with a key ring.
The first key signs; verification picks the key by kid when present,
otherwise tries every key of the token's algorithm — which is what makes
rotation painless: add the new key first, keep the old one for a while.
Constructors
Properties
- audience → String?
-
When set,
audis added on sign and required on verify.final - hashCode → int
-
The hash code for this object.
no setterinherited
- issuer → String?
-
When set,
issis added on sign and required on verify.final -
keys
→ List<
JwtKey> -
final
- leeway → Duration
-
Clock skew tolerated for
exp/nbf/iat.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sign(
Map< String, Object?> claims, {JwtKey? key}) → Future<String> -
Signs
claims. Missingiatis filled in;iss/audare added from the codec configuration when absent. -
toString(
) → String -
A string representation of this object.
inherited
-
verify(
String token) → Future< JwtClaims> - Verifies signature and time claims; throws JwtException otherwise.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited