사소한 리팩토링

This commit is contained in:
static
2026-01-11 14:35:30 +09:00
parent 57c27b76be
commit 2801eed556
22 changed files with 26 additions and 37 deletions

View File

@@ -1 +1 @@
export const DECRYPTED_FILE_URL_PREFIX = "/_internal/decrypted-file/";
export const DECRYPTED_FILE_URL_PREFIX = "/_internal/decryptedFile/";

View File

@@ -5,7 +5,7 @@ import {
encodeToBase64,
decodeFromBase64,
concatenateBuffers,
} from "./util";
} from "./utils";
export const generateMasterKey = async () => {
return {

View File

@@ -1,4 +1,4 @@
export * from "./aes";
export * from "./rsa";
export * from "./sha";
export * from "./util";
export * from "./utils";

View File

@@ -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(

View File

@@ -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,

View File

@@ -0,0 +1,4 @@
import { z } from "zod";
export const DirectoryIdSchema = z.union([z.literal("root"), z.int().positive()]);
export const CategoryIdSchema = z.union([z.literal("root"), z.int().positive()]);

1
src/lib/schemas/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./filesystem";

View File

@@ -1,5 +1,5 @@
import type { Generated } from "kysely";
import type { Ciphertext } from "./util";
import type { Ciphertext } from "./utils";
interface CategoryTable {
id: Generated<number>;

View File

@@ -1,5 +1,5 @@
import type { ColumnType, Generated } from "kysely";
import type { Ciphertext } from "./util";
import type { Ciphertext } from "./utils";
interface DirectoryTable {
id: Generated<number>;

View File

@@ -7,7 +7,7 @@ export * from "./mek";
export * from "./session";
export * from "./upload";
export * from "./user";
export * from "./util";
export * from "./utils";
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface Database {}

View File

@@ -1,5 +1,5 @@
import type { Generated } from "kysely";
import type { Ciphertext } from "./util";
import type { Ciphertext } from "./utils";
interface UploadSessionTable {
id: Generated<string>;

View File

@@ -1,3 +0,0 @@
import { z } from "zod";
export const categoryIdSchema = z.union([z.literal("root"), z.int().positive()]);

View File

@@ -1,3 +0,0 @@
import { z } from "zod";
export const directoryIdSchema = z.union([z.literal("root"), z.int().positive()]);

View File

@@ -1,7 +0,0 @@
import { z } from "zod";
export const fileThumbnailUploadRequest = z.object({
dekVersion: z.iso.datetime(),
contentIv: z.base64().nonempty(),
});
export type FileThumbnailUploadRequest = z.input<typeof fileThumbnailUploadRequest>;

View File

@@ -1,3 +0,0 @@
export * from "./category";
export * from "./directory";
export * from "./file";