Skip to content

Conversation

@alltheseas
Copy link
Contributor

Problem

Code review finding:

High – Private messages are only wrapped for the receiver, never for the sender.
  EventBuilder::private_msg builds a single gift wrap aimed at the target (crates/nostr/src/
  event/builder.rs:1534) and Client::send_private_msg forwards exactly that one event (crates/
  nostr-sdk/src/client/mod.rs:1205). NIP‑17 states that every unsigned kind‑14 “must be sealed
  and gift‑wrapped to each receiver and the sender individually.” Without generating the sender’s
  copy, users lose the “Fully Recoverable” guarantee, can’t sync their own history from their
  10050 relays, and can’t opt into disappearing messages by omitting the self wrap. The fix is
  to clone the rumor and call gift_wrap once per participant (including signer.get_public_key()),
  sending each wrap to the appropriate relay set.

Summary

Wrap each DM rumor for both receiver and author so senders keep history.

Tests

cargo test build_private_dm_wraps_produces_sender_copy --package nostr-sdk --lib --features nip59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant