Give requireSigner middleware the right type

This commit is contained in:
Alex Gleason 2025-01-30 20:39:51 -06:00
parent 9ced9fb31d
commit c83a2dba7e
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -1,9 +1,9 @@
import { MiddlewareHandler } from '@hono/hono';
import { HTTPException } from '@hono/hono/http-exception';
import { AppMiddleware } from '@/app.ts';
import { NostrSigner } from '@nostrify/nostrify';
/** Throw a 401 if a signer isn't set. */
export const requireSigner: AppMiddleware = async (c, next) => {
export const requireSigner: MiddlewareHandler<{ Variables: { signer: NostrSigner } }> = async (c, next) => {
if (!c.get('signer')) {
throw new HTTPException(401, { message: 'No pubkey provided' });
}