디자인 변경

This commit is contained in:
2026-02-11 15:27:03 +09:00
parent 95291e6922
commit f650d51f68
15 changed files with 667 additions and 505 deletions

42
lib/kis/request.ts Normal file
View File

@@ -0,0 +1,42 @@
import { normalizeTradingEnv, type KisCredentialInput } from "@/lib/kis/config";
import type { NextRequest } from "next/server";
interface KisCredentialRequestBody {
appKey?: string;
appSecret?: string;
tradingEnv?: string;
}
/**
* @description 요청 본문에서 KIS 인증 정보를 파싱합니다.
* @see app/api/kis/validate/route.ts
*/
export async function parseKisCredentialRequest(
request: NextRequest,
): Promise<KisCredentialInput> {
let body: KisCredentialRequestBody = {};
try {
body = (await request.json()) as KisCredentialRequestBody;
} catch {
// 빈 본문 또는 JSON 파싱 실패는 아래 필수값 검증에서 처리합니다.
}
return {
appKey: body.appKey?.trim(),
appSecret: body.appSecret?.trim(),
tradingEnv: normalizeTradingEnv(body.tradingEnv),
};
}
/**
* @description 인증키 필수값을 검증합니다.
* @see app/api/kis/revoke/route.ts
*/
export function validateKisCredentialInput(credentials: KisCredentialInput) {
if (!credentials.appKey || !credentials.appSecret) {
return "앱 키와 앱 시크릿을 모두 입력해 주세요.";
}
return null;
}