JwtExpiry class

Helpers for JWT access-token expiry, for use with RefreshTokenInterceptor.isTokenExpired.

RefreshTokenInterceptor(
  tokenStore: tokenStore,
  refreshToken: refresh,
  isTokenExpired: JwtExpiry.isExpired,
)

Properties

hashCode int
The hash code for this object.
no setterinherited
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
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

expiryOf(String token) DateTime?
Returns the exp claim of token as a UTC timestamp, or null when the token is not a decodable JWT or carries no numeric exp.
isExpired(String token, {Duration leeway = defaultLeeway}) bool
Whether token is expired (with leeway as safety margin).

Constants

defaultLeeway → const Duration
Default safety margin: a token is treated as expired slightly before its real exp, so a request never departs with a token that dies mid-flight.