whalibmob 5.5.41 → 5.5.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -423,44 +423,48 @@ class DeviceManager {
423
423
  //
424
424
  // APK-confirmed format (extracted from WhatsApp DEX string tables):
425
425
  //
426
+ // Correct wire format (verified against live WA server):
427
+ //
426
428
  // <iq to="s.whatsapp.net" type="get" xmlns="usync">
427
- // <usync sid="..." mode="query" last="true" index="0" context="message">
429
+ // <usync sid="..." mode="query" last="true" index="0" context="interactive">
428
430
  // <query>
429
- // <devices version="2" device_orientation="0" fetch_options="5"/>
431
+ // <devices version="2"/>
430
432
  // <lid/>
433
+ // <contact/>
431
434
  // </query>
432
435
  // <list>
433
- // <user><contact>+phone</contact></user> ← Buffer, not jid attr string
436
+ // <user><contact>+phone</contact></user> ← Buffer, NOT jid attr
434
437
  // </list>
435
438
  // <side_list/>
436
439
  // </usync>
437
440
  // </iq>
438
441
  //
439
- // Critical fixes vs original whalibmob implementation:
442
+ // Key findings vs original buggy whalibmob implementation:
443
+ //
444
+ // Fix A — User list format was wrong (jid attr → server ignored IQ):
445
+ // Correct: <user><contact>+phone</contact></user> (Buffer content, same as _doContactUsync)
446
+ // Wrong: <user jid="phone@s.whatsapp.net"/> (jid attr — server silently drops IQ)
440
447
  //
441
- // Fix Afetch_options="5" MISSING from <devices> node:
442
- // Without fetch_options="5", the WA server returns ONLY device 0 (primary phone).
443
- // fetch_options="5" instructs the server to return ALL linked devices.
444
- // device_orientation="0" is also required by the server.
448
+ // Fix BExtra <devices> attributes break the IQ:
449
+ // device_orientation="0" and fetch_options="5" both cause the server to ignore the IQ.
450
+ // fetch_options is not in the binary token dict encoded as BINARY_8 → server parse error.
451
+ // Use only version="2" on <devices>. Server returns ALL linked devices without extra attrs.
445
452
  //
446
- // Fix BUser list format: use <contact>+phone</contact> as Buffer content.
453
+ // Fix Ccontext and side_list must match _doContactUsync (the working format):
454
+ // context="interactive" + <side_list/> is REQUIRED. context="message" → server ignores IQ.
447
455
  async _doUsyncIq(phones) {
448
456
  const iqId = this._client._genMsgId();
449
457
  const sid = this._client._genMsgId();
450
458
 
451
- // User list: <user><contact>+phone</contact></user>
452
- // This is the ONLY format the server responds to for phone-based usync.
453
- // The <user jid="..."/> attribute format is silently ignored by the server.
459
+ // User list: identical to contact usync format that the server responds to.
454
460
  const listChildren = phones.map(p =>
455
461
  new BinaryNode('user', {}, [
456
462
  new BinaryNode('contact', {}, Buffer.from('+' + p, 'utf8'))
457
463
  ])
458
464
  );
459
465
 
460
- // context="interactive" is REQUIRED.
461
- // The server ignores context="message" usync IQs entirely (never replies).
462
- // Query includes <devices>, <lid>, AND <contact> so the server returns
463
- // the full device list + LID mapping + contact presence in one round-trip.
466
+ // Same structure as _doContactUsync (which works) but with <devices> and <lid>
467
+ // added to the query. context="interactive" + side_list matches the working format.
464
468
  const iqNode = new BinaryNode('iq',
465
469
  { id: iqId, to: 's.whatsapp.net', type: 'get', xmlns: 'usync' },
466
470
  [new BinaryNode('usync',
@@ -824,8 +828,6 @@ class DeviceManager {
824
828
  [
825
829
  new BinaryNode('query', {},
826
830
  [
827
- // context="interactive" is REQUIRED — server silently ignores
828
- // "message" context usync IQs (same as _doUsyncIq).
829
831
  new BinaryNode('devices', { version: '2' }, null),
830
832
  new BinaryNode('lid', {}, null)
831
833
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  {
3
3
  "name": "whalibmob",
4
- "version": "5.5.41",
4
+ "version": "5.5.42",
5
5
  "description": "WhatsApp library for interaction with WhatsApp Mobile API no web",
6
6
  "author": "Kunboruto50",
7
7
  "main": "index.js",