sign method

List<int> sign(
  1. List<int> digest
)

Signs the provided digest using the appropriate algorithm based on the available signing key.

This method takes a digest as input and delegates the signing process to either the ED25519 or ECDSA algorithm based on the type of available signing key.

digest The digest to be signed. returns A list of bytes representing the generated signature using the appropriate algorithm.

Implementation

List<int> sign(List<int> digest) {
  if (_signingKey != null) {
    // If an EDDSA private key is available, use the ED25519 algorithm for signing.
    return _signEdward(digest);
  } else {
    // If an ECDSA signing key is available, use the ECDSA algorithm for signing.
    return _signEcdsa(digest);
  }
}