sign: 504 --> 408
This commit is contained in:
parent
c14ebe6631
commit
91bc0549c7
|
@ -28,6 +28,7 @@ async function signEvent<K extends number = number>(event: EventTemplate<K>, c:
|
||||||
try {
|
try {
|
||||||
return await new Promise<SignedEvent<K>>((resolve, reject) => {
|
return await new Promise<SignedEvent<K>>((resolve, reject) => {
|
||||||
stream.addEventListener('message', (e) => {
|
stream.addEventListener('message', (e) => {
|
||||||
|
// TODO: parse and validate with zod
|
||||||
const data = JSON.parse(e.data);
|
const data = JSON.parse(e.data);
|
||||||
if (data.event === 'nostr.sign') {
|
if (data.event === 'nostr.sign') {
|
||||||
resolve(JSON.parse(data.payload));
|
resolve(JSON.parse(data.payload));
|
||||||
|
@ -37,8 +38,8 @@ async function signEvent<K extends number = number>(event: EventTemplate<K>, c:
|
||||||
setTimeout(reject, 60000);
|
setTimeout(reject, 60000);
|
||||||
});
|
});
|
||||||
} catch (_e) {
|
} catch (_e) {
|
||||||
throw new HTTPException(504, {
|
throw new HTTPException(408, {
|
||||||
res: c.json({ id: 'ditto.timeout', error: 'Signing timeout' }, 504),
|
res: c.json({ id: 'ditto.timeout', error: 'Signing timeout' }, 408),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue