IV를 암호화된 파일 및 썸네일 앞에 합쳐서 전송하도록 변경

This commit is contained in:
static
2026-01-11 00:29:59 +09:00
parent 5d130204a6
commit b9e6f17b0c
13 changed files with 161 additions and 76 deletions

View File

@@ -5,7 +5,7 @@
import { page } from "$app/state";
import { FullscreenDiv } from "$lib/components/atoms";
import { Categories, IconEntryButton, TopBar } from "$lib/components/molecules";
import { getFileInfo, type FileInfo, type MaybeFileInfo } from "$lib/modules/filesystem";
import { getFileInfo, type MaybeFileInfo } from "$lib/modules/filesystem";
import { captureVideoThumbnail } from "$lib/modules/thumbnail";
import { getFileDownloadState } from "$lib/modules/file";
import { masterKeyStore } from "$lib/stores";
@@ -95,14 +95,12 @@
untrack(() => {
if (!downloadState && !isDownloadRequested) {
isDownloadRequested = true;
requestFileDownload(data.id, info!.contentIv!, info!.dataKey!.key).then(
async (buffer) => {
const blob = await updateViewer(buffer, contentType);
if (!viewerType) {
FileSaver.saveAs(blob, info!.name);
}
},
);
requestFileDownload(data.id, info!.dataKey!.key).then(async (buffer) => {
const blob = await updateViewer(buffer, contentType);
if (!viewerType) {
FileSaver.saveAs(blob, info!.name);
}
});
}
});
}
@@ -110,7 +108,9 @@
$effect(() => {
if (info?.exists && downloadState?.status === "decrypted") {
untrack(() => !isDownloadRequested && updateViewer(downloadState.result!, info!.contentIv!));
untrack(
() => !isDownloadRequested && updateViewer(downloadState.result!, info!.contentType!),
);
}
});

View File

@@ -77,7 +77,7 @@ export const requestThumbnailGeneration = async (fileInfo: FileInfo) => {
await scheduler.schedule(
async () => {
statuses.set(fileInfo.id, "generation-pending");
file = await requestFileDownload(fileInfo.id, fileInfo.contentIv!, fileInfo.dataKey?.key!);
file = await requestFileDownload(fileInfo.id, fileInfo.dataKey?.key!);
return file.byteLength;
},
async () => {