diff --git a/api/bot.mdx b/api/bot.mdx index fd22a12..42828ae 100644 --- a/api/bot.mdx +++ b/api/bot.mdx @@ -406,7 +406,7 @@ Pair code runs concurrently with QR code pairing — whichever completes first w -The `companion_platform_display` shown on the phone is derived automatically from the resolved `platform_id` and the device's `os` string: web variants emit ` ()`; Android variants emit `Android ()`. There is no separate `platform_display` field on `PairCodeOptions`. +The `companion_platform_display` shown on the phone is derived automatically from the resolved `platform_id` and the device's `os` string: web variants emit ` ()` (Android `PlatformType`s map to `Chrome`, so they show as `Chrome (Android)` by default); explicit `AndroidPhone`/`AndroidTablet`/`AndroidAmbiguous` overrides emit `Android ()`. There is no separate `platform_display` field on `PairCodeOptions`. --- diff --git a/api/client.mdx b/api/client.mdx index f2883d5..ea499d4 100644 --- a/api/client.mdx +++ b/api/client.mdx @@ -244,7 +244,7 @@ This can run concurrently with QR code pairing — whichever completes first win - `phone_number` — Phone number in international format (e.g., `"15551234567"`) - `show_push_notification` — Whether to show a push notification on the phone (default: `true`) - `custom_code` — Optional custom 8-character code using Crockford Base32 alphabet - - `platform_id` — `Option` override for ``. `None` derives the wire id from `Device.device_props.platform_type` (typically `Chrome`). The matching `` is always derived; web variants emit ` ()` and Android variants emit `Android ()`. + - `platform_id` — `Option` override for ``. `None` derives the wire id from `Device.device_props.platform_type` (typically `Chrome`; Android `PlatformType`s also map to `Chrome` because the server requires attestation for the Android letter codes). The matching `` is always derived; web variants emit ` ()`, and explicit `AndroidPhone`/`AndroidTablet`/`AndroidAmbiguous` overrides emit `Android ()`. diff --git a/concepts/authentication.mdx b/concepts/authentication.mdx index 7ebafa6..93ba055 100644 --- a/concepts/authentication.mdx +++ b/concepts/authentication.mdx @@ -248,8 +248,7 @@ pub struct PairCodeOptions { // wacore/src/companion_reg.rs pub enum CompanionWebClientType { // Web (digit codes from WAWebCompanionRegClientUtils.DEVICE_PLATFORM) - Unknown, // b'0' - Chrome, // b'1' — default + Chrome, // b'1' Edge, // b'2' Firefox, // b'3' Ie, // b'4' @@ -257,26 +256,28 @@ pub enum CompanionWebClientType { Safari, // b'6' Electron, // b'7' Uwp, // b'8' - OtherWebClient, // b'9' - // Mobile (letter codes from the official WhatsApp Android client) + OtherWebClient, // b'9' — default fallback + // Mobile (letter codes from the official WhatsApp Android client). + // Reachable only via an explicit `PairCodeOptions::platform_id` override + // because the server requires attestation that this crate cannot fake. AndroidTablet, // b'd' AndroidPhone, // b'e' AndroidAmbiguous, // b'f' } ``` -The server accepts 23 single-byte ids (`0..9` and `a..m`); only the 13 with a confirmed platform meaning are exposed. Variants without a confirmed letter fall back to `OtherWebClient` (`'9'`). +The proto's `UNKNOWN` (wire `'0'`) is intentionally absent — WA Web never emits it from a real browser and the server rejects it. The default is `OtherWebClient` (`'9'`). The server accepts 23 single-byte ids (`0..9` and `a..m`); only the 12 with a confirmed platform meaning are exposed. #### Mapping from `PlatformType` -`companion_web_client_type_for_platform` maps each `wa::device_props::PlatformType` to a wire variant. Web platforms map to their browser variant (Chrome, Firefox, Edge, etc.). Android platforms map to the dedicated Android letters. Other mobile and embedded platforms collapse to `OtherWebClient`. +`companion_web_client_type_for_platform` maps each `wa::device_props::PlatformType` to a wire variant. Web platforms map to their browser variant (Chrome, Firefox, Edge, etc.). `Desktop` maps to `Electron`. The Android `PlatformType` variants (`AndroidPhone`, `AndroidTablet`, `AndroidAmbiguous`) map to **`Chrome`** — that's what real WA Web on Chrome-Android emits and what the server accepts without attestation. To request the Android letter codes (`'d'`/`'e'`/`'f'`) explicitly, set `PairCodeOptions::platform_id`. iOS, AR/VR, Wear OS, and the proto's `UNKNOWN` collapse to `OtherWebClient`. #### `companion_platform_display` -The display string sent in `` is built from the wire variant and the OS reported in `DeviceProps`: +The display string sent in `` is built from the resolved wire variant and the OS reported in `DeviceProps`: -- Web variants emit ` ()`, e.g. `Chrome (Linux)`, `Firefox (Windows)`. -- Android variants emit `Android ()`, e.g. `Android (Android)`. +- Web variants emit ` ()`, e.g. `Chrome (Linux)`, `Firefox (Windows)`. Non-browser web variants (Electron, UWP, OtherWebClient) and Android-mapped-to-Chrome fall back to `Chrome ()`, mirroring WA Web's reported renderer name. +- Explicit `AndroidPhone`/`AndroidTablet`/`AndroidAmbiguous` overrides emit `Android ()`, e.g. `Android (Android)`. - Empty OS substitutes `Linux`. The server only validates that the display string is 1..=100 bytes — there is no browser whitelist.