mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 08:06:56 +00:00
사소한 리팩토링
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
encodeToBase64,
|
||||
decodeFromBase64,
|
||||
concatenateBuffers,
|
||||
} from "./util";
|
||||
} from "./utils";
|
||||
|
||||
export const generateMasterKey = async () => {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from "./aes";
|
||||
export * from "./rsa";
|
||||
export * from "./sha";
|
||||
export * from "./util";
|
||||
export * from "./utils";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { encodeString, encodeToBase64, decodeFromBase64 } from "./util";
|
||||
import { encodeString, encodeToBase64, decodeFromBase64 } from "./utils";
|
||||
|
||||
export const generateEncryptionKeyPair = async () => {
|
||||
const keyPair = await crypto.subtle.generateKey(
|
||||
|
||||
@@ -2,7 +2,7 @@ import { z } from "zod";
|
||||
import { storeClientKey } from "$lib/indexedDB";
|
||||
import type { ClientKeys } from "$lib/stores";
|
||||
|
||||
const serializedClientKeysSchema = z.intersection(
|
||||
const SerializedClientKeysSchema = z.intersection(
|
||||
z.object({
|
||||
generator: z.literal("ArkVault"),
|
||||
exportedAt: z.iso.datetime(),
|
||||
@@ -16,7 +16,7 @@ const serializedClientKeysSchema = z.intersection(
|
||||
}),
|
||||
);
|
||||
|
||||
type SerializedClientKeys = z.infer<typeof serializedClientKeysSchema>;
|
||||
type SerializedClientKeys = z.infer<typeof SerializedClientKeysSchema>;
|
||||
|
||||
type DeserializedClientKeys = {
|
||||
encryptKeyBase64: string;
|
||||
@@ -43,7 +43,7 @@ export const serializeClientKeys = ({
|
||||
};
|
||||
|
||||
export const deserializeClientKeys = (serialized: string) => {
|
||||
const zodRes = serializedClientKeysSchema.safeParse(JSON.parse(serialized));
|
||||
const zodRes = SerializedClientKeysSchema.safeParse(JSON.parse(serialized));
|
||||
if (zodRes.success) {
|
||||
return {
|
||||
encryptKeyBase64: zodRes.data.encryptKey,
|
||||
|
||||
Reference in New Issue
Block a user