Skip to content

Commit

Permalink
use temp nostr instance of signing
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed Dec 19, 2024
1 parent 244d6fa commit ad70565
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/nostr-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ export function NostrAuth ({ text, callbackUrl, multiAuth }) {
error: false,
loading: true
})

const nostr = new Nostr()
try {
const { data, error } = await createAuth()
if (error) throw error

const k1 = data?.createAuth.k1
if (!k1) throw new Error('Error generating challenge') // should never happen

const nostr = Nostr.get()
const useExtension = !nip46token
const signer = nostr.getSigner({ nip46token, supportNip07: useExtension })
if (!signer && useExtension) throw new Error('No extension found')
Expand Down Expand Up @@ -162,6 +163,7 @@ export function NostrAuth ({ text, callbackUrl, multiAuth }) {
} catch (e) {
setError(e)
} finally {
nostr.close()
clearSuggestionTimer()
}
}, [])
Expand Down

0 comments on commit ad70565

Please sign in to comment.