Files
ditto/src/middleware/requireSigner.ts
2024-05-14 11:42:53 -05:00

13 lines
308 B
TypeScript

import { HTTPException } from 'hono';
import { AppMiddleware } from '@/app.ts';
/** Throw a 401 if a signer isn't set. */
export const requireSigner: AppMiddleware = async (c, next) => {
if (!c.get('signer')) {
throw new HTTPException(401, { message: 'No pubkey provided' });
}
await next();
};