mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
sign: fix parsing connect response from string to JSON
This commit is contained in:
parent
0227eb3b34
commit
0a9b53bbc1
1 changed files with 2 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ import { Conf } from '@/config.ts';
|
||||||
import { decryptAdmin, encryptAdmin } from '@/crypto.ts';
|
import { decryptAdmin, encryptAdmin } from '@/crypto.ts';
|
||||||
import { type Event, type EventTemplate, finishEvent, HTTPException } from '@/deps.ts';
|
import { type Event, type EventTemplate, finishEvent, HTTPException } from '@/deps.ts';
|
||||||
import { connectResponseSchema } from '@/schemas/nostr.ts';
|
import { connectResponseSchema } from '@/schemas/nostr.ts';
|
||||||
|
import { jsonSchema } from '@/schema.ts';
|
||||||
import { Sub } from '@/subs.ts';
|
import { Sub } from '@/subs.ts';
|
||||||
import { Time } from '@/utils.ts';
|
import { Time } from '@/utils.ts';
|
||||||
import { createAdminEvent } from '@/utils/web.ts';
|
import { createAdminEvent } from '@/utils/web.ts';
|
||||||
|
|
@ -82,7 +83,7 @@ function awaitSignedEvent<K extends number = number>(
|
||||||
for await (const event of sub) {
|
for await (const event of sub) {
|
||||||
if (event.kind === 24133) {
|
if (event.kind === 24133) {
|
||||||
const decrypted = await decryptAdmin(event.pubkey, event.content);
|
const decrypted = await decryptAdmin(event.pubkey, event.content);
|
||||||
const msg = connectResponseSchema.parse(decrypted);
|
const msg = jsonSchema.pipe(connectResponseSchema).parse(decrypted);
|
||||||
|
|
||||||
if (msg.id === messageId) {
|
if (msg.id === messageId) {
|
||||||
close();
|
close();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue