From 656748ea286ff7eac6cbe1b241ad31212892ba61 Mon Sep 17 00:00:00 2001 From: bndw Date: Fri, 13 Feb 2026 19:12:28 -0800 Subject: feat: implement NIP-09 (deletions) and NIP-11 (relay info) NIP-11 (Relay Information Document): - Serves relay metadata at GET / with Accept: application/nostr+json - Returns name, description, supported NIPs, limitations - CORS headers for browser compatibility NIP-09 (Event Deletion): - Kind 5 events delete events referenced in 'e' tags - Only authors can delete their own events - Soft delete (marks deleted=1) - Records deletion in deletions table - Works across all protocols (gRPC, Connect, WebSocket) Fixed deletions schema: - deleted_event_id as PRIMARY KEY (not deletion_event_id) - Allows one deletion event to delete multiple events 3 new tests, 44 total tests passing Supported NIPs now: 1, 9, 11 --- internal/storage/storage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/storage/storage.go') diff --git a/internal/storage/storage.go b/internal/storage/storage.go index 64fc4c6..806acac 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -101,8 +101,8 @@ func (s *Storage) initSchema(ctx context.Context) error { -- Deletion events (NIP-09) CREATE TABLE IF NOT EXISTS deletions ( - event_id TEXT PRIMARY KEY, -- ID of deletion event - deleted_event_id TEXT NOT NULL, -- ID of event being deleted + deleted_event_id TEXT PRIMARY KEY, -- ID of event being deleted + deletion_event_id TEXT NOT NULL, -- ID of deletion event pubkey TEXT NOT NULL, -- Who requested deletion created_at INTEGER NOT NULL, FOREIGN KEY (deleted_event_id) REFERENCES events(id) -- cgit v1.2.3