feat: add dual protocol support (web/native) via BAILEYS_PROTOCOL env
Adds experimental native protocol mode (WAM\x05) as alternative to web protocol (WA\x06\x03). Configurable via BAILEYS_PROTOCOL env var: - web (default): standard WhatsApp Web protocol - native: Android native protocol (may enable view-once media on companions) When native mode is enabled: - NOISE_WA_HEADER changes from WA\x06\x03 to WAM\x05 - DICT_VERSION changes from 3 to 5 - WebInfo is omitted from ClientPayload Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { createHash } from 'crypto'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import {
|
||||
KEY_BUNDLE_TYPE,
|
||||
PROTOCOL_MODE,
|
||||
WA_ADV_ACCOUNT_SIG_PREFIX,
|
||||
WA_ADV_DEVICE_SIG_PREFIX,
|
||||
WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
|
||||
@@ -58,7 +59,10 @@ const getClientPayload = (config: SocketConfig) => {
|
||||
userAgent: getUserAgent(config)
|
||||
}
|
||||
|
||||
payload.webInfo = getWebInfo(config)
|
||||
// Native protocol (WAM\x05) does not use WebInfo — only web protocol does
|
||||
if (PROTOCOL_MODE !== 'native') {
|
||||
payload.webInfo = getWebInfo(config)
|
||||
}
|
||||
|
||||
return payload
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user