diff options
| author | Adam Soltys <[email protected]> | 2026-10-29 13:57:02 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-29 13:57:02 -0700 |
| commit | 10dec87bc74e1f16464d3c61c378a2acd8b029c3 (patch) | |
| tree | 80bdc039f25b09864e1a1790aee365e79cd29b88 /src/cordn-client.js | |
| parent | 722efa5e82c73ef76e722d39d243ecbaa982a3a5 (diff) | |
| download | coinosv3-10dec87bc74e1f16464d3c61c378a2acd8b029c3.tar.gz coinosv3-10dec87bc74e1f16464d3c61c378a2acd8b029c3.zip | |
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 oneHEADmaster
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6TUeqTyZB8eXLGymUY
Diffstat (limited to 'src/cordn-client.js')
| -rw-r--r-- | src/cordn-client.js | 6 |
1 files changed, 4 insertions, 2 deletions
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; |
