Skip to content

NIP-59: prevent gift wrap events from being returned to non-recipients#138

Merged
mattn merged 2 commits into
fiatjaf:masterfrom
mattn:fix-nip59
Apr 8, 2026
Merged

NIP-59: prevent gift wrap events from being returned to non-recipients#138
mattn merged 2 commits into
fiatjaf:masterfrom
mattn:fix-nip59

Conversation

@mattn

@mattn mattn commented Feb 14, 2026

Copy link
Copy Markdown
Collaborator

NIP-59 requires relays to guard access to kind 1059 (gift wrap) events. While the existing implementation already enforced this on the write path (allowing recipients to delete their gift wraps), it did not enforce it on the read path. Any client could query for gift wrap events without authentication.

This change applies the same access control pattern already used for kind 4 (Encrypted Direct Messages) to kind 1059: unauthenticated users receive a CLOSED message, and authenticated users can only query gift wraps addressed to themselves via the p tag filter.

@mattn mattn merged commit 75931be into fiatjaf:master Apr 8, 2026
1 check 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.

1 participant