암호 키 내보내기 페이지 구현

This commit is contained in:
static
2024-12-28 22:15:46 +09:00
parent dfb56b62b1
commit 52a61297c5
13 changed files with 169 additions and 30 deletions

View File

@@ -1,12 +1,16 @@
<script lang="ts">
import { goto } from "$app/navigation";
import { Button, TextButton } from "$lib/components/buttons";
import { TitleDiv, BottomDiv } from "$lib/components/divs";
import { gotoStateful } from "$lib/hooks";
import { keyPairStore } from "$lib/stores";
import Order from "./Order.svelte";
import { generateKeyPair } from "./service";
import IconKey from "~icons/material-symbols/key";
let { data } = $props();
const orders = [
{
title: "암호 키는 공개 키와 개인 키로 구성돼요.",
@@ -27,9 +31,21 @@
];
const generate = async () => {
// TODO
await gotoStateful("/key/export", await generateKeyPair());
// TODO: Loading indicator
const keyPair = await generateKeyPair();
await gotoStateful("/key/export", {
redirectPath: data.redirectPath,
pubKeyBase64: keyPair.pubKeyBase64,
privKeyBase64: keyPair.privKeyBase64,
});
};
$effect(() => {
if ($keyPairStore) {
goto(data.redirectPath);
}
});
</script>
<svetle:head>

View File

@@ -0,0 +1,6 @@
import type { PageLoad } from "./$types";
export const load: PageLoad = async ({ url }) => {
const redirectPath = url.searchParams.get("redirect") || "/";
return { redirectPath };
};