NIP-17: Private Direct Messages
NIP-17 defines private direct messages using NIP-59 gift wrapping for sender privacy. Unlike NIP-04 DMs which expose the sender, NIP-17 messages hide who sent the message. The recipient remains visible in the outer gift wrap.
How It Works
Messages are wrapped in multiple encryption layers:
- The actual message content (kind 14)
- A seal that encrypts the content to the recipient
- A gift wrap that hides the sender’s identity
The outer gift wrap uses a random, disposable keypair so relays and observers cannot determine who sent the message.
Message Structure
- Kind 14 - The actual DM content (inside the seal)
- Uses NIP-44 encryption for the content
- Supports reactions (kind 7) within DM conversations
Privacy Guarantees
- Relays cannot see the sender (hidden by gift wrap’s disposable keypair)
- Recipient is visible (in the
ptag of the gift wrap) - Message timestamps are randomized within a window
- No visible threading or conversation grouping on the relay
Comparison to NIP-04
NIP-04 DMs encrypt content but leave metadata visible:
- Sender pubkey is public
- Recipient pubkey is in the
ptag - Timestamps are exact
NIP-17 hides the sender at the cost of more complex implementation.
Primary sources:
Mentioned in:
See also: