verify function

bool verify(
  1. String publicKey,
  2. String message,
  3. String signature
)

Verifies a schnorr signature using the BIP-340 scheme.

publicKey must be 32-bytes hex-encoded, i.e., 64 characters (if you have a pubkey with 33 bytes just remove the first one). message must also be 32-bytes hex-encoded (a hash of the actual message). signature must be 64-bytes hex-encoded, i.e., 128 characters. It returns true if the signature is valid, false otherwise. For more information on BIP-340 see bips.xyz/340.

Implementation

bool verify(String publicKey, String message, String signature) {
  ECPoint point;
  try {
    point = publicKeyToPoint(publicKey);
  } catch (err) {
    return false;
  }
  return verifyWithPoint(point, message, signature);
}