fix(device-pairing): refuse to mint pairing codes from an address that cannot pair

A loopback origin in production or plain HTTP on a public address still
minted a code and showed a browser QR no other device could use.

- one availability rule decides untrusted, loopback and public plain-HTTP
  origins; POST /api/device-pairing/links checks it before minting
- GET /api/device-pairing/availability reports the rule for the page origin
  without minting
- Connect a device disables "Show QR code" and explains the fix when the
  address cannot pair
- private-network plain HTTP keeps the browser QR; the app QR still needs
  the toggle
This commit is contained in:
Chris Scott committed 2026-10-24 19:26:21 -04:00
1 parent 106e8f51fc
commit b9d8d18124
12 files changed
+529 -64

No files matched your search

+11
View File
@@ -1,5 +1,6 @@
import type {
CreateDevicePairingLinksRequest,
DevicePairingAvailability,
DevicePairingLinksResponse,
PairedDevice,
PairedDevicesResponse,
@@ -62,6 +63,16 @@ export async function createDevicePairingLinks(
})
}
/** Reads whether the Manager can mint pairing codes for an address without minting one. */
export async function getDevicePairingAvailability(
origin: string,
): Promise<DevicePairingAvailability> {
return fetchWrapper<DevicePairingAvailability>(
`${API_BASE_URL}/api/device-pairing/availability`,
{ params: { origin } },
)
}
/** Lists the devices signed in to this account. */
export async function listPairedDevices(): Promise<PairedDevice[]> {
const response = await fetchWrapper<PairedDevicesResponse>(