jwtDecode function
Implementation
Map<String, dynamic> jwtDecode(String jwt, {required String algorithm, required Key key}) {
Map<String, dynamic>? decoded;
if (algorithm == 'EdDSA') {
if (!(key is OkpKey)) {
throw FormatException("EdDSA algorithm must use OKP key");
}
if (key.crv != 'Ed448') {
throw UnsupportedError(
"jwtDecode using the EdDSA algorithm currently only supports Ed448"
);
}
decoded = _ed448JwtDecode(jwt, key);
}
if (decoded == null) {
throw UnsupportedError("jwtDecode currently only supports EdDSA algorithm");
}
_validateClaims(decoded);
return decoded;
}