FirebaseMock class

A class that represents and validates claims extracted from a Firebase JWT token.

Constructors

FirebaseMock({required String alg, required String kid, required String aud, required int exp, required int iat, required int authTime, required String iss, required String sub})
Constructs a FirebaseMock with the decoded JWT header and payload values.

Properties

alg String
The algorithm used to sign the token (should be RS256).
final
aud String
The audience claim, usually the Firebase project ID.
final
authTime int
The authentication time (auth_time claim) of the token.
final
exp int
The expiration time (exp claim) of the token.
final
hashCode int
The hash code for this object.
no setterinherited
iat int
The issued-at time (iat claim) of the token.
final
iss String
The issuer claim (iss), should match the Firebase issuer URL.
final
kid String
The key ID used to match the correct public key for signature verification.
final
projectID String
Returns the project ID from the aud claim.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sub String
The subject claim (sub), represents the user's UID.
final
validateAlg bool
Validates the algorithm used in the token.
no setter
validateExpIatAuthTime Future<bool>
Validates exp, iat, and auth_time claims using the current accurate time. The exp claim must be in the future, while iat and auth_time must be in the past.
no setter
validateIss bool
Validates that the issuer matches the expected Firebase URL format.
no setter
validateSub bool
Validates that the subject claim (sub) is not empty.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a readable string representation of the claims.
override
validateKeysByKid(List<String> keys) bool
Checks whether the token's kid is present in the list of known public keys.
validateProjectID(List<String> projectIds) bool
Validates that the aud claim matches one of the provided Firebase project IDs.

Operators

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

Static Methods

fromValue(Map<String, dynamic> headers, Map<String, dynamic> payload) FirebaseMock
Creates a FirebaseMock from the token header and payload maps.

Constants

defaultAlg → const String
The expected algorithm for Firebase tokens.