From 8b90267e8d91603120303e63f27e7210d4916726 Mon Sep 17 00:00:00 2001 From: SwiftHawk Date: Wed, 12 Jun 2024 16:21:45 +0500 Subject: [PATCH] chore: update the implementation of export sigit --- src/pages/sign/index.tsx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/pages/sign/index.tsx b/src/pages/sign/index.tsx index d0d218d..ff7a632 100644 --- a/src/pages/sign/index.tsx +++ b/src/pages/sign/index.tsx @@ -10,7 +10,6 @@ import { useSelector } from 'react-redux' import { useLocation, useNavigate, useSearchParams } from 'react-router-dom' import { toast } from 'react-toastify' import { LoadingSpinner } from '../../components/LoadingSpinner' -import CopyModal from '../../components/copyModal' import { NostrController } from '../../controllers' import { appPublicRoutes } from '../../routes' import { State } from '../../store/rootReducer' @@ -53,8 +52,6 @@ export const SignPage = () => { const [isLoading, setIsLoading] = useState(true) const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('') - const [openCopyModal, setOpenCopyModel] = useState(false) - const [textToCopy, setTextToCopy] = useState('') const [meta, setMeta] = useState(null) const [signedStatus, setSignedStatus] = useState() @@ -775,11 +772,12 @@ export const SignPage = () => { setLoadingSpinnerDesc('Encrypting zip file') const encryptedArrayBuffer = await encryptArrayBuffer(arrayBuffer, key) - const blob = new Blob([encryptedArrayBuffer]) - saveAs(blob, 'exported.sigit') - setTextToCopy(key) - setOpenCopyModel(true) + const finalZipFile = await createFinalZipFile(encryptedArrayBuffer, key) + + if (!finalZipFile) return + + saveAs(finalZipFile, 'exported.sigit.zip') } /** @@ -870,7 +868,7 @@ export const SignPage = () => { setSelectedFile(value)} /> @@ -928,12 +926,6 @@ export const SignPage = () => { )} - setOpenCopyModel(false)} - title="Decryption key for Sigit file" - textToCopy={textToCopy} - /> ) }