Commit Graph

73 Commits

Author SHA1 Message Date
Renato Alcara 77ffe59911 Revert "feat: add WebdPayload with E2E media support and features bitmask"
This reverts commit 313f304ddf.
2026-04-13 00:01:32 -03:00
Renato Alcara 313f304ddf feat: add WebdPayload with E2E media support and features bitmask
Add webdPayload to WebInfo during connection with:
- supportsE2EImage/Video/Audio/Document = true
- supportsMediaRetry = true
- features bitmask with view-once capability flag

This may enable the WA server to deliver view-once media content
to Baileys companions instead of just <unavailable> placeholders.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 23:43:17 -03:00
Renato Alcara ac2acf3d87 Fix/carousel working minimal (#268)
Fix/carousel working minimal (#268)
2026-03-06 23:58:59 -03:00
Renato Alcara c29fe8e5ac fix: use MACOS UserAgent for Android browser to fix pair code registration (#253)
The web protocol (WA\x06\x03) requires a web-compatible UserAgent.
Using SMB_ANDROID in the UserAgent caused pair code registration to
fail with "cannot connect device" even though the phone confirmation
appeared. The Android identity is now only set in DeviceProps.platformType
(ANDROID_PHONE) in the registration node, which correctly determines
the display name in "Linked Devices" as "Android (14)".

Changes:
- getUserAgent(): always returns MACOS platform and Desktop device
- getClientPayload(): always includes webInfo (no longer skipped for Android)
- Remove unused isAndroidBrowser import from validate-connection.ts
- Update pair code comments documenting tested platform IDs
- Add structured logging to pair code request
2026-03-02 22:06:55 -03:00
Renato Alcara 31ac5aeb11 feat: add Android browser preset for companion device registration (#248)
* feat: add Android browser preset for companion device registration

Add Browsers.android(apiLevel) preset that identifies as an Android
companion device (SMB_ANDROID platform, ANDROID_PHONE device type).
Validated against Frida captures of real WhatsApp Android protocol.


* feat: support BAILEYS_BROWSER env var for browser selection

Allows selecting Android companion mode via environment variable
without code changes. Set BAILEYS_BROWSER=android (or android:15
for a specific API level) to register as an Android device.

* fix: auto-detect Android browser in pair code and fall back to Chrome

Pair code companion registration fails with Android browser because the
WA server rejects the ANDROID_PHONE companion_platform_id over the web
Noise protocol. When Android is detected, requestPairingCode() now
transparently uses Chrome/macOS platform values for the pair code stanza
while QR code pairing continues to work as Android (SMB_ANDROID).

* docs: add android to isValidBrowserPreset JSDoc
2026-03-02 12:02:08 -03:00
Renato Alcara 569e43f184 fix: use MACOS platform to resolve 405 connection failure (#244)
fix: use MACOS platform to resolve 405 connection failure
2026-03-01 10:00:20 -03:00
Claude 2a9d9a0a52 fix: revert remaining ?? '' patterns across Utils, WABinary, Signal, and WAUSync files
Completes the comprehensive revert of defensive null coalescing patterns
introduced in PRs 124-129. These patterns (e.g. `value ?? ''`) silently
produced empty strings instead of failing fast, causing subtle bugs like
malformed JIDs and broken Signal session lookups.

Files: libsignal.ts, messages-recv.ts, chat-utils.ts, generics.ts,
history.ts, messages-media.ts, messages.ts, process-message.ts,
validate-connection.ts, jid-utils.ts, UsyncBotProfileProtocol.ts

https://claude.ai/code/session_01XaA7GwNaB6azTHFYQ8WEpB
2026-02-09 13:56:33 +00:00
Claude 7e88ddb858 fix(types): remove non-null assertions across 14 files
Files fixed:
- messages-recv.ts: 58 assertions → null guards, meId extraction, optional chaining
- process-message.ts: 38 assertions → remoteJid/participant guards, proto field checks
- chat-utils.ts: 31 assertions → proto field validation with Boom errors
- messages-send.ts: 20 assertions → meId extraction, participant guards
- chats.ts: 15 assertions → me guard, firstChild guard, jid guards
- messages.ts: 14 assertions → originalFilePath guard, key guards
- groups.ts: 12 assertions → attrs fallbacks with ??
- validate-connection.ts: 9 assertions → grouped proto field validation
- generics.ts: 1 assertion → versionLine guard
- history.ts: 2 assertions → key guards
- libsignal.ts: 1 assertion → deviceId guard
- sender-key-message.ts: 3 assertions → proto guards
- UsyncBotProfileProtocol.ts: 2 assertions → attrs guards
- example.ts: 3 assertions → optional chaining

https://claude.ai/code/session_01E2cfX1N3sJgCJBTvzGazSG
2026-02-09 00:05:13 +00:00
Rajeh Taher a8b8eceb72 waproto, validate-connection: Update headers and proto to latest version 2025-11-06 23:41:41 +02:00
Rajeh Taher d0feb240fa chore: lint 2025-10-16 13:26:58 +03:00
Rajeh Taher c84b20703c connection: update headers and other things 2025-10-15 17:52:52 +03:00
Rajeh Taher 54db127303 defaults,utils: Minimize vectors for automation detection 2025-10-07 20:29:47 +03:00
Rajeh Taher 334977f983 general: revert #1665 2025-10-03 18:14:30 +03:00
Rajeh Taher b8f695cc82 general: linting 2025-10-02 21:41:12 +03:00
Rajeh Taher 096994b927 validate: Fix account signature check and device signature generation 2025-09-28 19:20:14 +03:00
Rajeh Taher 357ef1e599 defaults, validate: fix account signature check for non-hosted JIDs 2025-09-28 18:59:57 +03:00
Rajeh Taher 1eef97aa86 defaults, validate-connection: fix structure of ADV types 2025-09-28 03:58:17 +03:00
João Lucas de Oliveira Lopes 3b46d43beb fix: harden Protobuf Deserialization and Refactor Utilities (#1820)
* refactor: reorganize browser utility functions and improve buffer handling

* fix: harden protobuf deserialization and clean up code

* refactor: simplify data handling in GroupCipher and SenderKey classes

* fix: Ensure consistent Buffer hydration and remove redundant code

* refactor: update decodeAndHydrate calls to use proto types for improved type safety
2025-09-26 04:45:30 +03:00
Rajeh Taher 20693a59d0 lid, wip: Support LIDs in Baileys (#1747)
* lid-mapping: get missing lid from usync

* lid-mapping, jid-utils: change to isPnUser and store multiple mappings

* process-message: parse protocolMsg mapping, and store from new msgs

* types: lid-mapping event, addressing enum, alt, contact, group types

* validate, decode: use lid for identity, better logic

* lid: final commit

* linting

* linting

* linting

* linting

* misc: fix testing and also remove version json

* lint: IDE fucking up lint

* lid-mapping: fix build error on NPM

* message-retry: fix proto import
2025-09-08 10:03:28 +03:00
João Lucas de Oliveira Lopes 4d4339dae6 feat(WAProto): Optimize protobuf generation for 80%+ bundle size reduction (#1665)
* chore: remove comments and veirfy from generated proto files (improve size)

* refactor: replace fromObject with create for proto message instantiation and flag no beautiful

* chore: lint issues
2025-09-07 14:08:11 +03:00
Rajeh Taher 8dc852ee89 proto: fix proto generation, tsc: fix node imports of compiled code 2025-07-19 23:16:35 +03:00
Rajeh Taher 787aed88b8 project: Move to ESM Modules 2025-07-17 13:54:17 +03:00
Wender Teixeira e2ce275949 fix: reading qr code with hosted connection (#1520)
* chore: change version web

* fix: enhance pairing response validation and adjust HMAC handling for hosted devices
2025-06-18 08:10:22 -03:00
canove fa706d0b50 chore: format everything 2025-05-06 12:10:19 -03:00
Rajeh Taher 99142aac96 proto: update manually to 2.3000.1020608496 2025-03-06 04:22:17 +02:00
Rajeh Taher 40ebf669dd socket: potential fixes to the 66 id issues 2025-01-30 20:44:18 +02:00
Rajeh Taher 61a0ff3178 mobile: deprecation. 2024-10-14 03:56:32 +03:00
Davidson Gomes 495bb6775a fix: old_version in mobile connection (#722)
* mobile version

* mobile version

* mobile version
2024-04-28 14:02:41 +03:00
ShellTear 6ad0674156 Fix platform types
Fixes #701 and #702.
2024-04-02 22:40:01 +03:00
allburov 32533ed7f6 fix: find platform type based on browser second argument
fix #481 #228
2023-11-20 14:57:41 +07:00
Alessandro Autiero c506182035 Finished requestPairingCode 2023-07-16 20:14:17 +02:00
Alessandro Autiero f498e1e56c Added requestPairingCode method and handler
Fixed typo (trimUndefineds)
Added bytesToCrockford
Replaced advSecretKey with advKeyPair
Added pairingCode prop
Fixed formatting
Added pairing code example
2023-07-16 18:44:17 +02:00
SamuelScheit 6ecc5a8757 fix: socket options 2023-05-12 18:02:41 +02:00
SamuelScheit 65aa4a7d99 unify web + mobile and use tcp socket 2023-04-30 12:30:30 +02:00
SamuelScheit ef673f62ca feat: native-mobile-api 2023-04-20 13:01:11 +02:00
Adhiraj Singh 31b54ec7c3 fix: include accountSignatureKey in retry requests 2022-08-07 18:10:28 +05:30
Adhiraj Singh 2549d10be9 feat: update proto
The new proto extract has a bunch of breaking changes, so if you were using the raw proto in your code somewhere -- then you may have to update your code to make it work with the new proto

!BREAKING_CHANGE
2022-08-01 10:43:04 +05:30
Adhiraj Singh d04718e27a feat: add desktop + full history sync opts 2022-07-26 13:30:01 +05:30
Adhiraj Singh fda266ff73 fix: acc signature 2022-07-14 22:48:37 +05:30
Adhiraj Singh fae4aafdcd fix: validateConnection mutating account 2022-07-14 17:40:49 +05:30
Adhiraj Singh 40a1e268aa feat: add "strictNullChecks" 2022-07-09 10:20:07 +05:30
Adhiraj Singh 8fa500a8a2 chore: update proto
the proto was generated using a different method, hence the diff is larger -- but if the method continues to work, we should get very nice little diffs
2022-06-23 22:14:43 +05:30
Adhiraj Singh 3c278b35f0 fix: add legacy constants for decoding 2022-04-24 16:49:13 +05:30
Adhiraj Singh a7e9dcf512 chore: revert osVersion to match wa web 2022-04-24 12:24:37 +05:30
Adhiraj Singh 40abd71d2e fix: curve verification return boolean 2022-04-23 17:46:59 +05:30
Adhiraj Singh 207f279772 chore: remove curve25519-js dep + use signal curve functions 2022-04-22 19:06:27 +05:30
Adhiraj Singh fe9a6d07ae fix: browser version 2022-04-14 21:29:07 +05:30
Adhiraj Singh 44d1acb05f Merge branch 'master' into invalid-qr-patch 2022-04-13 19:04:32 +05:30
Adhiraj Singh 0cf17fb392 refactor: use Buffer instead of Binary 2022-04-13 13:21:15 +05:30
Adhiraj Singh 7db8796fed feat: include platform in creds 2022-04-13 12:49:46 +05:30