verifyJWT function

Future<bool> verifyJWT(
  1. String jwt
)

Implementation

Future<bool> verifyJWT(String jwt) {
  final decoded = decodeJWT(jwt);
  if (decoded.header.alg != JWT_IRIDIUM_ALG ||
      decoded.header.typ != JWT_IRIDIUM_TYP) {
    throw WCException("JWT must use EdDSA algorithm");
  }
  final publicKey = decodeIss(decoded.payload.iss);
  // const type = KeyPairType.ed25519;
  // final signature = Signature(
  //   decoded.signature,
  //   publicKey: SimplePublicKey(publicKey, type: type),
  // );
  return Future.value(
      ed.verify(ed.PublicKey(publicKey), decoded.data, decoded.signature));
}