feat(nip17): support gift-wrapped private direct messages
Generalize the AUTH-gated, recipient-only delivery rule from NIP-04 to also cover NIP-17 kind 1059 gift wraps. When the relay is configured to require AUTH for kind 1059, only the AUTH'd recipient named in the event's `p` tag receives it; otherwise gift wraps broadcast like any regular event. - relay/event.py: add `is_seal`, `is_gift_wrap`, `is_private_message` helpers (kinds 13, 1059) - relay/client_connection.py: rename `_is_direct_message_for_other` -> `_is_private_event_for_other`; key off `is_private_message` so the same gating applies to kinds 4 and 1059 - relay/relay.py: advertise NIPs 17, 44, 59 in NIP-11 supported_nips - README: document NIP-17/44/59 transport-level support - tests/test_nip17.py: unit tests for kind classification, AUTH-gated 1059 delivery (recipient vs non-recipient vs unauthenticated), and regression coverage for kind 4 gating NIP-44 (encryption) and NIP-59 (wrap/seal) are client-side concerns; the relay treats payloads as opaque ciphertext and stores kind 1059 like any regular event. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b74af2628e
commit
4811fcf352
5 changed files with 166 additions and 8 deletions
10
README.md
10
README.md
|
|
@ -35,6 +35,12 @@
|
|||
- [x] Regular Events
|
||||
- [x] Replaceable Events
|
||||
- [x] Ephemeral Events
|
||||
- [x] **NIP-17**: Private Direct Messages
|
||||
- `kind: 1059` gift wraps stored and broadcast like regular events
|
||||
- if `AUTH` enabled for `kind: 1059`: deliver only to the recipient
|
||||
named in the `p` tag (same gating as NIP-04)
|
||||
- encryption (NIP-44) and wrapping (NIP-59) are client-side concerns;
|
||||
the relay handles transport only
|
||||
- [x] **NIP-20**: Command Results
|
||||
- todo: use correct prefixes
|
||||
- [x] **NIP-22**: Event created_at Limits
|
||||
|
|
@ -48,8 +54,12 @@
|
|||
- todo
|
||||
- [x] **NIP-42**: Authentication of clients to relays
|
||||
- todo: use correct prefix
|
||||
- [x] **NIP-44**: Encrypted Payloads (Versioned)
|
||||
- relay treats payloads as opaque; encryption is client-side
|
||||
- [ ] **NIP-50**: Search Capability
|
||||
- todo
|
||||
- [x] **NIP-59**: Gift Wrap
|
||||
- `kind: 13` (seal) and `kind: 1059` (gift wrap) accepted; unwrapping is client-side
|
||||
|
||||
## Create Relay
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue