14 lines
409 B
TypeScript
14 lines
409 B
TypeScript
import type { Handler } from 'hono';
|
|
import { blacklistToken, cleanupExpiredTokens } from 'officerdb';
|
|
|
|
export const signoutHandler: Handler = async (ctx) => {
|
|
const user = ctx.get('user') as { jti: string; exp: number };
|
|
|
|
await blacklistToken(user.jti, user.exp);
|
|
|
|
// Opportunistic cleanup of expired tokens (non-blocking)
|
|
cleanupExpiredTokens().catch(() => {});
|
|
|
|
return ctx.json({ ok: true });
|
|
};
|