mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-12 21:08:46 +00:00
네이밍 관련 리팩토링
This commit is contained in:
@@ -9,9 +9,7 @@ export { requestMasterKeyDownload } from "$lib/services/key";
|
|||||||
export const requestLogin = async (email: string, password: string) => {
|
export const requestLogin = async (email: string, password: string) => {
|
||||||
const res = await fetch("/api/auth/login", {
|
const res = await fetch("/api/auth/login", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: { "Content-Type": "application/json" },
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ email, password } satisfies LoginRequest),
|
body: JSON.stringify({ email, password } satisfies LoginRequest),
|
||||||
});
|
});
|
||||||
return res.ok;
|
return res.ok;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import BeforeContinueBottomSheet from "./BeforeContinueBottomSheet.svelte";
|
import BeforeContinueBottomSheet from "./BeforeContinueBottomSheet.svelte";
|
||||||
import BeforeContinueModal from "./BeforeContinueModal.svelte";
|
import BeforeContinueModal from "./BeforeContinueModal.svelte";
|
||||||
import {
|
import {
|
||||||
exportClientKeys,
|
serializeClientKeys,
|
||||||
requestClientRegistration,
|
requestClientRegistration,
|
||||||
storeClientKeys,
|
storeClientKeys,
|
||||||
requestTokenUpgrade,
|
requestTokenUpgrade,
|
||||||
@@ -21,14 +21,14 @@
|
|||||||
let isBeforeContinueModalOpen = $state(false);
|
let isBeforeContinueModalOpen = $state(false);
|
||||||
let isBeforeContinueBottomSheetOpen = $state(false);
|
let isBeforeContinueBottomSheetOpen = $state(false);
|
||||||
|
|
||||||
const exportKeyPair = () => {
|
const exportClientKeys = () => {
|
||||||
const clientKeysExported = exportClientKeys(
|
const clientKeysSerialized = serializeClientKeys(
|
||||||
data.encryptKeyBase64,
|
data.encryptKeyBase64,
|
||||||
data.decryptKeyBase64,
|
data.decryptKeyBase64,
|
||||||
data.signKeyBase64,
|
data.signKeyBase64,
|
||||||
data.verifyKeyBase64,
|
data.verifyKeyBase64,
|
||||||
);
|
);
|
||||||
const clientKeysBlob = new Blob([JSON.stringify(clientKeysExported)], {
|
const clientKeysBlob = new Blob([JSON.stringify(clientKeysSerialized)], {
|
||||||
type: "application/json",
|
type: "application/json",
|
||||||
});
|
});
|
||||||
saveAs(clientKeysBlob, "arkvault-clientkey.json");
|
saveAs(clientKeysBlob, "arkvault-clientkey.json");
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const registerPubKey = async () => {
|
const registerPubKeys = async () => {
|
||||||
if (!$clientKeyStore) {
|
if (!$clientKeyStore) {
|
||||||
throw new Error("Failed to find key pair");
|
throw new Error("Failed to find key pair");
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</TitleDiv>
|
</TitleDiv>
|
||||||
<BottomDiv>
|
<BottomDiv>
|
||||||
<Button onclick={exportKeyPair}>암호 키 내보내기</Button>
|
<Button onclick={exportClientKeys}>암호 키 내보내기</Button>
|
||||||
<TextButton
|
<TextButton
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
isBeforeContinueModalOpen = true;
|
isBeforeContinueModalOpen = true;
|
||||||
@@ -110,9 +110,9 @@
|
|||||||
</TextButton>
|
</TextButton>
|
||||||
</BottomDiv>
|
</BottomDiv>
|
||||||
|
|
||||||
<BeforeContinueModal bind:isOpen={isBeforeContinueModalOpen} onContinueClick={registerPubKey} />
|
<BeforeContinueModal bind:isOpen={isBeforeContinueModalOpen} onContinueClick={registerPubKeys} />
|
||||||
<BeforeContinueBottomSheet
|
<BeforeContinueBottomSheet
|
||||||
bind:isOpen={isBeforeContinueBottomSheetOpen}
|
bind:isOpen={isBeforeContinueBottomSheetOpen}
|
||||||
onRetryClick={exportKeyPair}
|
onRetryClick={exportClientKeys}
|
||||||
onContinueClick={registerPubKey}
|
onContinueClick={registerPubKeys}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type { ClientKeys } from "$lib/stores";
|
|||||||
export { requestTokenUpgrade } from "$lib/services/auth";
|
export { requestTokenUpgrade } from "$lib/services/auth";
|
||||||
export { requestClientRegistration } from "$lib/services/key";
|
export { requestClientRegistration } from "$lib/services/key";
|
||||||
|
|
||||||
type ExportedKeyPairs = {
|
type SerializedKeyPairs = {
|
||||||
generator: "ArkVault";
|
generator: "ArkVault";
|
||||||
exportedAt: Date;
|
exportedAt: Date;
|
||||||
} & {
|
} & {
|
||||||
@@ -18,7 +18,7 @@ type ExportedKeyPairs = {
|
|||||||
verifyKey: string;
|
verifyKey: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const exportClientKeys = (
|
export const serializeClientKeys = (
|
||||||
encryptKeyBase64: string,
|
encryptKeyBase64: string,
|
||||||
decryptKeyBase64: string,
|
decryptKeyBase64: string,
|
||||||
signKeyBase64: string,
|
signKeyBase64: string,
|
||||||
@@ -32,7 +32,7 @@ export const exportClientKeys = (
|
|||||||
decryptKey: decryptKeyBase64,
|
decryptKey: decryptKeyBase64,
|
||||||
signKey: signKeyBase64,
|
signKey: signKeyBase64,
|
||||||
verifyKey: verifyKeyBase64,
|
verifyKey: verifyKeyBase64,
|
||||||
} satisfies ExportedKeyPairs;
|
} satisfies SerializedKeyPairs;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const storeClientKeys = async (clientKeys: ClientKeys) => {
|
export const storeClientKeys = async (clientKeys: ClientKeys) => {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const generate = async () => {
|
const generateKeys = async () => {
|
||||||
// TODO: Loading indicator
|
// TODO: Loading indicator
|
||||||
|
|
||||||
const { encryptKey, ...clientKeys } = await generateClientKeys();
|
const { encryptKey, ...clientKeys } = await generateClientKeys();
|
||||||
@@ -74,6 +74,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</TitleDiv>
|
</TitleDiv>
|
||||||
<BottomDiv>
|
<BottomDiv>
|
||||||
<Button onclick={generate}>새 암호 키 생성하기</Button>
|
<Button onclick={generateKeys}>새 암호 키 생성하기</Button>
|
||||||
<TextButton>키를 갖고 있어요</TextButton>
|
<TextButton>키를 갖고 있어요</TextButton>
|
||||||
</BottomDiv>
|
</BottomDiv>
|
||||||
|
|||||||
Reference in New Issue
Block a user