diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.js | 8 | ||||
| -rw-r--r-- | src/features/nostrlogin.js | 2 |
2 files changed, 10 insertions, 0 deletions
@@ -3597,6 +3597,14 @@ const ctx = { getAccount: () => accountSel(), // Open (or create) a wallet from a mnemonic — used by nostr login. openMnemonic: async (mnemonic, passphrase, opts) => enterWallet(mnemonic, passphrase, opts), + // A nostr login that lands mid-wizard: a restored wallet has been through + // onboarding elsewhere, so the wizard ends; a fresh one just releases the + // back-button hold so the wizard advances to naming it. + onbNostrLogin: (restored) => { + if (!ui.onb) return; + if (restored) { ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} } + else ui.onb.heldFor = null; + }, }; const FEATURES = buildFeatures(ctx); diff --git a/src/features/nostrlogin.js b/src/features/nostrlogin.js index 731c1b9..222b516 100644 --- a/src/features/nostrlogin.js +++ b/src/features/nostrlogin.js @@ -98,6 +98,7 @@ export function nostrLoginFeature(ctx) { save({ ...load(), pubkey: signer.pubkey, linked: Date.now(), ...sessionOf(signer) }); // claim the real npub as the payment address while this signer is live ctx.hook('namesAdoptIdentity', signer, npubOf(signer.pubkey))?.catch?.(() => {}); + ctx.onbNostrLogin(res.mode === 'restored'); toast(res.mode === 'derived' ? t('nlOpenedDerived') : t('nlOpenedRestored')); busy(false); } catch (e) { fail(e); } @@ -119,6 +120,7 @@ export function nostrLoginFeature(ctx) { await ctx.openMnemonic(mnemonic, (existing && existing.passphrase) || '', { nostrPubkey: st.signer.pubkey }); save({ ...load(), pubkey: st.signer.pubkey, linked: Date.now(), ...sessionOf(st.signer) }); ctx.hook('namesAdoptIdentity', st.signer, npubOf(st.signer.pubkey))?.catch?.(() => {}); + ctx.onbNostrLogin(!!existing); toast(existing ? t('nlOpenedRestored') : t('nlCreated')); busy(false); } catch (e) { fail(e); } |
