mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 16:16:55 +00:00
자잘한 리팩토링
This commit is contained in:
@@ -13,9 +13,7 @@ export const requestTokenUpgrade = async (
|
||||
) => {
|
||||
let res = await fetch("/api/auth/upgradeToken", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
encPubKey: encryptKeyBase64,
|
||||
sigPubKey: verifyKeyBase64,
|
||||
@@ -29,9 +27,7 @@ export const requestTokenUpgrade = async (
|
||||
|
||||
res = await fetch("/api/auth/upgradeToken/verify", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
answer: encodeToBase64(answer),
|
||||
answerSig: encodeToBase64(answerSig),
|
||||
|
||||
@@ -50,7 +50,7 @@ export const requestMasterKeyDownload = async (decryptKey: CryptoKey, verifyKey:
|
||||
return {
|
||||
version,
|
||||
state,
|
||||
masterKey,
|
||||
key: masterKey,
|
||||
isValid: await verifyMasterKeyWrapped(
|
||||
masterKeyWrapped,
|
||||
version,
|
||||
@@ -63,17 +63,8 @@ export const requestMasterKeyDownload = async (decryptKey: CryptoKey, verifyKey:
|
||||
);
|
||||
if (!masterKeys.every(({ isValid }) => isValid)) return false;
|
||||
|
||||
await storeMasterKeys(
|
||||
masterKeys.map(({ version, state, masterKey }) => ({ version, state, key: masterKey })),
|
||||
);
|
||||
masterKeyStore.set(
|
||||
new Map(
|
||||
masterKeys.map(({ version, state, masterKey }) => [
|
||||
version,
|
||||
{ version, state, key: masterKey },
|
||||
]),
|
||||
),
|
||||
);
|
||||
await storeMasterKeys(masterKeys);
|
||||
masterKeyStore.set(new Map(masterKeys.map((masterKey) => [masterKey.version, masterKey])));
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user