sign method
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');
}