From a90009e6b887a8a7ca67f49566af2caffb807776 Mon Sep 17 00:00:00 2001 From: bndw Date: Sat, 14 Feb 2026 10:04:07 -0800 Subject: refactor: simplify isWriteMethod to only check actual API methods Replace pattern-matching with explicit checks for PublishEvent/PublishBatch. API is small and well-defined - no need for extensible pattern matching. --- internal/auth/auth_test.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'internal/auth/auth_test.go') diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go index 7a0da19..d5f3257 100644 --- a/internal/auth/auth_test.go +++ b/internal/auth/auth_test.go @@ -312,21 +312,13 @@ func TestIsWriteMethod(t *testing.T) { }{ // Write methods {"/nostr.v1.NostrRelay/PublishEvent", true}, - {"/nostr.v1.NostrRelay/DeleteEvent", true}, - {"/admin.v1.Admin/CreateUser", true}, - {"/admin.v1.Admin/UpdateSettings", true}, - {"/data.v1.Data/InsertRecord", true}, - {"/data.v1.Data/RemoveItem", true}, - {"/storage.v1.Storage/SetValue", true}, - {"/storage.v1.Storage/PutObject", true}, + {"/nostr.v1.NostrRelay/PublishBatch", true}, // Read methods - {"/nostr.v1.NostrRelay/QueryEvents", false}, {"/nostr.v1.NostrRelay/Subscribe", false}, - {"/nostr.v1.NostrRelay/GetEvent", false}, - {"/admin.v1.Admin/ListUsers", false}, - {"/health.v1.Health/Check", false}, - {"/info.v1.Info/GetRelayInfo", false}, + {"/nostr.v1.NostrRelay/Unsubscribe", false}, + {"/nostr.v1.NostrRelay/QueryEvents", false}, + {"/nostr.v1.NostrRelay/CountEvents", false}, // Edge cases {"", false}, -- cgit v1.2.3