Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/bot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ Pair code runs concurrently with QR code pairing — whichever completes first w
</Note>

<Tip>
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 `<Browser> (<OS>)`; Android variants emit `Android (<OS>)`. 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 `<Browser> (<OS>)` (Android `PlatformType`s map to `Chrome`, so they show as `Chrome (Android)` by default); explicit `AndroidPhone`/`AndroidTablet`/`AndroidAmbiguous` overrides emit `Android (<OS>)`. There is no separate `platform_display` field on `PairCodeOptions`.
</Tip>

---
Expand Down
2 changes: 1 addition & 1 deletion api/client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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<CompanionWebClientType>` override for `<companion_platform_id>`. `None` derives the wire id from `Device.device_props.platform_type` (typically `Chrome`). The matching `<companion_platform_display>` is always derived; web variants emit `<Browser> (<OS>)` and Android variants emit `Android (<OS>)`.
- `platform_id` — `Option<CompanionWebClientType>` override for `<companion_platform_id>`. `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 `<companion_platform_display>` is always derived; web variants emit `<Browser> (<OS>)`, and explicit `AndroidPhone`/`AndroidTablet`/`AndroidAmbiguous` overrides emit `Android (<OS>)`.
</ParamField>

<ResponseField name="code" type="String">
Expand Down
19 changes: 10 additions & 9 deletions concepts/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -248,35 +248,36 @@ 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'
Opera, // b'5'
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 `<companion_platform_display>` is built from the wire variant and the OS reported in `DeviceProps`:
The display string sent in `<companion_platform_display>` is built from the resolved wire variant and the OS reported in `DeviceProps`:

- Web variants emit `<Browser> (<OS>)`, e.g. `Chrome (Linux)`, `Firefox (Windows)`.
- Android variants emit `Android (<OS>)`, e.g. `Android (Android)`.
- Web variants emit `<Browser> (<OS>)`, e.g. `Chrome (Linux)`, `Firefox (Windows)`. Non-browser web variants (Electron, UWP, OtherWebClient) and Android-mapped-to-Chrome fall back to `Chrome (<OS>)`, mirroring WA Web's reported renderer name.
- Explicit `AndroidPhone`/`AndroidTablet`/`AndroidAmbiguous` overrides emit `Android (<OS>)`, 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.
Expand Down