Gift Wrap
low level
Example
/// Wrap event:
// Create an original rumor event
final originalRumor = await ndk.giftWrap.createRumor(
content: 'Test message for gift wrap',
kind: 1,
tags: [],
);
// Wrap the rumor in a gift wrap
final giftWrap = await ndk.giftWrap.toGiftWrap(
rumor: originalRumor,
recipientPubkey: "<reciever public key>",
);
log(giftWrap.toString());
/// Unwrap event:
final recvEvent = await ndk.giftWrap.fromGiftWrap(giftWrap: giftWrap);
log(recvEvent.toString());
Gift Wrap depends on the logged in user (accounts usecase) make sure you are logged in with the right user
When to use
You can use Gift Wrap to obscure metadata. It also encrypts the content using nip44.
More information here: