JwtService class

Serviço de token JWT (HS256) — emite e valida tokens próprios do app. Para Firebase Auth, veja FirebaseAuthVerifier (valida o ID token do Firebase).

Constructors

JwtService(String secret, {String? issuer})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
issuer String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secret String
Segredo HMAC — leia do .env (JWT_SECRET), nunca hardcode.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sign(Map<String, Object?> claims, {Duration expiresIn = const Duration(days: 7)}) String
Emite um token assinado com claims (ex.: {sub, email, role}).
toString() String
A string representation of this object.
inherited
verify(String token) Map<String, Object?>?
Valida o token; retorna os claims ou null se inválido/expirado.

Operators

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