암호 키 생성 후 내보내기 페이지로 이동하도록 구현

This commit is contained in:
static
2024-12-27 21:23:47 +09:00
parent 98512a0710
commit 400438c395
9 changed files with 107 additions and 48 deletions

21
src/lib/hooks/goto.ts Normal file
View File

@@ -0,0 +1,21 @@
import { writable } from "svelte/store";
import { goto as svelteGoto } from "$app/navigation";
type Path = "/key/export";
interface KeyExportState {
pubKeyBase64: string;
privKeyBase64: string;
}
export const keyExportState = writable<KeyExportState | null>(null);
export function goto(path: "/key/export", state: KeyExportState): Promise<void>;
export function goto(path: Path, state: unknown) {
switch (path) {
case "/key/export":
keyExportState.set(state as KeyExportState);
return svelteGoto(path);
}
}

View File

@@ -1 +1,2 @@
export { default as callAPI } from "./callAPI";
export { goto } from "./goto";

4
src/lib/stores/key.ts Normal file
View File

@@ -0,0 +1,4 @@
import { writable } from "svelte/store";
export const pubKey = writable<CryptoKey | null>(null);
export const privKey = writable<CryptoKey | null>(null);