암호 키 생성 및 등록시 최초 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

@@ -9,8 +9,9 @@
import {
createBlobFromKeyPairBase64,
requestPubKeyRegistration,
requestTokenUpgrade,
storeKeyPairPersistently,
requestTokenUpgrade,
requestInitialMekRegistration,
} from "./service";
import IconKey from "~icons/material-symbols/key";
@@ -39,16 +40,22 @@
isBeforeContinueModalOpen = false;
isBeforeContinueBottomSheetOpen = false;
if (await requestPubKeyRegistration(data.pubKeyBase64, $keyPairStore.privateKey)) {
try {
if (!(await requestPubKeyRegistration(data.pubKeyBase64, $keyPairStore.privateKey)))
throw new Error("Failed to register public key");
await storeKeyPairPersistently($keyPairStore);
if (await requestTokenUpgrade(data.pubKeyBase64)) {
await goto(data.redirectPath);
} else {
// TODO: Error handling
}
} else {
if (!(await requestTokenUpgrade(data.pubKeyBase64)))
throw new Error("Failed to upgrade token");
if (!(await requestInitialMekRegistration(data.mekDraft, $keyPairStore.publicKey)))
throw new Error("Failed to register initial MEK");
await goto(data.redirectPath);
} catch (e) {
// TODO: Error handling
throw e;
}
};
</script>