Skip to content

Add NIP-17 kind 10050 (DM relay list) support for reliable cross-client DM delivery #43

@alltheseas

Description

@alltheseas

Problem

Vector does not implement NIP-17 kind 10050 (DM relay list) support. This means:

  • No publishing: Vector never publishes a kind 10050 event to advertise where it receives DMs
  • No fetching: Vector never looks up a recipient's kind 10050 to discover their preferred DM inbox relays
  • No targeted routing: DM gift wraps are broadcast to all pool relays via client.gift_wrap() instead of being sent to the recipient's preferred relays

Current behavior

  • message/sending.rs:852 — DM sends use client.gift_wrap() which broadcasts to all connected pool relays
  • Cross-client DMs (e.g. with 0xchat) only work if there happens to be relay overlap (e.g. relay.damus.io)
  • If a recipient uses DM-specific inbox relays (common with NIP-17 compliant clients), messages may never arrive

Evidence that targeted delivery is already possible

gift_wrap_to() is already used in Vector for:

  • Typing indicators → commands/realtime.rs:50
  • WebXDC peer ads → commands/realtime.rs:137

The same pattern should be applied to DM message sends.

Proposed Solution

  1. Publish kind 10050 on login/relay config change — advertise Vector's connected relays as DM inbox relays
  2. Fetch recipient's kind 10050 before sending a DM — look up their preferred DM relays
  3. Use client.gift_wrap_to(recipient_dm_relays, ...) instead of client.gift_wrap(...) for DM sends
  4. Fallback: if no kind 10050 is found for the recipient, fall back to current broadcast behavior

Impact

Without this, DM interoperability with other NIP-17 compliant clients (0xchat, etc.) is unreliable and depends on coincidental relay overlap rather than proper protocol-level relay discovery.

References

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions