aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/nostrlogin.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-18 08:27:27 -0700
committerAdam Soltys <[email protected]>2026-08-18 08:27:27 -0700
commit1f8071e5d86104f5ad86d7d8f94f32daeda7fc76 (patch)
treee89c7b3b0bbcc797414104a63165a23276177e2d /src/features/nostrlogin.js
parentf684cee551fc2d2470f518332597dd9072a7da90 (diff)
downloadcoinosv3-1f8071e5d86104f5ad86d7d8f94f32daeda7fc76.tar.gz
coinosv3-1f8071e5d86104f5ad86d7d8f94f32daeda7fc76.zip
A missing signer opens a door instead of a toast: the reconnect screen offers the extension, the signer-app link, or a pasted key — same account enforced — and the silent reattach closes it on its own when it lands
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JtaatFfAbx91Nh3xqKVqKz
Diffstat (limited to 'src/features/nostrlogin.js')
-rw-r--r--src/features/nostrlogin.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/features/nostrlogin.js b/src/features/nostrlogin.js
index 6c06fc8..5195778 100644
--- a/src/features/nostrlogin.js
+++ b/src/features/nostrlogin.js
@@ -389,9 +389,51 @@ export function nostrLoginFeature(ctx) {
linkSection());
}
+ // The reconnect takeover: opened by any feature whose action just found
+ // the signer missing (a reload dropped it; Amethyst and friends can't
+ // reattach silently). Same guarded buttons as the settings card — an
+ // extension, the signer-app deeplink/QR, or a pasted key — and the run
+ // refuses a different account.
+ function reconnectScreen() {
+ const st = load();
+ const run = (makeSigner) => reconnectSigner(makeSigner).then(() => {
+ if (live) { ui.nostrReconnect = null; render(); }
+ });
+ return h('div', { class: 'col', style: 'gap:16px' },
+ ctx.brandHeader(false),
+ h('div', { class: 'card col', style: 'gap:12px' },
+ h('h3', { style: 'margin:0' }, t('nlReconnectTitle')),
+ h('p', { class: 'small muted', style: 'margin:0' }, t('nlReconnectBody', { npub: (npubOf(st.pubkey) || '').slice(0, 12) })),
+ signerButtons(run),
+ ui.nostrLoginError ? h('div', { class: 'notice err' }, ui.nostrLoginError) : null),
+ h('button', { class: 'btn-ghost btn-block', onClick: () => {
+ stopNostrConnect();
+ ui.nostrReconnect = null; ui.nostrConnectOpen = false; ui.nostrLoginError = '';
+ render();
+ } }, t('back')));
+ }
+
return {
id: 'nostrlogin',
stop() { stopNostrConnect(); },
+ screenView() {
+ if (ui.screen !== 'wallet' || !ui.nostrReconnect) return null;
+ return reconnectScreen();
+ },
+ // An action needed the login signer and it isn't there: open the
+ // reconnect screen (and try the silent extension reattach in the
+ // background — it closes the screen by itself when it lands).
+ nostrReconnectPrompt() {
+ const st = load();
+ if (!st.pubkey || live) return false;
+ ui.nostrReconnect = true;
+ ui.nostrLoginError = '';
+ this.nostrLoginResume().then((sg) => {
+ if (sg && ui.nostrReconnect) { ui.nostrReconnect = null; render(); }
+ }).catch(() => {});
+ render();
+ return true;
+ },
init() {
// A live signer is bound to the wallet that linked it. Switching to an
// account that never did must not inherit the login identity — it used