mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 06:58:46 +00:00
DB 마이그레이션 스크립트 재생성 및 간단한 이미지/비디오 뷰어 구현
This commit is contained in:
@@ -21,6 +21,7 @@ export interface NewFileParams {
|
||||
mekVersion: number;
|
||||
encDek: string;
|
||||
dekVersion: Date;
|
||||
contentType: string;
|
||||
encContentIv: string;
|
||||
encName: string;
|
||||
encNameIv: string;
|
||||
@@ -137,6 +138,7 @@ export const registerNewFile = async (params: NewFileParams) => {
|
||||
createdAt: now,
|
||||
userId: params.userId,
|
||||
mekVersion: params.mekVersion,
|
||||
contentType: params.contentType,
|
||||
encDek: params.encDek,
|
||||
dekVersion: params.dekVersion,
|
||||
encContentIv: params.encContentIv,
|
||||
|
||||
@@ -47,6 +47,7 @@ export const file = sqliteTable(
|
||||
mekVersion: integer("master_encryption_key_version").notNull(),
|
||||
encDek: text("encrypted_data_encryption_key").notNull().unique(), // Base64
|
||||
dekVersion: integer("data_encryption_key_version", { mode: "timestamp_ms" }).notNull(),
|
||||
contentType: text("content_type").notNull(),
|
||||
encContentIv: text("encrypted_content_iv").notNull(), // Base64
|
||||
encName: ciphertext("encrypted_name").notNull(),
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import mime from "mime";
|
||||
import { z } from "zod";
|
||||
|
||||
export const fileRenameRequest = z.object({
|
||||
@@ -12,6 +13,10 @@ export const fileInfoResponse = z.object({
|
||||
mekVersion: z.number().int().positive(),
|
||||
dek: z.string().base64().nonempty(),
|
||||
dekVersion: z.date(),
|
||||
contentType: z
|
||||
.string()
|
||||
.nonempty()
|
||||
.refine((value) => mime.getExtension(value) !== null), // MIME type
|
||||
contentIv: z.string().base64().nonempty(),
|
||||
name: z.string().base64().nonempty(),
|
||||
nameIv: z.string().base64().nonempty(),
|
||||
@@ -23,6 +28,10 @@ export const fileUploadRequest = z.object({
|
||||
mekVersion: z.number().int().positive(),
|
||||
dek: z.string().base64().nonempty(),
|
||||
dekVersion: z.coerce.date(),
|
||||
contentType: z
|
||||
.string()
|
||||
.nonempty()
|
||||
.refine((value) => mime.getExtension(value) !== null), // MIME type
|
||||
contentIv: z.string().base64().nonempty(),
|
||||
name: z.string().base64().nonempty(),
|
||||
nameIv: z.string().base64().nonempty(),
|
||||
|
||||
@@ -83,6 +83,7 @@ export const getFileInformation = async (userId: number, fileId: number) => {
|
||||
mekVersion: file.mekVersion,
|
||||
encDek: file.encDek,
|
||||
dekVersion: file.dekVersion,
|
||||
contentType: file.contentType,
|
||||
encContentIv: file.encContentIv,
|
||||
encName: file.encName,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user