chore: update the implementation of export sigit
This commit is contained in:
parent
a3abf40f44
commit
8b90267e8d
@ -10,7 +10,6 @@ import { useSelector } from 'react-redux'
|
|||||||
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'
|
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import { LoadingSpinner } from '../../components/LoadingSpinner'
|
import { LoadingSpinner } from '../../components/LoadingSpinner'
|
||||||
import CopyModal from '../../components/copyModal'
|
|
||||||
import { NostrController } from '../../controllers'
|
import { NostrController } from '../../controllers'
|
||||||
import { appPublicRoutes } from '../../routes'
|
import { appPublicRoutes } from '../../routes'
|
||||||
import { State } from '../../store/rootReducer'
|
import { State } from '../../store/rootReducer'
|
||||||
@ -53,8 +52,6 @@ export const SignPage = () => {
|
|||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(true)
|
const [isLoading, setIsLoading] = useState(true)
|
||||||
const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('')
|
const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('')
|
||||||
const [openCopyModal, setOpenCopyModel] = useState(false)
|
|
||||||
const [textToCopy, setTextToCopy] = useState('')
|
|
||||||
|
|
||||||
const [meta, setMeta] = useState<Meta | null>(null)
|
const [meta, setMeta] = useState<Meta | null>(null)
|
||||||
const [signedStatus, setSignedStatus] = useState<SignedStatus>()
|
const [signedStatus, setSignedStatus] = useState<SignedStatus>()
|
||||||
@ -775,11 +772,12 @@ export const SignPage = () => {
|
|||||||
|
|
||||||
setLoadingSpinnerDesc('Encrypting zip file')
|
setLoadingSpinnerDesc('Encrypting zip file')
|
||||||
const encryptedArrayBuffer = await encryptArrayBuffer(arrayBuffer, key)
|
const encryptedArrayBuffer = await encryptArrayBuffer(arrayBuffer, key)
|
||||||
const blob = new Blob([encryptedArrayBuffer])
|
|
||||||
saveAs(blob, 'exported.sigit')
|
|
||||||
|
|
||||||
setTextToCopy(key)
|
const finalZipFile = await createFinalZipFile(encryptedArrayBuffer, key)
|
||||||
setOpenCopyModel(true)
|
|
||||||
|
if (!finalZipFile) return
|
||||||
|
|
||||||
|
saveAs(finalZipFile, 'exported.sigit.zip')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -870,7 +868,7 @@ export const SignPage = () => {
|
|||||||
<Box className={styles.inputBlock}>
|
<Box className={styles.inputBlock}>
|
||||||
<MuiFileInput
|
<MuiFileInput
|
||||||
placeholder="Select file"
|
placeholder="Select file"
|
||||||
inputProps={{ accept: '.sigit' }}
|
inputProps={{ accept: '.sigit.zip' }}
|
||||||
value={selectedFile}
|
value={selectedFile}
|
||||||
onChange={(value) => setSelectedFile(value)}
|
onChange={(value) => setSelectedFile(value)}
|
||||||
/>
|
/>
|
||||||
@ -928,12 +926,6 @@ export const SignPage = () => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<CopyModal
|
|
||||||
open={openCopyModal}
|
|
||||||
handleClose={() => setOpenCopyModel(false)}
|
|
||||||
title="Decryption key for Sigit file"
|
|
||||||
textToCopy={textToCopy}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user