Skip to content

Conversation

@alltheseas
Copy link
Contributor

Problem

Code review reveals:

- Medium – Default send path ignores the receiver’s NIP‑17 readiness and blasts DMs to every
  write relay. When ClientOptions::gossip remains at its default false, send_private_msg drops
  into self.send_event(&event) (crates/nostr-sdk/src/client/mod.rs:1216), which neither looks up
  the receiver’s kind‑10050 relays nor enforces the “if that list is not found clients shouldn’t
  try” rule from NIP‑17. The readiness check (Error::PrivateMsgRelaysNotFound) only exists inside
  gossip_send_event (crates/nostr-sdk/src/client/mod.rs:1658), so the spec requirement is never
  met out of the box. Consider moving the inbox‑relay lookup before the gossip gate (or enabling
  gossip by default) so you refuse to send when the receiver has no 10050 entry and only publish
  to the listed relays.

Summary

When gossip is off, look up receivers’ 10050 inbox relays before sending.\n* Refuse to send if no
relays exist, matching the NIP‑17 readiness requirement.

Testing

Adds regression test: cargo test send_private_msg_without_inbox_relays_errors --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