verifyJWT method

  1. @override
Future<bool> verifyJWT(
  1. String jwt
)
override

Implementation

@override
Future<bool> verifyJWT(String jwt) async {
  JWTDecoded decoded = decodeJWT(jwt);

  // Check the header
  if (decoded.header.alg != JWTHeader.JWT_ALG ||
      decoded.header.typ != JWTHeader.JWT_TYP) {
    throw VerifyJWTError(
      jwt,
      'JWT must use EdDSA algorithm',
    );
  }

  final Uint8List publicKey = decodeIss(decoded.payload.iss);
  return ed.verify(
    ed.PublicKey(publicKey),
    Uint8List.fromList(decoded.data),
    Uint8List.fromList(decoded.signature),
  );
  // final VerifyKey vKey = VerifyKey(publicKey);
  // final SignedMessage signedMessage = SignedMessage.fromList(
  //   signedMessage: Uint8List.fromList(
  //     decoded.signature,
  //   ),
  // );
  // return vKey.verify(
  //   signature: signedMessage.signature,
  //   message: Uint8List.fromList(decoded.data),
  // );
}