Commit graph

234 commits

Author SHA1 Message Date
Patrick Mulligan
5e95b309fe make format
Some checks are pending
CI / lint (push) Waiting to run
CI / tests (push) Blocked by required conditions
/ release (push) Waiting to run
/ pullrequest (push) Blocked by required conditions
2025-11-17 00:01:21 +01:00
Patrick Mulligan
8547864254 docs: Update README with complete NIP-09 deletion support
Updated NIP-09 section to document full implementation including:
  - 'e' tags for deleting regular events by event ID
  - 'a' tags for deleting addressable events by address format (kind:pubkey:d-identifier)

  This reflects the implementation added in commits 3ba3318 and 538fe42 which brought the relay into full NIP-09 compliance.
2025-11-17 00:01:21 +01:00
Patrick Mulligan
dcc3204735 Fix NIP-09 deletion for parameterized replaceable events (NIP-33)
Fixed bug where deleting a parameterized replaceable event (e.g., kind 31922)
using an 'a' tag would incorrectly delete ALL events of that kind instead of
just the specific event with the matching d-tag.

**Root Cause:**
NostrFilter's 'd' field uses a Pydantic Field alias "#d". When creating a filter
with `NostrFilter(d=[value])`, Pydantic ignores it because the parameter name
doesn't match the alias.

**Fix:**
Changed filter creation to use the alias:
```python
NostrFilter(authors=[...], kinds=[...], **{"#d": [d_tag]})
```

**Testing:**
- Created two tasks with different d-tags
- Deleted only one task
- Verified only the specified task was marked as deleted in the database
- Confirmed the other task remained unaffected

This ensures proper NIP-09 deletion behavior for NIP-33 parameterized
replaceable events using 'a' tag format (kind:pubkey:d-identifier).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 00:01:21 +01:00
Patrick Mulligan
8bfd792548 Add NIP-09 support for parameterized replaceable events (NIP-33)
Extended NIP-09 deletion event handling to support both regular events
and parameterized replaceable events (NIP-33).

**Previous behavior:**
- Only handled 'e' tags (regular event IDs)
- Did not support 'a' tags for addressable/replaceable events

**New behavior:**
- Handles both 'e' tags (event IDs) and 'a' tags (event addresses)
- Parses 'a' tag format: kind:pubkey:d-identifier
- Validates deletion author matches event address pubkey (NIP-09 requirement)
- Creates appropriate filters for each deletion type

**Implementation:**
- Added parsing for 'a' tag event addresses
- Extract kind, pubkey, and d-tag from address format
- Build NostrFilter with authors, kinds, and d-tag parameters
- Collect all event IDs to delete from both 'e' and 'a' tags
- Mark matching events as deleted in single operation

This enables proper deletion of parameterized replaceable events like
calendar events (kind 31922-31924), long-form content (kind 30023),
and other addressable event kinds.

Implements NIP-09: https://github.com/nostr-protocol/nips/blob/master/09.md
Supports NIP-33: https://github.com/nostr-protocol/nips/blob/master/33.md
2025-11-17 00:01:21 +01:00
Vlad Stan
c4efb87b70
chore: bump version (#41)
Some checks failed
CI / lint (push) Has been cancelled
CI / tests (push) Has been cancelled
2025-11-13 12:44:22 +02:00
dni ⚡
a53d2d7767
refactor: get rid of secp lib (#40) 2025-11-04 10:30:43 +02:00
dni ⚡
35584a230f
chore: add uv, linting, fixes (#39)
Some checks failed
CI / lint (push) Has been cancelled
/ release (push) Has been cancelled
CI / tests (push) Has been cancelled
/ pullrequest (push) Has been cancelled
* chore: add uv, linting, fixes
2025-10-30 10:43:27 +01:00
PatMulligan
15079c3e58
fix(nostrrelay): use schema-qualified table name in delete_events (#38) 2025-10-27 09:54:29 +02:00
PatMulligan
22df5868de
FEAT: Implement NIP-01 Addressable Events Support (#33)
* Implement NIP-16 parameterized replaceable events

Add support for parameterized replaceable events (kinds 30000-39999) to
properly
handle Nostr marketplace product and stall updates according to NIP-16
specification.

Changes:
- Add is_parameterized_replaceable_event property to NostrEvent
- Implement automatic deletion of previous versions when new
parameterized replaceable event is received
- Add 'd' tag filtering support to NostrFilter for parameterized
replacement logic
- Update SQL query generation to handle 'd' tag joins

Fixes issue where product updates would create duplicate entries instead
of
replacing previous versions, ensuring only the latest version remains
visible.

* Refactor event handling for addressable events

Renamed the property is_parameterized_replaceable_event to is_addressable_event in NostrEvent to align with NIP-01 specifications (previously NIP-16). Updated the client_connection.py to utilize the new property for extracting 'd' tag values for addressable replacement, ensuring proper event handling in the relay system.

* Refactor tag filtering logic in NostrFilter

Updated the tag filtering mechanism to ensure that the filter only fails if the specified tags ('e' and 'p') are not found. This change improves clarity and maintains functionality by allowing for more precise control over event filtering.

* update readme

* Fix addressable event deletion and SQL schema issues

- Fix Pydantic field alias usage for d tag filtering (use #d instead of
d)
- Remove nostrrelay schema prefixes from SQL table references
- Implement subquery approach for DELETE operations with JOINs
- Resolve SQLite DELETE syntax incompatibility with JOIN statements
- Ensure NIP-33 compliance: only delete events with matching d tag
values
2025-09-10 16:40:40 +03:00
PatMulligan
687d7b89c1
Fix REQ message handling to support multiple filter subscriptions (#34)
This fix addresses an issue where REQ messages with multiple filters
were being rejected by the relay. Notably: The nostrmarket extension's
"Refresh from Nostr" functionality sends a single REQ message containing
4 different filter subscriptions:
- Direct Messages (kinds: [4])
- Stalls (kinds: [30017])
- Products (kinds: [30018])
- Profile (kinds: [0])

Changes:
- Changed validation from `len(data) != 3` to `len(data) < 3` to allow
multiple filters
- Added loop to process all filters in a single REQ message (data[2:])
- Accumulate responses from all filters before returning

This ensures compatibility with clients that batch multiple subscription
filters in a single REQ message, which is a valid pattern according to
NIP-01.
2025-09-10 16:35:25 +03:00
21M4TW
5a1a400f45
-Two issues were dicovered in get_config_for_all_active_relays which led (#32)
to errors while loading relay configuration from the DB and that also
caused the loaded meta information to be invalid. Mandatory fields for
NostrRelay were not selected by the query, and a dictionary
representation of the meta object should not be returned as it causes
some members such as require_auth_filter and event_requires_auth to not
be accessible, leading to breaking exceptions.
2025-06-16 11:59:13 +03:00
Vlad Stan
3dc066fbd4
[fix] Ws api tests (#31) 2024-11-11 15:25:25 +02:00
dni ⚡
73054fd5ce
feat: update to v1.0.0 (#30) 2024-11-08 15:32:04 +02:00
Bitkarrot
2bdbbb274d
Update client_connection.py (#29)
omit return none, in ref to https://github.com/lnbits/nostrrelay/issues/27
2024-10-14 09:39:48 +03:00
dni ⚡
cc6752003a
feat: improve codequality and CI (#25)
* feat: improve codequality and CI
2024-08-30 13:20:23 +02:00
dni ⚡
28121184c3
fix: properly start/stop tasks (#22)
https://github.com/lnbits/nostrclient/pull/28
2024-06-26 10:29:04 +02:00
Arc
94d383baff
Merge pull request #24 from lnbits/advanceddescription
Added advanced description
2024-05-17 12:16:47 +01:00
benarc
6d4f561e4e typo 2024-05-17 12:15:11 +01:00
benarc
d448ba6fa5 Added advanced description 2024-05-15 13:21:42 +01:00
dni ⚡
349bfa49d1
chore: rename websocketUpdater (#21)
* chore: rename `websocketUpdater`
https://github.com/lnbits/lnbits/pull/2377
2024-04-12 12:11:03 +02:00
Vlad Stan
43eed0df35
fix: repository 2024-03-21 15:35:19 +02:00
Vlad Stan
94ae34158c
fix: admin check (#20) 2024-03-21 11:29:36 +02:00
Tiago Vasconcelos
473614f8be
allow custom path (#17)
* allow custom path

---------

Co-authored-by: dni  <office@dnilabs.com>
2023-09-26 16:56:21 +02:00
dni ⚡
0215986a59
release workflow (#18) 2023-09-26 16:55:51 +02:00
Tiago Vasconcelos
3c45acc4d5 copy changes
more copy
clean debugging... prints! lol
clean console logs
fix get users

Only get users that explicitly have been allowed or blocked
UI
UI-2
prevent getting all accounts (false, false is default)
remove client side filtering


remove prints
2023-07-26 11:28:20 +03:00
Vlad Stan
07a07fc079 fix: do not remove README from archive 2023-04-19 14:41:14 +03:00
Vlad Stan
ccf620d476 feat: check account for REQ 2023-04-06 18:14:35 +03:00
Vlad Stan
dc50d3493d fix: is free to join if cost_to_join == 0 2023-04-06 18:14:12 +03:00
Vlad Stan
8ed361230b refactor: prepare for pay check 2023-04-06 17:33:09 +03:00
Vlad Stan
fddc8a1d22 refactor: field name 2023-04-06 17:31:49 +03:00
Vlad Stan
1a1875e177 fix: duplicate event 2023-04-06 17:31:26 +03:00
Vlad Stan
f19fb4a18e fix: delete account 2023-04-06 16:59:15 +03:00
Vlad Stan
f7fb926c52 fix: port value 2023-03-17 17:24:33 +02:00
Vlad Stan
28c0947afb fix: invoice can have undefined tag 2023-03-17 15:24:17 +02:00
Vlad Stan
527afa0c8c feat: wait for paid invoce 2023-03-17 15:06:59 +02:00
Vlad Stan
3aa4875558 chore: code format 2023-03-17 15:06:09 +02:00
Vlad Stan
30ffcf7f55 fix: show wss & invoice generation 2023-03-15 21:19:31 +02:00
Vlad Stan
218b324347 chore: code format 2023-03-15 21:19:31 +02:00
Vlad Stan
6e1b5dd0bb fix: copy button 2023-03-15 21:19:31 +02:00
Vlad Stan
67dda89c81 fix: separate relay update from activete/deactivate 2023-03-15 21:19:31 +02:00
Vlad Stan
63be2b5b2d feat: show wss URL 2023-03-15 21:19:31 +02:00
Vlad Stan
5e313c0282 chore: code format 2023-03-15 21:17:51 +02:00
Vlad Stan
16b9d93dca fix: use Spec for PaymentSpec 2023-02-22 11:39:35 +02:00
Vlad Stan
8df0dc2f52 chore: code clean-up 2023-02-22 11:39:35 +02:00
Vlad Stan
dd9dbbe818 fix: return generic Relay Info 2023-02-21 16:20:19 +02:00
Vlad Stan
f4d4706237 chore: remove test path 2023-02-21 16:20:19 +02:00
Vlad Stan
8c860f851a feat: update supported NIPs 2023-02-21 16:20:19 +02:00
Vlad Stan
abe8c65c4c refactor: rename fields 2023-02-21 16:20:19 +02:00
Vlad Stan
ffb0177003 chore: code format 2023-02-21 16:20:19 +02:00
Vlad Stan
d66184c077 feat: add /api/v1/relay-info endpoint 2023-02-21 16:20:19 +02:00