Compare commits

..

No commits in common. "3ca99e8d1c6dad2a90f953426ca384192482dada" and "93b5bc868042205d1c44e3c4f91026575b4fcb43" have entirely different histories.

2 changed files with 10 additions and 36 deletions

View File

@ -130,10 +130,8 @@ export const CreatePage = () => {
}) })
} }
const input = userInput.toLowerCase() if (userInput.startsWith('npub')) {
const pubkey = npubToHex(userInput)
if (input.startsWith('npub')) {
const pubkey = npubToHex(input)
if (pubkey) { if (pubkey) {
addUser(pubkey) addUser(pubkey)
setUserInput('') setUserInput('')
@ -143,12 +141,12 @@ export const CreatePage = () => {
return return
} }
if (input.includes('@')) { if (userInput.includes('@')) {
setIsLoading(true) setIsLoading(true)
setLoadingSpinnerDesc('Querying for nip05') setLoadingSpinnerDesc('Querying for nip05')
const nip05Profile = await queryNip05(input) const nip05Profile = await queryNip05(userInput)
.catch((err) => { .catch((err) => {
console.error(`error occurred in querying nip05: ${input}`, err) console.error(`error occurred in querying nip05: ${userInput}`, err)
return null return null
}) })
.finally(() => { .finally(() => {
@ -391,21 +389,12 @@ export const CreatePage = () => {
fileUrl fileUrl
)}&key=${encodeURIComponent(encryptionKey)}` )}&key=${encodeURIComponent(encryptionKey)}`
) )
} else {
if (signers[0] && signers[0].pubkey === usersPubkey) {
// Create a File object with the Blob data
const file = new File([blob], `compressed.sigit`, {
type: 'application/sigit'
})
navigate(appPrivateRoutes.sign, { state: { file, encryptionKey } })
} else { } else {
saveAs(blob, 'request.sigit') saveAs(blob, 'request.sigit')
setTextToCopy(encryptionKey) setTextToCopy(encryptionKey)
setOpenCopyModel(true) setOpenCopyModel(true)
} }
} }
}
if (authUrl) { if (authUrl) {
return ( return (

View File

@ -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, useLocation } from 'react-router-dom' import { 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 { UserComponent } from '../../components/username' import { UserComponent } from '../../components/username'
@ -69,9 +69,6 @@ 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)
@ -220,23 +217,11 @@ 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, file, encKey]) }, [searchParams])
const decrypt = async (file: File, key: string) => { const decrypt = async (file: File, key: string) => {
setLoadingSpinnerDesc('Decrypting file') setLoadingSpinnerDesc('Decrypting file')