diff options
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; |
