JWT class

Constructors

JWT(dynamic payload, {String? subject, String? issuer, String? jwtId, Map<String, dynamic>? header})
JSON Web Token

Properties

hashCode int
The hash code for this object.
no setterinherited
JWT header
getter/setter pair
issuer String?
Issuer claim
getter/setter pair
jwtId String?
JWT Id claim
getter/setter pair
payload ↔ dynamic
Custom claims
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subject String?
Subject claim
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sign(JWTKey key, {JWTAlgorithm algorithm = JWTAlgorithm.hs256, Duration? expiresIn, Duration? notBefore, bool noIssueAt = false}) String
Sign and generate a new token with key. Key must be SecretKey with HMAC algorithm
toString() String
A string representation of this object.
inherited
trySign(JWTKey key, {JWTAlgorithm algorithm = JWTAlgorithm.hs256, Duration? expiresIn, Duration? notBefore, bool noIssueAt = false}) String?
Exactly like sign, just return null instead of throwing errors.

Operators

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

Static Methods

decode(String token) JWT
Decode a token without checking its signature
tryDecode(String token) JWT?
Exactly like decode, just return null instead of throwing errors.
tryVerify(String token, JWTKey key, {bool checkHeaderType = true, bool checkExpiresIn = true, bool checkNotBefore = true, Duration? issueAt, String? subject, String? issuer, String? jwtId}) JWT?
Exactly like verify, just return null instead of throwing errors.
verify(String token, JWTKey key, {bool checkHeaderType = true, bool checkExpiresIn = true, bool checkNotBefore = true, Duration? issueAt, String? subject, String? issuer, String? jwtId}) JWT
Verify Token