verifyTransaction method

bool verifyTransaction(
  1. List<int> digest,
  2. List<int> derSignature
)

Verifies an ECDSA signature against a given transaction digest.

Implementation

bool verifyTransaction(List<int> digest, List<int> derSignature) {
  int lengthR = derSignature[3];
  int lengthS = derSignature[5 + lengthR];
  List<int> rBytes = derSignature.sublist(4, 4 + lengthR);
  final int sIndex = 4 + lengthR + 2;
  List<int> sBytes = derSignature.sublist(sIndex, sIndex + lengthS);
  final signature = ECDSASignature(
      BigintUtils.fromBytes(rBytes), BigintUtils.fromBytes(sBytes));
  return verifyKey.verify(signature, digest);
}