mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 15:08:46 +00:00
/api/key 경로에 있는 Endpoint들을 /api/client 경로로 이동
This commit is contained in:
@@ -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 });
|
||||
};
|
||||
@@ -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" } });
|
||||
};
|
||||
Reference in New Issue
Block a user