Skip to content

Add NIP-17 encrypted DM support to account support page#9

Merged
v0l merged 3 commits into
mainfrom
copilot/support-direct-messages-nip17
Feb 27, 2026
Merged

Add NIP-17 encrypted DM support to account support page#9
v0l merged 3 commits into
mainfrom
copilot/support-direct-messages-nip17

Conversation

Copilot AI commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Adds end-to-end encrypted direct messaging with the support team using NIP-17 (Gift Wrap / NIP-59) in the account support page.

New component: src/components/nip17-dm.tsx

  • Subscribes to kind 1059 (GiftWrap) events tagged to the user's pubkey via useRequestBuilder with leaveOpen: true
  • Decrypts incoming messages through the full NIP-17 stack: unwrapGift()unsealRumor() → rumor content; filters to only show messages involving the support pubkey
  • Sends messages by creating an unsigned kind 14 chat rumor, then sealing + gift-wrapping for both the support account and self (preserves sent message history)
const rumor = signer.createUnsigned(EventKind.ChatRumor, content, (eb) =>
  eb.tag(["p", supportPubkey]),
);
const wrapForSupport = await signer.giftWrap(
  await signer.sealRumor(rumor, supportPubkey), supportPubkey,
);
const wrapForSelf = await signer.giftWrap(
  await signer.sealRumor(rumor, myPubkey), myPubkey,
);
login.system.BroadcastEvent(wrapForSupport);
login.system.BroadcastEvent(wrapForSelf);
  • Uses a useRef set to track processed event IDs, avoiding redundant decryption on re-renders
  • Chat UI: sent messages right-aligned, received left-aligned; auto-scrolls to latest

Updated: src/pages/account-support.tsx

  • Adds a "Direct Messages" section rendering <Nip17DM /> above the existing contact form
Original prompt

This section details on the original issue you should resolve

<issue_title>Messages</issue_title>
<issue_description>Support direct support messages via NIP-17 DM's in the account page.

You can see an example of how to implement it here: https://github.com/v0l/snort/blob/main/packages/app/src/chat/nip17.ts</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: v0l <1172179+v0l@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for direct messages via NIP-17 on account page Add NIP-17 encrypted DM support to account support page Feb 27, 2026
- Add /account/messages route with AccountMessagesPage
- Add Messages nav item to account sidebar
- Remove DM section from Support page
- Cache decrypted gift wraps in localStorage keyed by pubkey
- Seed Nostr request with since= timestamp from newest cached message
@v0l
v0l marked this pull request as ready for review February 27, 2026 14:34
@v0l
v0l merged commit 89cd342 into main Feb 27, 2026
1 check passed
@v0l
v0l deleted the copilot/support-direct-messages-nip17 branch February 27, 2026 14:38
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.

Messages

2 participants