sign method
You can use this method to sign a message
with a privateKey
.
final signature = Nostr.instance.keysService.sign(
privateKey: yourPrivateKey,
message: yourMessage,
);
print(signature); // ...
Implementation
@override
String sign({
required String privateKey,
required String message,
}) {
final nostrKeyPairs = _keyPairFrom(privateKey);
final hexEncodedMessage =
Nostr.instance.utilsService.hexEncodeString(message);
final signature = nostrKeyPairs.sign(hexEncodedMessage);
utils.log(
"signed message with private key, with it's value is: $signature",
);
return signature;
}