trySign method
String?
trySign(
- JWTKey key, {
- JWTAlgorithm algorithm = JWTAlgorithm.hs256,
- Duration? expiresIn,
- Duration? notBefore,
- bool noIssueAt = false,
Exactly like sign
, just return null
instead of throwing errors.
Implementation
String? trySign(
JWTKey key, {
JWTAlgorithm algorithm = JWTAlgorithm.hs256,
Duration? expiresIn,
Duration? notBefore,
bool noIssueAt = false,
}) {
try {
return sign(
key,
algorithm: algorithm,
expiresIn: expiresIn,
notBefore: notBefore,
noIssueAt: noIssueAt,
);
} catch (ex) {
return null;
}
}