From 10dec87bc74e1f16464d3c61c378a2acd8b029c3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 29 Oct 2026 13:57:02 -0700 Subject: A remote signer (Amethyst) that wasn't heard the moment the app needed it no longer means a new connection: "Reconnect your signer" keeps trying the stored session (at once, every 10 s, and on every return to the tab) and closes itself when the signer answers. Before, the screen made one try, or none if a try had failed in the last 20 s (it nearly always had: that failure is what opened it), so the only way out was a fresh nostrconnect, while the stored session answered in 0.7 s whenever anyone asked (Adam's phone, 2026-10-29). A try made while the tab was hidden (frozen on a phone) no longer counts as a failure, a closed signer ("not open anymore") is treated as dead and replaced, and Cordn follows a replaced signer instead of signing with the closed one Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6TUeqTyZB8eXLGymUY --- src/cordn-client.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/cordn-client.js') diff --git a/src/cordn-client.js b/src/cordn-client.js index d09488d..e0be08b 100644 --- a/src/cordn-client.js +++ b/src/cordn-client.js @@ -67,14 +67,16 @@ export function cordnClient({ scope, pubkey, identity, on, coordinator = C.DEFAU // never used unasked. if (id.signer.interactive && !interactive) return null; if (!id.signer.decryptFrom) return null; - return { raw: null, sign: (e) => id.signer.signEvent(e), decrypt: (peer, ct) => id.signer.decryptFrom(peer, ct) }; + return { raw: null, obj: id.signer, sign: (e) => id.signer.signEvent(e), decrypt: (peer, ct) => id.signer.decryptFrom(peer, ct) }; } // The transport, once a signer can back it. Rebuilt if the signer changes. async function transport(opts) { const s = await signer(opts); if (!s) return null; - const key = s.raw ? Array.from(s.raw.slice(0, 8)).join(',') : 'adapter'; + // a remote signer that reconnected is a new object: the old one is + // closed ("not open anymore"), so the transport must follow it + const key = s.raw ? Array.from(s.raw.slice(0, 8)).join(',') : s.obj; if (cvm && cvmSigner === key) return cvm; if (cvm) cvm.stop(); cvmSigner = key; -- cgit v1.2.3