sign method
Sign a given message with the private key.
The message
is a Uint8List representing the data to be signed.
Example:
final keyPair = KeyPair.sr25519.fromSeed(seed); // Replace with your actual seed
final message = Uint8List.fromList([1, 2, 3, 4, 5]);
final signature = keyPair.sign(message);
Implementation
@override
Uint8List sign(Uint8List message) {
if (_isLocked) {
throw Exception('KeyPair is locked. Unlock it before signing.');
}
return sr25519.Sr25519.sign(_privateKey, message).encode();
}