summaryrefslogtreecommitdiffstats
path: root/internal/storage/storage.go
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-02-13 19:12:28 -0800
committerbndw <ben@bdw.to>2026-02-13 19:12:28 -0800
commit656748ea286ff7eac6cbe1b241ad31212892ba61 (patch)
treee9685b4a585809463bdf51a4d1ecb7f7c5efaf70 /internal/storage/storage.go
parent83876eae868bd1e4fb6b9a823a6e8173919f290d (diff)
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
Diffstat (limited to 'internal/storage/storage.go')
-rw-r--r--internal/storage/storage.go4
1 files changed, 2 insertions, 2 deletions
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 {
101 101
102 -- Deletion events (NIP-09) 102 -- Deletion events (NIP-09)
103 CREATE TABLE IF NOT EXISTS deletions ( 103 CREATE TABLE IF NOT EXISTS deletions (
104 event_id TEXT PRIMARY KEY, -- ID of deletion event 104 deleted_event_id TEXT PRIMARY KEY, -- ID of event being deleted
105 deleted_event_id TEXT NOT NULL, -- ID of event being deleted 105 deletion_event_id TEXT NOT NULL, -- ID of deletion event
106 pubkey TEXT NOT NULL, -- Who requested deletion 106 pubkey TEXT NOT NULL, -- Who requested deletion
107 created_at INTEGER NOT NULL, 107 created_at INTEGER NOT NULL,
108 FOREIGN KEY (deleted_event_id) REFERENCES events(id) 108 FOREIGN KEY (deleted_event_id) REFERENCES events(id)