mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-15 22:38:47 +00:00
암호 키 생성 후 내보내기 페이지로 이동하도록 구현
This commit is contained in:
21
src/lib/hooks/goto.ts
Normal file
21
src/lib/hooks/goto.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
export { default as callAPI } from "./callAPI";
|
||||
export { goto } from "./goto";
|
||||
|
||||
4
src/lib/stores/key.ts
Normal file
4
src/lib/stores/key.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
export const pubKey = writable<CryptoKey | null>(null);
|
||||
export const privKey = writable<CryptoKey | null>(null);
|
||||
Reference in New Issue
Block a user