isValidSchnorrSignature static method

bool isValidSchnorrSignature(
  1. List<int> signature
)

Implementation

static bool isValidSchnorrSignature(List<int> signature) {
  if (signature.length != CryptoSignerConst.schnoorSginatureLength &&
      signature.length != CryptoSignerConst.schnoorSginatureLength + 1) {
    return false;
  }

  final r = BigintUtils.fromBytes(signature.sublist(0, 32));

  final s = BigintUtils.fromBytes(signature.sublist(32, 64));
  if (r >= Curves.curveSecp256k1.p || s >= Curves.generatorSecp256k1.order!) {
    return false;
  }
  return true;
}