/api/key 경로에 있는 Endpoint들을 /api/client 경로로 이동

This commit is contained in:
static
2024-12-29 19:12:50 +09:00
parent bbba449819
commit 3664ad66ac
4 changed files with 9 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
import { error, json } from "@sveltejs/kit";
import { z } from "zod";
import { authenticate } from "$lib/server/modules/auth";
import { registerPubKey } from "$lib/server/services/key";
import { registerUserClient } from "$lib/server/services/client";
import type { RequestHandler } from "./$types";
export const POST: RequestHandler = async ({ request, cookies, getClientAddress }) => {
@@ -18,6 +18,6 @@ export const POST: RequestHandler = async ({ request, cookies, getClientAddress
}
const { pubKey } = zodRes.data;
const challenge = await registerPubKey(userId, getClientAddress(), pubKey.trim());
const challenge = await registerUserClient(userId, getClientAddress(), pubKey.trim());
return json({ challenge });
};

View File

@@ -1,7 +1,7 @@
import { error, text } from "@sveltejs/kit";
import { z } from "zod";
import { authenticate } from "$lib/server/modules/auth";
import { verifyPubKey } from "$lib/server/services/key";
import { verifyUserClient } from "$lib/server/services/client";
import type { RequestHandler } from "./$types";
export const POST: RequestHandler = async ({ request, cookies, getClientAddress }) => {
@@ -18,6 +18,6 @@ export const POST: RequestHandler = async ({ request, cookies, getClientAddress
}
const { answer } = zodRes.data;
await verifyPubKey(userId, getClientAddress(), answer.trim());
return text("Key verified", { headers: { "Content-Type": "text/plain" } });
await verifyUserClient(userId, getClientAddress(), answer.trim());
return text("Client verified", { headers: { "Content-Type": "text/plain" } });
};