From f72ad37ec01efc5b45be7993574746ce06734733 Mon Sep 17 00:00:00 2001 From: enes Date: Mon, 18 Nov 2024 13:49:39 +0100 Subject: [PATCH] refactor(signature): save only decrypted signature files on export --- src/utils/file.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/utils/file.ts b/src/utils/file.ts index ec118df..8686d09 100644 --- a/src/utils/file.ts +++ b/src/utils/file.ts @@ -1,4 +1,3 @@ -import axios from 'axios' import { MARK_TYPE_CONFIG } from '../components/getMarkComponents.tsx' import { NostrController } from '../controllers/NostrController.ts' import store from '../store/store.ts' @@ -51,20 +50,13 @@ export const getZipWithFiles = async ( m.value && encryptionKey ) { - // Save the original file - const encryptedArrayBuffer = await axios.get(m.value, { - responseType: 'arraybuffer' - }) + // Fetch and decrypt the original file const link = m.value.split('/') - zip.file( - `blossom/encrypted/${link[link.length - 1]}`, - new Blob([encryptedArrayBuffer.data]) - ) const decrypted = await fetchAndDecrypt(m.value, encryptionKey) // Save decrypted zip.file( - `blossom/decrypted/${link[link.length - 1]}.json`, + `signatures/${link[link.length - 1]}.json`, new Blob([decrypted]) ) marks[i].value = decrypted