mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 08:06:56 +00:00
컴파일 오류 등 수정
This commit is contained in:
@@ -63,7 +63,7 @@ export const registerUserClient = async (
|
||||
}
|
||||
|
||||
try {
|
||||
const clientId = await createClient(encPubKey, sigPubKey, userId);
|
||||
const { clientId } = await createClient(encPubKey, sigPubKey, userId);
|
||||
return { challenge: await createUserClientChallenge(ip, userId, clientId, encPubKey) };
|
||||
} catch (e) {
|
||||
if (e instanceof IntegrityError && e.message === "Public key(s) already registered") {
|
||||
|
||||
@@ -8,8 +8,9 @@ import {
|
||||
setDirectoryEncName,
|
||||
unregisterDirectory,
|
||||
getAllFilesByParent,
|
||||
type NewDirectoryParams,
|
||||
type NewDirectory,
|
||||
} from "$lib/server/db/file";
|
||||
import type { Ciphertext } from "$lib/server/db/schema";
|
||||
|
||||
export const getDirectoryInformation = async (userId: number, directoryId: "root" | number) => {
|
||||
const directory = directoryId !== "root" ? await getDirectory(userId, directoryId) : undefined;
|
||||
@@ -53,11 +54,10 @@ export const renameDirectory = async (
|
||||
userId: number,
|
||||
directoryId: number,
|
||||
dekVersion: Date,
|
||||
newEncName: string,
|
||||
newEncNameIv: string,
|
||||
newEncName: Ciphertext,
|
||||
) => {
|
||||
try {
|
||||
await setDirectoryEncName(userId, directoryId, dekVersion, newEncName, newEncNameIv);
|
||||
await setDirectoryEncName(userId, directoryId, dekVersion, newEncName);
|
||||
} catch (e) {
|
||||
if (e instanceof IntegrityError) {
|
||||
if (e.message === "Directory not found") {
|
||||
@@ -70,7 +70,7 @@ export const renameDirectory = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const createDirectory = async (params: NewDirectoryParams) => {
|
||||
export const createDirectory = async (params: NewDirectory) => {
|
||||
const oneMinuteAgo = new Date(Date.now() - 60 * 1000);
|
||||
const oneMinuteLater = new Date(Date.now() + 60 * 1000);
|
||||
if (params.dekVersion <= oneMinuteAgo || params.dekVersion >= oneMinuteLater) {
|
||||
|
||||
@@ -13,8 +13,9 @@ import {
|
||||
getFile,
|
||||
setFileEncName,
|
||||
unregisterFile,
|
||||
type NewFileParams,
|
||||
type NewFile,
|
||||
} from "$lib/server/db/file";
|
||||
import type { Ciphertext } from "$lib/server/db/schema";
|
||||
import env from "$lib/server/loadenv";
|
||||
|
||||
export const getFileInformation = async (userId: number, fileId: number) => {
|
||||
@@ -38,8 +39,8 @@ export const getFileInformation = async (userId: number, fileId: number) => {
|
||||
|
||||
export const deleteFile = async (userId: number, fileId: number) => {
|
||||
try {
|
||||
const filePath = await unregisterFile(userId, fileId);
|
||||
unlink(filePath); // Intended
|
||||
const { path } = await unregisterFile(userId, fileId);
|
||||
unlink(path); // Intended
|
||||
} catch (e) {
|
||||
if (e instanceof IntegrityError && e.message === "File not found") {
|
||||
error(404, "Invalid file id");
|
||||
@@ -65,11 +66,10 @@ export const renameFile = async (
|
||||
userId: number,
|
||||
fileId: number,
|
||||
dekVersion: Date,
|
||||
newEncName: string,
|
||||
newEncNameIv: string,
|
||||
newEncName: Ciphertext,
|
||||
) => {
|
||||
try {
|
||||
await setFileEncName(userId, fileId, dekVersion, newEncName, newEncNameIv);
|
||||
await setFileEncName(userId, fileId, dekVersion, newEncName);
|
||||
} catch (e) {
|
||||
if (e instanceof IntegrityError) {
|
||||
if (e.message === "File not found") {
|
||||
@@ -96,7 +96,7 @@ const safeUnlink = async (path: string) => {
|
||||
};
|
||||
|
||||
export const uploadFile = async (
|
||||
params: Omit<NewFileParams, "path" | "encContentHash">,
|
||||
params: Omit<NewFile, "path" | "encContentHash">,
|
||||
encContentStream: Readable,
|
||||
encContentHash: Promise<string>,
|
||||
) => {
|
||||
|
||||
@@ -7,11 +7,11 @@ import { verifyClientEncMekSig } from "$lib/server/modules/mek";
|
||||
export const getClientMekList = async (userId: number, clientId: number) => {
|
||||
const clientMeks = await getAllValidClientMeks(userId, clientId);
|
||||
return {
|
||||
encMeks: clientMeks.map((clientMek) => ({
|
||||
version: clientMek.master_encryption_key.version,
|
||||
state: clientMek.master_encryption_key.state as "active" | "retired",
|
||||
encMek: clientMek.client_master_encryption_key.encMek,
|
||||
encMekSig: clientMek.client_master_encryption_key.encMekSig,
|
||||
encMeks: clientMeks.map(({ version, state, encMek, encMekSig }) => ({
|
||||
version,
|
||||
state,
|
||||
encMek,
|
||||
encMekSig,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user