Merge pull request 'feat: in offline mode navigate creator to sign screen after creation when creator is first signer' (#105) from issue-103 into staging
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m3s
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m3s
Reviewed-on: https://git.sigit.io/sig/it/pulls/105
This commit is contained in:
commit
d3f30dbdbd
@ -392,9 +392,18 @@ export const CreatePage = () => {
|
|||||||
)}&key=${encodeURIComponent(encryptionKey)}`
|
)}&key=${encodeURIComponent(encryptionKey)}`
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
saveAs(blob, 'request.sigit')
|
if (signers[0] && signers[0].pubkey === usersPubkey) {
|
||||||
setTextToCopy(encryptionKey)
|
// Create a File object with the Blob data
|
||||||
setOpenCopyModel(true)
|
const file = new File([blob], `compressed.sigit`, {
|
||||||
|
type: 'application/sigit'
|
||||||
|
})
|
||||||
|
|
||||||
|
navigate(appPrivateRoutes.sign, { state: { file, encryptionKey } })
|
||||||
|
} else {
|
||||||
|
saveAs(blob, 'request.sigit')
|
||||||
|
setTextToCopy(encryptionKey)
|
||||||
|
setOpenCopyModel(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import { MuiFileInput } from 'mui-file-input'
|
|||||||
import { Event, kinds, verifyEvent } from 'nostr-tools'
|
import { Event, kinds, verifyEvent } from 'nostr-tools'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
import { useNavigate, useSearchParams } from 'react-router-dom'
|
import { useNavigate, useSearchParams, useLocation } 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 { UserComponent } from '../../components/username'
|
import { UserComponent } from '../../components/username'
|
||||||
@ -69,6 +69,9 @@ enum SignedStatus {
|
|||||||
|
|
||||||
export const SignPage = () => {
|
export const SignPage = () => {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const location = useLocation()
|
||||||
|
const { file, encryptionKey: encKey } = location.state || {}
|
||||||
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams()
|
const [searchParams, setSearchParams] = useSearchParams()
|
||||||
|
|
||||||
const [displayInput, setDisplayInput] = useState(false)
|
const [displayInput, setDisplayInput] = useState(false)
|
||||||
@ -217,11 +220,23 @@ export const SignPage = () => {
|
|||||||
.finally(() => {
|
.finally(() => {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
})
|
})
|
||||||
|
} else if (file && encKey) {
|
||||||
|
decrypt(file, decodeURIComponent(encKey))
|
||||||
|
.then((arrayBuffer) => {
|
||||||
|
if (arrayBuffer) handleDecryptedArrayBuffer(arrayBuffer)
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(`error occurred in decryption`, err)
|
||||||
|
toast.error(err.message || `error occurred in decryption`)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setIsLoading(false)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
setDisplayInput(true)
|
setDisplayInput(true)
|
||||||
}
|
}
|
||||||
}, [searchParams])
|
}, [searchParams, file, encKey])
|
||||||
|
|
||||||
const decrypt = async (file: File, key: string) => {
|
const decrypt = async (file: File, key: string) => {
|
||||||
setLoadingSpinnerDesc('Decrypting file')
|
setLoadingSpinnerDesc('Decrypting file')
|
||||||
|
Loading…
Reference in New Issue
Block a user