From 3131630d900aa4a72bf880bfa9c5232bff64d6d6 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Wed, 14 Oct 2026 23:02:49 +0200 Subject: fix(client): link a device from the application; approve one match only "Get a linking code" called the connection the page had just closed on the node's unknown_device refusal, so it never filed anything. It now retries with the request filed on that connection, before the proof (MNP 6.3), and the page tries the group again after each refusal until a linked device approves the code. Offered only in the desktop application: a browser's minted identity is gone by its next connection. Approving refuses a code that matches more than one pending request: filing needs only the account's token, so somebody holding the passphrase who saw a code could file their own keys under it. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/src/meshbay_hub/static/transport.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport.js b/packages/meshbay-hub/src/meshbay_hub/static/transport.js index c86d668..a07f431 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/transport.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/transport.js @@ -1178,6 +1178,21 @@ class MeshBayTransport { } catch (e) { // The UI turns this into "ask the operator for an invite code". this._joinError = e; + // Asked for by the page ("Get a linking code"): filed on this same + // connection, still before the proof (MNP 6.3), because the page + // closes a connection that did not finish. Only for an identity the + // application keeps: one a browser minted is gone by its next + // connection, and approving it would link nothing. + if (e.reason === 'unknown_device' && this.fileDeviceRequest + && this._identity.native) { + try { + const filed = await this.requestDeviceAdd(userId); + e.deviceCode = filed.code; + e.deviceExpiresAt = filed.expiresAt; + } catch (fe) { + e.message = fe.message; + } + } } } -- cgit v1.2.3