Fix amber signer missing pubkey

This commit is contained in:
hzrd149 2024-09-08 09:29:41 -05:00
parent 77c0f0fbbf
commit 1353ccdfd9
2 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"nostrudel": patch
---
Fix amber signer missing pubkey

View File

@ -84,8 +84,10 @@ export default class AmberSigner implements Nip07Signer {
if (this.pubkey) return this.pubkey;
const result = await this.intentRequest(AmberSigner.createGetPublicKeyIntent());
if (isHexKey(result)) return result;
else if (result.startsWith("npub") || result.startsWith("nprofile")) {
if (isHexKey(result)) {
this.pubkey = result;
return result;
} else if (result.startsWith("npub") || result.startsWith("nprofile")) {
const decode = nip19.decode(result);
const pubkey = getPubkeyFromDecodeResult(decode);
if (!pubkey) throw new Error("Expected npub from clipboard");