Skip to content

Commit

Permalink
cert issuing api
Browse files Browse the repository at this point in the history
  • Loading branch information
c0repwn3r committed Feb 2, 2024
1 parent 6f22e64 commit 28cfd47
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/routes/api/v1/issue_certificate/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {json} from "@sveltejs/kit";
import {API_SUPERKEY} from "$env/static/private";
import prisma from "$lib/prisma";

export async function POST({ request }) {
if (!request.headers.has("authorization")) { return json({}, {status: 403}) }

let key = request.headers.get("authorization")!.split(' ')[1];

if (key !== API_SUPERKEY) { return json({}, {status: 403}) }

let jv = await request.json();

await prisma.certificate.create({
data: jv
});

return json({}, {status:200})
}

0 comments on commit 28cfd47

Please sign in to comment.