암호 키 생성 및 등록시 최초 MEK도 함께 생성 및 등록하도록 구현

This commit is contained in:
static
2024-12-30 01:59:09 +09:00
parent d39931c79a
commit 941e2a49bc
10 changed files with 133 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
import { exportRSAKeyToBase64 } from "$lib/modules/crypto";
import { encodeToBase64, exportRSAKey } from "$lib/modules/crypto";
import { requestPubKeyRegistration } from "../../key/export/service";
const callLoginAPI = async (email: string, password: string, pubKeyBase64?: string) => {
@@ -22,7 +22,7 @@ export const requestLogin = async (
registerPubKey = true,
): Promise<boolean> => {
const pubKeyBase64 = keyPair
? await exportRSAKeyToBase64(keyPair.publicKey, "public")
? encodeToBase64((await exportRSAKey(keyPair.publicKey, "public")).key)
: undefined;
let loginRes = await callLoginAPI(email, password, pubKeyBase64);
if (loginRes.ok) {