파일 다운로드 임시 구현

This commit is contained in:
static committed 2025-01-05 20:45:31 +09:00
1 parent 9ca6444bc9
commit c580556740
7 files changed
+137 -18

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
import { unwrapDataKey, decryptString } from "$lib/modules/crypto";
import type { FileInfoResponse } from "$lib/server/schemas";
export const decryptFileMetadata = async (metadata: FileInfoResponse, masterKey: CryptoKey) => {
const { dataKey } = await unwrapDataKey(metadata.dek, masterKey);
return {
dataKey,
name: await decryptString(metadata.name, metadata.nameIv, dataKey),
};
};