From 0f0b5d1af3bb97d65279d06bda5605b0ae1524a2 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Fri, 6 Jun 2025 23:02:51 +0200 Subject: [PATCH] Download all encrypted data in separate files on process creation --- src/pages/account/process-creation.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pages/account/process-creation.ts b/src/pages/account/process-creation.ts index 632adca..134c33d 100644 --- a/src/pages/account/process-creation.ts +++ b/src/pages/account/process-creation.ts @@ -56,6 +56,20 @@ export async function getProcessCreation(container: HTMLElement) { if (approveChangeResult) { const process = await service.getProcess(processId); const newState = service.getStateFromId(process, stateId); + if (!newState) return; + for (const label of Object.keys(newState.keys)) { + const hash = newState.pcd_commitment[label]; + const encryptedData = await service.getBlobFromDb(hash); + const filename = `${label}-${hash.slice(0,8)}.bin`; + + const blob = new Blob([encryptedData], { type: "application/octet-stream" }); + const link = document.createElement("a"); + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); + + setTimeout(() => URL.revokeObjectURL(link.href), 1000); + } const blob = new Blob([JSON.stringify(newState, null, 2)], { type: 'application/json' }); const url = URL.createObjectURL(blob);