Jwt class

A JSON Web Token: a JwtHeader plus a JwtPayload, with signing and verification.

The signature is the raw third-segment bytes when the token was produced externally (e.g. OIDC IdP signatures, which cannot be generated here). Unsigned flows (e.g. WalletConnect) leave it null and keep the historical two-segment serialization untouched.

Constructors

Jwt({required JwtHeader header, required JwtPayload payload, List<int>? signature})
const
Jwt.deserialize(String jwt)
factory
Jwt.deserializeOidc(String jwt)
Parses a signed compact serialization (header.payload.signature), keeping the third segment as signature instead of verifying it. Signature verification (OIDC, JWKs, …) happens at the call site.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
final
payload → JwtPayload
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
signature → List<int>?
Raw signature bytes (third compact-serialization segment), if any.
final

Methods

attachSignature(List<int> signature) → String
Attaches an externally produced signature (e.g. IdP JWT signatures) and returns the full three-segment compact serialization.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serialize() → String
sign({required List<int> key, JwtSupportedAlgorithm? alg}) → String
toString() → String
A string representation of this object.
inherited

Operators

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