fix(chats): use abt xmlns and protocol 1 for fetchProps to avoid bad-request

Aligns with Baileys upstream PR #2473. Server rejects the previous
combination (xmlns=w, protocol=2, hash=''), returning bad-request and
dropping AB props on connect. Switches to xmlns=abt with protocol=1 and
omits the hash attr entirely when empty.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Renato Alcara
2026-04-25 11:02:03 -03:00
parent 104d2c47f5
commit c36c32c229
+4 -5
View File
@@ -1060,22 +1060,21 @@ export const makeChatsSocket = (config: SocketConfig) => {
}
}
/** sending non-abt props may fix QR scan fail if server expects */
/** fetch AB props */
const fetchProps = async () => {
//TODO: implement both protocol 1 and protocol 2 prop fetching, specially for abKey for WM
const resultNode = await query({
tag: 'iq',
attrs: {
to: S_WHATSAPP_NET,
xmlns: 'w',
xmlns: 'abt',
type: 'get'
},
content: [
{
tag: 'props',
attrs: {
protocol: '2',
hash: authState?.creds?.lastPropHash || ''
protocol: '1',
...(authState?.creds?.lastPropHash ? { hash: authState.creds.lastPropHash } : {})
}
}
]