From 0a9b53bbc13beb2a206c221aaebcb3f1ecbe68d9 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 26 Aug 2023 22:49:32 -0500 Subject: [PATCH] sign: fix parsing connect response from string to JSON --- src/sign.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sign.ts b/src/sign.ts index 20a0350..2a91a06 100644 --- a/src/sign.ts +++ b/src/sign.ts @@ -3,6 +3,7 @@ import { Conf } from '@/config.ts'; import { decryptAdmin, encryptAdmin } from '@/crypto.ts'; import { type Event, type EventTemplate, finishEvent, HTTPException } from '@/deps.ts'; import { connectResponseSchema } from '@/schemas/nostr.ts'; +import { jsonSchema } from '@/schema.ts'; import { Sub } from '@/subs.ts'; import { Time } from '@/utils.ts'; import { createAdminEvent } from '@/utils/web.ts'; @@ -82,7 +83,7 @@ function awaitSignedEvent( for await (const event of sub) { if (event.kind === 24133) { const decrypted = await decryptAdmin(event.pubkey, event.content); - const msg = connectResponseSchema.parse(decrypted); + const msg = jsonSchema.pipe(connectResponseSchema).parse(decrypted); if (msg.id === messageId) { close();