sign method

  1. @override
String sign({
  1. required String privateKey,
  2. required String message,
})
override

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 = NostrKeyPairs(private: privateKey);
  final hexEncodedMessage =
      Nostr.instance.utilsService.hexEncodeString(message);
  final signature = nostrKeyPairs.sign(hexEncodedMessage);
  NostrClientUtils.log(
    "signed message with private key, with it's value is: $signature",
  );

  return signature;
}