sign: fix parsing connect response from string to JSON

This commit is contained in:
Alex Gleason 2023-08-26 22:49:32 -05:00
parent 0227eb3b34
commit 0a9b53bbc1
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 2 additions and 1 deletions

View File

@ -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<K extends number = number>(
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();