Add messages to HTTPException's
This commit is contained in:
parent
75dd2652d2
commit
0adb6f5eba
|
@ -38,7 +38,7 @@ const auth19: AppMiddleware = async (c, next) => {
|
||||||
/** Throw a 401 if the pubkey isn't set. */
|
/** Throw a 401 if the pubkey isn't set. */
|
||||||
const requirePubkey: AppMiddleware = async (c, next) => {
|
const requirePubkey: AppMiddleware = async (c, next) => {
|
||||||
if (!c.get('pubkey')) {
|
if (!c.get('pubkey')) {
|
||||||
throw new HTTPException(401);
|
throw new HTTPException(401, { message: 'No pubkey provided' });
|
||||||
}
|
}
|
||||||
|
|
||||||
await next();
|
await next();
|
||||||
|
|
|
@ -81,7 +81,7 @@ function withProof(
|
||||||
c.set('proof', proof);
|
c.set('proof', proof);
|
||||||
await handler(c, proof, next);
|
await handler(c, proof, next);
|
||||||
} else {
|
} else {
|
||||||
throw new HTTPException(401);
|
throw new HTTPException(401, { message: 'No proof' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ async function signNostrConnect<K extends number = number>(event: EventTemplate<
|
||||||
const pubkey = c.get('pubkey');
|
const pubkey = c.get('pubkey');
|
||||||
|
|
||||||
if (!pubkey) {
|
if (!pubkey) {
|
||||||
throw new HTTPException(401);
|
throw new HTTPException(401, { message: 'Missing pubkey' });
|
||||||
}
|
}
|
||||||
|
|
||||||
const messageId = crypto.randomUUID();
|
const messageId = crypto.randomUUID();
|
||||||
|
|
Loading…
Reference in New Issue