Switch all db storage to session storage
All checks were successful
Build And Deploy / build-and-deploy (push) Successful in 1m27s

Only affects CapAdapter, challenge.ts, and redeem.ts.
This commit is contained in:
badblocks 2026-02-07 18:07:50 -08:00
parent 1fbcbf772a
commit 6c56b203d3
Signed by: badblocks
SSH key fingerprint: SHA256:hEcM6BP4hKm9F7WsomNuXSBpPn2BSDnFzPSl3y1NerQ
4 changed files with 56 additions and 87 deletions

View file

@ -1,12 +1,21 @@
import type { APIRoute } from "astro";
import cap from "@lib/CapAdapter";
import { createCap } from "@lib/CapAdapter";
export const prerender = false;
export const POST: APIRoute = async ({ request }) => {
const { token, solutions } = await request.json();
export const POST: APIRoute = async (context) => {
if (!context.session) {
return new Response(
JSON.stringify({ success: false, error: "Session unavailable." }),
{ status: 500 },
);
}
const { token, solutions } = await context.request.json();
if (!token || !solutions) {
return new Response(JSON.stringify({ success: false }), { status: 400 });
}
const cap = createCap(context.session);
return new Response(
JSON.stringify(await cap.redeemChallenge({ token, solutions })),
{ status: 200 },