Commit graph

17 commits

Author SHA1 Message Date
725944ae9c Replace NIP-04 messaging with NIP-17 (NIP-44 + NIP-59 gift wrapping)
Modernize the entire customer-merchant communication layer from deprecated
NIP-04 (kind 4, AES-256-CBC) to NIP-17 private direct messages using
NIP-44 v2 encryption (ChaCha20 + HMAC-SHA256) and NIP-59 gift wrapping
(rumor/seal/gift-wrap protocol). No backwards compatibility retained.

New modules:
- nostr/nip44.py: NIP-44 v2 encryption verified against official spec vectors
- nostr/nip59.py: NIP-59 gift wrap with wrap/unwrap convenience functions
- tests/: 44 unit tests for NIP-44 and NIP-59

Key changes:
- Subscription filters: kind 4 → kind 1059 gift wraps
- Message handler: _handle_nip04_message → _handle_gift_wrap (unwrap + route)
- send_dm/reply_to_structured_dm: NIP-59 gift wrap to recipient + self-archive
- Merchant model: removed NIP-04 crypto methods (decrypt/encrypt/build_dm_event)
- helpers.py: removed NIP-04 functions, kept Schnorr signing + key normalization
- views_api.py: consolidated DM sending through send_dm() service function

Reliability improvements:
- Event deduplication via bounded LRU set in NostrClient
- Subscription health monitor (resubscribes after 120s of silence)
- Preserved 5-minute lenient time window from prior work

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-03 16:59:03 +02:00
Vlad Stan
de7fe059b8
V1 (#106)
Some checks failed
/ release (push) Has been cancelled
/ pullrequest (push) Has been cancelled
2024-11-06 11:50:21 +02:00
dni ⚡
3325626777
fix: properly start/stop tasks (#100)
Some checks failed
/ release (push) Has been cancelled
/ pullrequest (push) Has been cancelled
* fix: properly start/stop tasks

https://github.com/lnbits/lnbits/issues/2411
2024-05-27 12:47:39 +03:00
Vlad Stan
bdf0b77a51
Use private realay enpoint (#97)
Some checks failed
/ release (push) Has been cancelled
/ pullrequest (push) Has been cancelled
* feat: use private ws endpoint

* chore: bump `min_lnbits_version`

* fix: retry logic

* fix: restart logic

* chore: fux log message
2024-01-22 13:50:40 +02:00
Tiago Vasconcelos
5e06ffaaa1
allow custom path (#83)
* allow custom path

* fix: update min_lnbits_version to 0.11.0

---------

Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
2023-09-26 15:30:49 +03:00
Vlad Stan
2eeb130389 fix: append list to list 2023-05-04 14:28:06 +03:00
Vlad Stan
af780a3080 feat: add reconnect to nostrclient 2023-04-11 19:03:41 +03:00
Vlad Stan
1d099d19c4 subscribe after ws conection 2023-03-30 13:58:14 +03:00
Vlad Stan
97b9e30efd refactor: reorder and rename methods 2023-03-16 16:32:22 +02:00
Vlad Stan
62e54322f5 feat: extract nostr_client class 2023-03-16 16:01:14 +02:00
Vlad Stan
c976c9918a fix: create invoice for fresh merchant 2023-03-15 23:08:37 +02:00
Vlad Stan
d58c97f080 feat: user merchant_id instead of user_id 2023-03-14 14:31:30 +02:00
Vlad Stan
2912589b70 feat: create order on DM 2023-03-06 15:03:02 +02:00
Vlad Stan
3988933e40 feat: listen for direct messages 2023-03-03 18:24:53 +02:00
Vlad Stan
114c895732 chore: get the extension started 2023-02-28 09:19:27 +02:00
Tiago Vasconcelos
03825d9144 naming fix 2023-02-27 18:34:34 +00:00
Tiago Vasconcelos
5b23b0054b More skeleton 2023-02-27 18:32:13 +00:00