Skip to content

feat(nostr): switch to gift-wrapped events#6677

Merged
CommanderStorm merged 4 commits intolouislam:masterfrom
tionis:master
Jan 12, 2026
Merged

feat(nostr): switch to gift-wrapped events#6677
CommanderStorm merged 4 commits intolouislam:masterfrom
tionis:master

Conversation

@tionis
Copy link
Copy Markdown
Contributor

@tionis tionis commented Jan 11, 2026

Summary

The old implementation used the old soft-deprecated NIP-04 format for private DMs.
This PR changes it to use NIP-17 which uses gift-wrapped events to hide metadata, specifically who is writing to whom. This prevents leaking metadata about the uptime kuma instance to the public via the nostr relays.

Please follow this checklist to avoid unnecessary back and forth (click to expand)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
    I understand that I am responsible for and able to explain every line of code I submit.
  • 🔍 Any UI changes adhere to visual style of this project.
  • 🛠️ I have self-reviewed and self-tested my code to ensure it works as expected.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 I added or updated automated tests where appropriate.
  • 📄 Documentation updates are included (if applicable).
  • 🧰 Dependency updates are listed and explained.
  • ⚠️ CI passes and is green.

The old implementation used the old nip04 format for private DMs
This changes it to use NIP17 which uses gift-wrapped events to
hide metadata, specifically who is writing to whom.
This prevents leaking metadata about the uptime kuma instance to
the public via the nostr relays.
Copilot AI review requested due to automatic review settings January 11, 2026 18:14
@github-actions
Copy link
Copy Markdown
Contributor

Hello! Thank you for your contribution 👋

As this is your first contribution, please be sure to check out our
Pull Request guidelines.

In particular:

  • Mark your PR as Draft while you’re still making changes
  • Mark it as Ready for review once it’s fully ready 🟢

If you have any design or process questions, feel free to ask them right here in this pull request - unclear documentation is a bug too.

Thanks for lending a paw to Uptime Kuma 🐻

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Nostr notification provider to use NIP-17 gift-wrapped events (via NIP-59) instead of the deprecated NIP-04 format for private direct messages. This change enhances privacy by hiding metadata about sender/recipient relationships from public relays.

Changes:

  • Switched from NIP-04 encrypted direct messages to NIP-17 private direct messages with NIP-59 gift wrapping
  • Simplified Node.js version-specific polyfill code to only handle WebSocket
  • Updated nostr-tools dependency from v2.10.4 to v2.17.0

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
server/notification-providers/nostr.js Replaced NIP-04 encryption with NIP-59 gift-wrapped events and removed version-specific crypto polyfills
package.json Updated nostr-tools dependency to v2.17.0 to support NIP-59 functionality

Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what this code is doing precisely, but I trust You to know what you are doing there.

Could you share a screenshot of this working?

@CommanderStorm CommanderStorm changed the title feat(notifications/nostr): switch to gift-wrapped events feat(nostr): switch to gift-wrapped events Jan 12, 2026
@CommanderStorm CommanderStorm added the pr:please address review comments this PR needs a bit more work to be mergable label Jan 12, 2026
@tionis
Copy link
Copy Markdown
Contributor Author

tionis commented Jan 12, 2026

Sure, I tested it using an android app for nostr DMs as other clients completely ignore NIP-04 DMs (the older format used before this PR).

Testing NIP-04 nostr notifications (the old setup)

The message received in the 0xchat app (with the warning). The warning popup when clicking on the yellow i.
Screenshot_20260112_032000_0xChat Screenshot_20260112_032020_0xChat

Testing NIP-17 nostr notifications (the new setup)

The setup interface during testing The message received in the 0xchat app.
image Screenshot_20260112_032118_0xChat

Is there anything else you need? The change is a bit difficult to show in a screenshot as its purely internal/on the protocol level.

@tionis tionis requested a review from CommanderStorm January 12, 2026 02:37
Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@CommanderStorm CommanderStorm merged commit 0981fee into louislam:master Jan 12, 2026
26 checks passed
@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Jan 12, 2026
@CommanderStorm
Copy link
Copy Markdown
Collaborator

FYI: if you want to use this, it is in our next nightly release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:please address review comments this PR needs a bit more work to be mergable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants