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);