Commit graph

32 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
0ebd5f642c add DEBUG logs 2026-04-24 01:59:27 -04: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
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
Vlad Stan
97ee1c8f49
Fix high load (#84)
* chore: testing

* fix: resubscribe when merchant added/removed

* chore: code clean-up

* fix: temp subscribe when new merchant is added

* fix: new customer profile
2023-09-20 09:17:01 +03:00
Vlad Stan
f2773e0b44
Fix subscription errors (#81)
* pref: merge filters in one

* chore: load nit

* feat: restore individual order
2023-09-12 15:03:37 +03:00
Vlad Stan
da284ba768 feat: prepare for merchant active/restoring state 2023-07-04 08:40:49 +02:00
Vlad Stan
33adae672d
Product delete (#64)
* feat: restore stalls from `nostr` as pending

* feat: stall and prod last update time

* feat: restore products and stalls as `pending`

* feat: show pending stalls

* feat: restore stall

* feat: restore a stall from nostr

* feat: add  blank `Restore Product` button

* fix: handle no talls to restore case

* feat: show restore dialog

* feat: allow query for pending products

* feat: restore products

* chore: code clean-up

* fix: last dm and last order query

* chore: code clean-up

* fix: subscribe for stalls and products on merchant create/restore

* feat: add message type to orders

* feat: simplify messages; code format

* feat: add type to DMs; restore DMs from nostr

* fix: parsing ints

* fix: hide copy button if invoice not present

* fix: do not generate invoice if product not found

* feat: order restore: first version

* refactor: move some logic into `services`

* feat: improve restore UX

* fix: too many calls to customer DMs

* fix: allow `All` customers filter

* fix: ws reconnect on server restart

* fix: query for customer profiles only one

* fix: unread messages per customer per merchant

* fix: disable `user-profile-events`

* fix: customer profile is optional

* fix: get customers after new message debounced

* chore: code clean-up

* feat: auto-create zone

* feat: fixed ID for default zone

* feat: notify order paid
2023-06-30 13:12:56 +03:00
Vlad Stan
9dac1d25b2 feat: keep customer profiles up to date 2023-03-30 13:58:14 +03: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
108caa3014 fix: publish events via websocket 2023-03-14 16:00:01 +02:00
Vlad Stan
d58c97f080 feat: user merchant_id instead of user_id 2023-03-14 14:31:30 +02:00
Vlad Stan
fa6b07ff37 feat: optimize filtering for DMs 2023-03-14 14:31:30 +02:00
Vlad Stan
caaca7bf88 refactor: clean-up tasks.py 2023-03-14 14:31:30 +02:00
Vlad Stan
d22c06e1e7 refactor: extract handle_order_paid 2023-03-14 14:31:30 +02:00
Vlad Stan
cefbb01569 feat: base for getting out messages 2023-03-14 14:31:30 +02:00
Vlad Stan
70effcc515 feat: store event_created_at for some events 2023-03-14 14:31:30 +02:00
Vlad Stan
c355e3111c feat: basic chat 2023-03-14 14:31:30 +02:00
Vlad Stan
5e6e9b8d26 feat: save incoming DMs 2023-03-14 14:31:30 +02:00
Vlad Stan
30511b1fce feat: add ship/unship functionality 2023-03-07 14:30:58 +02:00
Vlad Stan
aa0d662a4f feat: handle order paid 2023-03-07 13:10:01 +02:00
Vlad Stan
f98e66038d feat: show more details about the order 2023-03-07 12:00:43 +02:00
Vlad Stan
fc02609d47 feat: show orders per stall 2023-03-07 10:31:25 +02:00
Vlad Stan
dd47c6c64b refactor: extract simpler methods 2023-03-06 18:01:05 +02:00
Vlad Stan
8cdcb144b9 feat: send invoice back for order 2023-03-06 17:33:55 +02:00
Vlad Stan
12c32b019f feat: return payment-request for order 2023-03-06 16:31:34 +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
375b214625 feat: add landing page 2023-02-28 10:39:11 +02:00
Vlad Stan
e15cf30578 chore: code format 2023-02-28 09:44:46 +02:00
Vlad Stan
114c895732 chore: get the extension started 2023-02-28 09:19:27 +02:00