whalibmob 5.14.0 → 5.14.1
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.
- package/README.md +12 -11
- package/lib/Client.js +30 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,8 +86,8 @@ npm install -g whalibmob
|
|
|
86
86
|
- [Pin / Unpin](#pin--unpin)
|
|
87
87
|
- [Archive / Unarchive](#archive--unarchive)
|
|
88
88
|
- [Star / Unstar a Message](#star--unstar-a-message-cli)
|
|
89
|
-
- [Sync App State (CLI)](#
|
|
90
|
-
- [Account Restriction Countdown](#
|
|
89
|
+
- [Sync App State (CLI)](#sync-app-state)
|
|
90
|
+
- [Account Restriction Countdown](#account-restriction-countdown)
|
|
91
91
|
- [Disappearing Messages](#cli-disappearing-messages)
|
|
92
92
|
- [Default Disappearing Timer](#default-disappearing-timer)
|
|
93
93
|
- [Block / Unblock](#block--unblock)
|
|
@@ -109,7 +109,7 @@ npm install -g whalibmob
|
|
|
109
109
|
- [List Group Participants](#list-group-participants)
|
|
110
110
|
- [Pending Join Requests](#pending-join-requests)
|
|
111
111
|
- [Approve / Reject Join Requests](#approve--reject-join-requests)
|
|
112
|
-
- [Personal Invitations (CLI)](#
|
|
112
|
+
- [Personal Invitations (CLI)](#personal-invitations)
|
|
113
113
|
- [Group Settings](#group-settings)
|
|
114
114
|
- [Community Commands](#community-commands-cli)
|
|
115
115
|
- [Newsletter / Channel Commands](#newsletter--channel-commands)
|
|
@@ -165,7 +165,7 @@ npm install -g whalibmob
|
|
|
165
165
|
- [Persistent Files Written to Disk](#persistent-files-written-to-disk)
|
|
166
166
|
- [Reading the History Store](#reading-the-history-store)
|
|
167
167
|
- [tcToken — Error 463 Defense](#tctoken--error-463-defense)
|
|
168
|
-
- [When 463 Means the Account Is Restricted](#account-
|
|
168
|
+
- [When 463 Means the Account Is Restricted](#when-463-means-the-account-is-restricted)
|
|
169
169
|
- [What Is Automatic vs What You Need to Do](#what-is-automatic-vs-what-you-need-to-do)
|
|
170
170
|
- [Receiving Media](#receiving-media)
|
|
171
171
|
- [Sending Messages](#sending-messages)
|
|
@@ -200,7 +200,7 @@ npm install -g whalibmob
|
|
|
200
200
|
- [Mark a Chat Read / Unread](#mark-a-chat-read--unread)
|
|
201
201
|
- [Pin / Unpin a Chat](#pin--unpin-a-chat)
|
|
202
202
|
- [Star / Unstar a Message](#star--unstar-a-message)
|
|
203
|
-
- [Reading Changes Made Elsewhere](#
|
|
203
|
+
- [Reading Changes Made Elsewhere](#reading-changes-made-elsewhere)
|
|
204
204
|
- [Disappearing Messages](#disappearing-messages)
|
|
205
205
|
- [User Queries](#user-queries)
|
|
206
206
|
- [Check If a Number Has WhatsApp](#check-if-a-number-has-whatsapp)
|
|
@@ -357,7 +357,7 @@ wa> /reg confirm 919634847671 123456
|
|
|
357
357
|
On success you will see:
|
|
358
358
|
|
|
359
359
|
```
|
|
360
|
-
registered session saved to /home/user/.waSession/919634847671.json
|
|
360
|
+
registered session saved to /home/user/.waSession/919634847671/919634847671.json
|
|
361
361
|
now run: /connect 919634847671
|
|
362
362
|
```
|
|
363
363
|
|
|
@@ -1379,7 +1379,7 @@ wa> /reg code 919634847671 wa_old
|
|
|
1379
1379
|
|
|
1380
1380
|
# confirm the code received
|
|
1381
1381
|
wa> /reg confirm 919634847671 123456
|
|
1382
|
-
registered session saved to /home/user/.waSession/919634847671.json
|
|
1382
|
+
registered session saved to /home/user/.waSession/919634847671/919634847671.json
|
|
1383
1383
|
now run: /connect 919634847671
|
|
1384
1384
|
```
|
|
1385
1385
|
|
|
@@ -2760,11 +2760,11 @@ connect()
|
|
|
2760
2760
|
| `chat_removed` | `{ jid, kind, remote }` | A chat was cleared or deleted on another device |
|
|
2761
2761
|
| `contact_update` | `{ jid, name, firstName, lid, username, removed, remote }` | A contact was renamed or removed elsewhere |
|
|
2762
2762
|
| `push_name_update` | `{ name, remote }` | Your own display name changed on another device |
|
|
2763
|
-
| `app_state_sync` | `{ collections, applied }` | An app-state sync finished; see [Reading Changes Made Elsewhere](#
|
|
2763
|
+
| `app_state_sync` | `{ collections, applied }` | An app-state sync finished; see [Reading Changes Made Elsewhere](#reading-changes-made-elsewhere) |
|
|
2764
2764
|
| `app_state_mutation` | `{ collection, index, action, removed }` | An app-state change this library does not model |
|
|
2765
2765
|
| `app_state_key_missing` | `{ collection, keyId }` | App state cannot be read until your phone shares this key |
|
|
2766
2766
|
| `app_state_keys` | `{ keys }` | Your phone shared app-state sync keys; a sync starts automatically |
|
|
2767
|
-
| `account_restriction` | `{ active, remaining, remainingMs, endsAtDate, enforcementType, reason, source }` | The account was restricted or the restriction was lifted — see [When 463 Means the Account Is Restricted](#account-
|
|
2767
|
+
| `account_restriction` | `{ active, remaining, remainingMs, endsAtDate, enforcementType, reason, source }` | The account was restricted or the restriction was lifted — see [When 463 Means the Account Is Restricted](#when-463-means-the-account-is-restricted) |
|
|
2768
2768
|
| `mex_notification` | `{ opName, data }` | A server push over `w:mex` this library does not model |
|
|
2769
2769
|
|
|
2770
2770
|
`remote: true` on a chat event means the change was made on your phone or another
|
|
@@ -4729,9 +4729,10 @@ writes.
|
|
|
4729
4729
|
From Node, the same thing:
|
|
4730
4730
|
|
|
4731
4731
|
```js
|
|
4732
|
-
const { refreshSessionVersion, currentVersionFor } = require('whalibmob')
|
|
4732
|
+
const { refreshSessionVersion, currentVersionFor, storeFileFor } = require('whalibmob')
|
|
4733
4733
|
|
|
4734
|
-
|
|
4734
|
+
const base = path.join(process.env.HOME, '.waSession')
|
|
4735
|
+
await refreshSessionVersion(storeFileFor(base, '5568936182750'))
|
|
4735
4736
|
await currentVersionFor({ os: 'android' }) // { version, source }
|
|
4736
4737
|
```
|
|
4737
4738
|
|
package/lib/Client.js
CHANGED
|
@@ -2432,23 +2432,49 @@ class WhalibmobClient extends EventEmitter {
|
|
|
2432
2432
|
: fromStr;
|
|
2433
2433
|
const recipientPhone = targetJid.split('@')[0].split(':')[0].split('.')[0];
|
|
2434
2434
|
|
|
2435
|
-
|
|
2435
|
+
// The retry names the device under one address family, but a contact holds
|
|
2436
|
+
// a session under each: a Signal address is (user, device) with the server
|
|
2437
|
+
// stripped, and the LID user and the phone user are different strings, so
|
|
2438
|
+
// one session is not reachable under the other's name. Purging only the
|
|
2439
|
+
// family the receipt happened to arrive in left the other one in place —
|
|
2440
|
+
// the resend picked it straight back up and produced the same ciphertext
|
|
2441
|
+
// the device had just said it could not read, so the message stayed
|
|
2442
|
+
// undecryptable until something else rebuilt the session.
|
|
2443
|
+
//
|
|
2444
|
+
// This is what made a reply sent after a companion-device exchange stick on
|
|
2445
|
+
// "Waiting for this message" on the primary: the receipt came in one family,
|
|
2446
|
+
// the stale session sat in the other, and every resend re-used it.
|
|
2447
|
+
const recipientUsers = new Set([recipientPhone]);
|
|
2448
|
+
const mappedPn = this._lidToPn && this._lidToPn.get(recipientPhone);
|
|
2449
|
+
const mappedLid = this._pnToLid && this._pnToLid.get(recipientPhone);
|
|
2450
|
+
if (mappedPn) recipientUsers.add(mappedPn);
|
|
2451
|
+
if (mappedLid) recipientUsers.add(mappedLid);
|
|
2452
|
+
|
|
2453
|
+
_whaDbg('[DBG] RETRY_RECV msgId=' + msgId + ' from=' + fromStr +
|
|
2454
|
+
' users=[' + [...recipientUsers].join(',') + '] — clearing session + resending\n');
|
|
2436
2455
|
|
|
2437
2456
|
// Delete all Signal sessions for the recipient's devices so next send creates fresh pkmsg
|
|
2438
2457
|
const sigStore = this._signal && this._signal.store;
|
|
2439
2458
|
if (sigStore && sigStore._sessions) {
|
|
2440
2459
|
const sessions = sigStore._sessions;
|
|
2441
2460
|
Object.keys(sessions).forEach(addr => {
|
|
2442
|
-
|
|
2461
|
+
// Match on the user segment rather than a bare prefix: "4071.0" must
|
|
2462
|
+
// not be cleared by a retry for "407".
|
|
2463
|
+
const user = addr.slice(0, addr.lastIndexOf('.'));
|
|
2464
|
+
if (recipientUsers.has(user)) {
|
|
2443
2465
|
_whaDbg('[DBG] RETRY deleting session for ' + addr);
|
|
2444
2466
|
delete sessions[addr];
|
|
2445
2467
|
}
|
|
2446
2468
|
});
|
|
2447
2469
|
}
|
|
2448
2470
|
|
|
2449
|
-
// Clear device manager cache so we re-fetch devices on next send
|
|
2471
|
+
// Clear device manager cache so we re-fetch devices on next send. LID device
|
|
2472
|
+
// lists are filed under a "lid:" key, so clearing the bare user only ever
|
|
2473
|
+
// dropped the phone-side list.
|
|
2450
2474
|
if (this._devMgr) {
|
|
2451
|
-
|
|
2475
|
+
const cacheKeys = [];
|
|
2476
|
+
for (const u of recipientUsers) cacheKeys.push(u, 'lid:' + u);
|
|
2477
|
+
this._devMgr.clearCache(cacheKeys);
|
|
2452
2478
|
}
|
|
2453
2479
|
|
|
2454
2480
|
// Re-send the message — will create fresh pre-key (pkmsg) sessions.
|