Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

Adds outbound dm relay hint#193

Merged
reyamir merged 2 commits intolumehq:masterfrom
alltheseas:feature/dm-relay-hints
Oct 25, 2025
Merged

Adds outbound dm relay hint#193
reyamir merged 2 commits intolumehq:masterfrom
alltheseas:feature/dm-relay-hints

Conversation

@alltheseas
Copy link
Contributor

@alltheseas alltheseas commented Oct 24, 2025

Warning

These lines of code may be partially or fully hallucinations, and have not been reviwed by a professional dev.

Summary

  • Embed relay hints into outgoing DM rumors so each p tag now carries the receiver’s preferred relay URL.
  • Added a unit test that confirms relay hints are preserved when rewriting rumor tags.

Problem

DM rumors were emitted with bare ["p", ""] tags, violating NIP‑17 guidance and forcing receivers to guess which relay to query.

Solution

Look up each participant’s messaging relays before gift-wrapping, stash them in a cache, and rewrite the rumor’s p tags with the first available relay hint. A focused unit test verifies the rewrite.

Benefits

  • Aligns with the spec so receivers can fetch DMs directly from the hinted relay.
  • Improves interoperability with other clients that expect per-recipient hints.

Tradeoffs

  • Only the first relay per recipient is included (nostr TagStandard::PublicKey currently allows one hint).
  • Adds an extra tags clone per send, negligible at typical DM sizes.

Testing

  • cargo check -p coop
  • cargo test -p registry -- tests::updates_public_key_tag_with_relay_hint
  • Manual: RUST_LOG=registry=debug cargo run, send a DM, and confirm the log shows DEBUG registry::room: Sending DM rumor tags:
    [["p","","wss://…"]].

@reyamir reyamir merged commit 83687e5 into lumehq:master Oct 25, 2025
3 checks passed
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.

2 participants