khatru: add post-delete success hook for NIP-09 #2

Closed
opened 2026-04-14 13:58:44 +00:00 by priyanshu_bharti · 0 comments

Description

Currently, when a NIP-09 kind 5 delete event is processed in khatru, the target event(s) are deleted via DeleteEvent(id), but there is no dedicated hook that provides the full context of the deletion to downstream consumers like zooid.

As a result, deletion events are not reliably broadcasted to Nostr relays (see zooid#1).

Problem

The current delete flow deletes the target events but does not expose:

  • The original kind 5 delete event
  • The successfully deleted target event

This makes it impossible for zooid (and other relays) to properly fan out the deletion event.

Proposed Solution

Add a new hook OnDeleteApplied in khatru that is called after a target event has been successfully deleted.

// In khatru/relay.go
OnDeleteApplied func(ctx context.Context, deleteEvent nostr.Event, deletedEvent nostr.Event)
### Description Currently, when a NIP-09 kind 5 delete event is processed in khatru, the target event(s) are deleted via `DeleteEvent(id)`, but there is **no dedicated hook** that provides the full context of the deletion to downstream consumers like zooid. As a result, deletion events are not reliably broadcasted to Nostr relays (see zooid#1). ### Problem The current delete flow deletes the target events but does not expose: - The original kind 5 delete event - The successfully deleted target event This makes it impossible for zooid (and other relays) to properly fan out the deletion event. ### Proposed Solution Add a new hook `OnDeleteApplied` in khatru that is called **after** a target event has been successfully deleted. ```go // In khatru/relay.go OnDeleteApplied func(ctx context.Context, deleteEvent nostr.Event, deletedEvent nostr.Event)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coracle/nostrlib#2