feat(remote-connect): account-password mobile pairing and resilient device list#1647
Merged
Merged
Conversation
…evice list Pairing (account mode): - QR advertises auth=account with username prefill when the desktop is logged in; mobile submits account username+password through the ECDH room channel (password is never persisted or logged). - Desktop verifies credentials verify-only: challenge + local master key unwrap compared against the current session, without calling /api/auth/login, so the desktop token is never disturbed. The trusted mobile identity binds the canonical account user id. - Account credentials are never downgraded to password-less pairing when the verifier is unavailable (e.g. desktop signed out after the QR was generated); real failure causes are kept in desktop logs while the mobile gets a unified rejection message. - Login/logout/account switch refresh or clear the pairing context and the URL-bound trusted identity. Device list: - RelayHttpClient refreshes the delegated identity from the paired desktop on HTTP 401 and retries once; the terminal 'authorization expired' state is removed from the devices page. Verification: - cargo test -p bitfun-core --lib remote_connect::tests (5 passed) - cargo test -p bitfun-services-integrations --features remote-connect --test remote_connect_contracts (51 passed) - cargo check -p bitfun-desktop - pnpm --dir src/mobile-web run type-check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the desktop is logged into a BitFun account, QR pairing now requires the same account's username+password instead of a free-form user ID, and the mobile device list transparently recovers from expired delegated identities instead of showing a terminal 'authorization expired' state.
Design spec:
docs/superpowers/specs/2026-07-20-mobile-web-account-pairing-and-device-refresh-design.mdPairing (account mode)
auth=accountwith username prefill when the desktop is logged in; unsigned-in desktops keep the legacy user-ID flow./api/auth/loginis never called, so the desktop token is not refreshed or polluted, and the credentials must match the account currently signed in on the scanned desktop.Device list resilience
RelayHttpClient:clearDelegatedIdentity(),requestDelegatedIdentity({ force }), and a shared 401 handler that clears the delegated identity, force-refreshes it from the paired desktop, and retrieslistDevices/sendDeviceRpconce.DevicesPage: the terminaltokenExpiredstate and its i18n keys are removed; failures fall back to retryable errors or thenoDelegatedIdentitystate.Verification
cargo test -p bitfun-core --lib remote_connect::tests— 5 passed (new focused tests: missing credentials, no-downgrade guard, canonical id binding)cargo test -p bitfun-services-integrations --features remote-connect --test remote_connect_contracts— 51 passedcargo check -p bitfun-desktop— cleanpnpm --dir src/mobile-web run type-check— clean