tokens fr

This commit is contained in:
2025-08-18 17:47:39 -04:00
parent 601e3660d3
commit 3f1635880a
11 changed files with 204 additions and 106 deletions

View File

@@ -1,8 +1,13 @@
import Elysia from "elysia";
import db from "./db";
export const human = new Elysia({ name: "human" })
.derive(async ({ cookie: { token }, status }) => {
const humanKey = token.value;
const humanKey = await db.human
.findUnique({
where: { token: token.value },
})
.then((human) => human?.key);
return humanKey != null ? { humanKey } : status(401);
})
.as("scoped");