sign method

Signature sign(
  1. KeyPair keyPair,
  2. Uint8List message,
  3. SignatureType type
)

Sign byte message message using keyPair

Implementation

Signature sign(KeyPair keyPair, Uint8List message, SignatureType type) {
  var messageBytes = Int8List.fromList(message);
  if (messageBytes.isEmpty) {
    throw Exception('Message Invalid!');
  }
  if (type == SignatureType.STANDARD) {
    var signature = _signStandard(keyPair, messageBytes);
    if (signature == null) {
      throw Exception('Message length exceeds maximum length');
    }
    return signature;
  }

  if (type == SignatureType.VRF) {
    var signature = _signVRF(keyPair, messageBytes);
    if (signature == null) {
      throw Exception('Message length exceeds maximum length');
    }
    return signature;
  }

  throw Exception('Signature Could not be generated at this time');
}