Expose event CRUD over nostr-transport (events_event_create / update / cancel / list) #21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
PR #19 added the events extension's first nostr-transport RPC
(
events_ticket_register). The webapp's other event-related opsstill go over HTTP via
TicketApiService. Now that the transportplumbing is in place, the obvious next step is moving event CRUD
to RPCs so organizers don't need an LNbits HTTP session at all —
the signed Nostr event IS the credential.
Proposed RPCs
events_event_createAUTH_WALLETCreateEventshape (name, dates, capacity, price, currency, allow_fiat, categories, banner, location, …)Eventdictevents_event_updateAUTH_WALLET{ event_id, patch: Partial<CreateEvent> }Eventdictevents_event_cancelAUTH_WALLET{ event_id }Eventdict withcanceled=Trueevents_event_deleteAUTH_WALLET{ event_id }{ deleted: true }events_event_list_mineAUTH_WALLET{ all_wallets?: bool }list[Event]events_event_approveAUTH_ACCOUNT(admin check inside handler){ event_id }Eventdictevents_event_rejectAUTH_ACCOUNT(admin check inside handler){ event_id }EventdictEach handler reuses the existing CRUD / services functions; the
RPC wrapper translates auth + ownership checks the way
handle_events_ticket_registerdoes today.Webapp side
TicketApiServiceshrinks. Methods that were HTTP POST/PUT against/events/api/v1/events/*become thin wrappers aroundNostrTransportService.call(...). The transport service is alreadyin place from PR #73, so this is purely method-level migration —
no architectural change.
GET-style endpoints (
/events/public,/events/{id}) should stayon HTTP for now since they're public + don't benefit from the
encrypted RPC; switch later if/when the LNbits HTTP API gets fully
deprecated.
Phasing
Each RPC can land independently. Recommended order:
events_event_create— biggest UX win (event creation no longerneeds an admin_key in browser).
events_event_update— same shape as create.events_event_cancel+events_event_delete— small additions.events_event_list_mine— replaces thefetchMyEvents(invoiceKey)HTTP call inuseActivities.ts.events_event_approve/events_event_reject— admin-only,only matters for instances with
auto_approve = false.Each step is a small PR pair (one commit per RPC on the events
extension, one webapp commit swapping the call site).
Out of scope
tickets_*RPCs beyond register. The buyer-siderequestTicketflow doesn't need encryption (it's already keyed by user_id
via Bearer auth and the response carries a bolt11 anyone could
intercept anyway — the security boundary is the wallet, not the
request). Maybe revisit if the LNbits HTTP path goes away
entirely.
republish-all/republish-mineadmin endpoints — thoseare one-shot migrations, no need to nostr-ify.
Why now (or whenever this gets picked up)
Stepping stone to the long-stated "depend completely on Nostr"
direction. Each RPC migration is small and low-risk; the
incremental nature means each PR ships value independently.