From 57e9dfff2cc75ead68956d6dfd20b1278ff9bb72 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 28 Jan 2026 13:44:21 -0500 Subject: [PATCH] Adjust NIP-07 login permission flow --- js/nostr/client.js | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/js/nostr/client.js b/js/nostr/client.js index 88125a54..2348e8dd 100644 --- a/js/nostr/client.js +++ b/js/nostr/client.js @@ -1954,18 +1954,12 @@ export class NostrClient { ); } - const permissionResult = await this.ensureExtensionPermissions( - DEFAULT_NIP07_PERMISSION_METHODS, + const initialPubkey = await runNip07WithRetry( + () => extension.getPublicKey(), + { + label: "extension.getPublicKey", + }, ); - if (!permissionResult.ok) { - const denialMessage = - 'The NIP-07 extension reported "permission denied". Please approve the prompt and try again.'; - const denialError = new Error(denialMessage); - if (permissionResult.error) { - denialError.cause = permissionResult.error; - } - throw denialError; - } if ( allowAccountSelection && @@ -1996,9 +1990,12 @@ export class NostrClient { } } - const pubkey = await runNip07WithRetry(() => extension.getPublicKey(), { - label: "extension.getPublicKey", - }); + const pubkey = + allowAccountSelection && typeof extension.selectAccounts === "function" + ? await runNip07WithRetry(() => extension.getPublicKey(), { + label: "extension.getPublicKey", + }) + : initialPubkey; if (!pubkey || typeof pubkey !== "string") { throw new Error( @@ -2039,15 +2036,6 @@ export class NostrClient { adapter.pubkey = pubkey; setActiveSigner(adapter); - this.ensureExtensionPermissions(DEFAULT_NIP07_PERMISSION_METHODS).catch( - (err) => { - userLogger.warn( - "[nostr] Extension permissions were not fully granted after login:", - err, - ); - }, - ); - return { pubkey, signer: adapter }; }