Fix pubkey sign in.

Added try/catch and updated awaits for async methods in regards to sign
in attempts. This appears to resolve some race conditions with nos2x
extension. More testing to be performed.
This commit is contained in:
Thomas Mathews 2022-12-27 18:53:27 -08:00
parent 51ab5aae2a
commit 7ce72540cf
3 changed files with 21 additions and 12 deletions

View file

@ -245,9 +245,13 @@ async function get_pubkey(use_prompt=true) {
return pubkey
if (window.nostr && window.nostr.getPublicKey) {
log_debug("calling window.nostr.getPublicKey()...")
const pubkey = await window.nostr.getPublicKey()
try {
pubkey = await window.nostr.getPublicKey()
return await handle_pubkey(pubkey)
} catch (err) {
return;
}
log_debug("got %s pubkey from nos2x", pubkey)
return await handle_pubkey(pubkey)
}
if (!use_prompt)
return;