tryVerify static method
Exactly like verify
, just return null instead of throwing exceptions.
Implementation
static JWT? tryVerify(
String token,
JWTKey key, {
bool checkHeaderType = true,
bool checkExpiresIn = true,
bool checkNotBefore = true,
Duration? issueAt,
Audience? audience,
String? subject,
String? issuer,
String? jwtId,
}) {
try {
return verify(
token,
key,
checkHeaderType: checkHeaderType,
checkExpiresIn: checkExpiresIn,
checkNotBefore: checkNotBefore,
issueAt: issueAt,
audience: audience,
subject: subject,
issuer: issuer,
jwtId: jwtId,
);
} catch (ex) {
return null;
}
}