verify method

bool verify(
  1. List<int> digest,
  2. List<int> signature, {
  3. bool hashMessage = true,
})

Verifies the signature for the provided digest using the available key and hashing option.

This method verifies the signature of the provided digest using either ECDSA or EDDSA algorithms, based on the availability of the corresponding verification key. If hashMessage is true, the digest is hashed before verification. The method delegates to the appropriate verification algorithm and returns the result of the signature verification.

digest The digest to be verified. signature The signature to be verified. hashMessage Whether to hash the message before verification, defaults to true. returns True if the signature is verified, false otherwise.

Implementation

bool verify(List<int> digest, List<int> signature,
    {bool hashMessage = true}) {
  if (_edsaVerifyKey != null) {
    final messagaeHash =
        hashMessage ? QuickCrypto.sha512HashHalves(digest).item1 : digest;
    return _verifyEcdsa(messagaeHash, signature);
  }
  return _verifyEddsa(digest, signature);
}