클라이언트 등록시 검증키도 등록하도록 변경 (WiP)

This commit is contained in:
static
2024-12-31 01:56:12 +09:00
parent 679b223346
commit 4f20d2edbf
6 changed files with 140 additions and 35 deletions

View File

@@ -12,12 +12,18 @@ export const POST: RequestHandler = async ({ request, cookies, getClientAddress
const zodRes = z
.object({
pubKey: z.string().base64().nonempty(),
encPubKey: z.string().base64().nonempty(),
sigPubKey: z.string().base64().nonempty(),
})
.safeParse(await request.json());
if (!zodRes.success) error(400, "Invalid request body");
const { pubKey } = zodRes.data;
const { encPubKey, sigPubKey } = zodRes.data;
const challenge = await registerUserClient(userId, getClientAddress(), pubKey.trim());
const { challenge } = await registerUserClient(
userId,
getClientAddress(),
encPubKey.trim(),
sigPubKey.trim(),
);
return json({ challenge });
};