From 3e40e690c55cb6b920391d756080d10b736e6784 Mon Sep 17 00:00:00 2001 From: Siddharth Singh Date: Wed, 26 Jun 2024 01:44:44 +0530 Subject: [PATCH] check admin pubkey while changing threshold --- src/controllers/nostr/relay.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/nostr/relay.ts b/src/controllers/nostr/relay.ts index 6f3dd33e..03a67aeb 100644 --- a/src/controllers/nostr/relay.ts +++ b/src/controllers/nostr/relay.ts @@ -15,9 +15,11 @@ import * as pipeline from '@/pipeline.ts'; import { RelayError } from '@/RelayError.ts'; import { Storages } from '@/storages.ts'; import { prometheusParams } from '@/db/KyselyLogger.ts'; +import { AdminSigner } from '@/signers/AdminSigner.ts'; /** Limit of initial events returned for a subscription. */ const FILTER_LIMIT = 100; +const adminPubkey = await new AdminSigner().getPublicKey(); /** Set up the Websocket connection. */ function connectStream(socket: WebSocket) { @@ -53,7 +55,7 @@ function connectStream(socket: WebSocket) { handleReq(msg); return; case 'EVENT': - if (msg[1].kind === 13314) { + if (msg[1].kind === 13314 && msg[1].pubkey === adminPubkey) { try { const parsed = JSON.parse(msg[1].content); if (parsed.threshold) prometheusParams.threshold = parsed.threshold;