파일 다운로드 임시 구현

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

10
src/lib/services/file.ts Normal file
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),
};
};