whalibmob 5.33.6 β 5.33.7
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 +1 -1
- package/lib/Client.js +15 -14
- package/lib/DeviceManager.js +5 -7
- package/lib/MediaService.js +2 -2
- package/lib/PushClient.js +1 -1
- package/lib/Registration.js +1 -1
- package/lib/WAM/BinaryInfo.js +3 -3
- package/lib/WAM/constants.js +4 -4
- package/lib/WAM/encode.js +1 -1
- package/lib/playstore-device.js +1 -1
- package/lib/proto/MessageProto.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ code, and bring the account into being. Both transports, one API.
|
|
|
39
39
|
|
|
40
40
|
### π¬ Need help? Talk to me on Telegram
|
|
41
41
|
|
|
42
|
-
[](https://t.me
|
|
42
|
+
[](https://t.me/whalibmob)
|
|
43
43
|
|
|
44
44
|
[](https://t.me/brtyu545)
|
|
45
45
|
|
package/lib/Client.js
CHANGED
|
@@ -1904,8 +1904,8 @@ class WhalibmobClient extends EventEmitter {
|
|
|
1904
1904
|
// the bit means naming that moment back. A <clean> without it does not
|
|
1905
1905
|
// acknowledge anything in particular, so the server keeps announcing the
|
|
1906
1906
|
// same change on every connection from now on β which is what it did:
|
|
1907
|
-
// the timestamp was on the wire and never read off it.
|
|
1908
|
-
//
|
|
1907
|
+
// the timestamp was on the wire and never read off it. The reference
|
|
1908
|
+
// client's mark-not-dirty takes it as an argument for exactly this reason.
|
|
1909
1909
|
dirtyTypes.push({
|
|
1910
1910
|
type: String(attrs.type),
|
|
1911
1911
|
timestamp: attrs.timestamp ? String(attrs.timestamp) : null
|
|
@@ -1940,8 +1940,8 @@ class WhalibmobClient extends EventEmitter {
|
|
|
1940
1940
|
* The timestamp is half of that acknowledgement: it says *which* change is
|
|
1941
1941
|
* being cleared. Every `<clean>` this sent went out without one, because the
|
|
1942
1942
|
* attribute was never read off the `<dirty>` that carried it β so nothing was
|
|
1943
|
-
* acknowledged in particular and the server kept announcing.
|
|
1944
|
-
*
|
|
1943
|
+
* acknowledged in particular and the server kept announcing. The reference
|
|
1944
|
+
* client's mark-not-dirty takes it as an argument for the same reason.
|
|
1945
1945
|
*
|
|
1946
1946
|
* @param {string} type the dirty type, e.g. 'groups'
|
|
1947
1947
|
* @param {number|string} [fromTs] the timestamp the announcement carried
|
|
@@ -2135,8 +2135,8 @@ class WhalibmobClient extends EventEmitter {
|
|
|
2135
2135
|
* chat message to yourself.
|
|
2136
2136
|
*
|
|
2137
2137
|
* Asking twice for the same key inside a day achieves nothing, so each id is
|
|
2138
|
-
* remembered and held down for that long. This is what
|
|
2139
|
-
*
|
|
2138
|
+
* remembered and held down for that long. This is what the reference client
|
|
2139
|
+
* does when it requests app-state keys, and for the same reason.
|
|
2140
2140
|
*
|
|
2141
2141
|
* @param {string[]} keyIds base64 (or hex) key ids, as the decoder reports
|
|
2142
2142
|
* @returns {Promise<string|null>} the id of the message that carried it
|
|
@@ -2910,9 +2910,9 @@ class WhalibmobClient extends EventEmitter {
|
|
|
2910
2910
|
// ever holds one. A primary (an SMS session) has no salt on file and sends no
|
|
2911
2911
|
// cstoken, which is what the real primary does until it has minted its own.
|
|
2912
2912
|
//
|
|
2913
|
-
// This mirrors
|
|
2914
|
-
// the PSA account and not a bot; the recipient resolved to
|
|
2915
|
-
// taken over that LID's bare `user@lid` string.
|
|
2913
|
+
// This mirrors the reference client's cstoken generation line for line: a
|
|
2914
|
+
// regular user, not the PSA account and not a bot; the recipient resolved to
|
|
2915
|
+
// a LID; the HMAC taken over that LID's bare `user@lid` string.
|
|
2916
2916
|
|
|
2917
2917
|
/** The stored NCT salt as bytes, or null when this session has none. */
|
|
2918
2918
|
_nctSalt() {
|
|
@@ -2927,7 +2927,8 @@ class WhalibmobClient extends EventEmitter {
|
|
|
2927
2927
|
*
|
|
2928
2928
|
* A JID already on the LID server is used as-is; a phone JID is resolved
|
|
2929
2929
|
* through the same PNβLID map every send uses. Device and agent parts are
|
|
2930
|
-
* dropped β the token is taken over the non-AD address, as
|
|
2930
|
+
* dropped β the token is taken over the non-AD address, as the reference
|
|
2931
|
+
* client does.
|
|
2931
2932
|
*/
|
|
2932
2933
|
_bareLidFor(jid) {
|
|
2933
2934
|
if (!jid) return null;
|
|
@@ -4077,7 +4078,7 @@ class WhalibmobClient extends EventEmitter {
|
|
|
4077
4078
|
* someone linking a laptop and a tablet in the same sitting produced two
|
|
4078
4079
|
* children, two hashes, and the whole thing was thrown away β cache dropped,
|
|
4079
4080
|
* full usync round-trip on the next send. Steps are now kept separately and
|
|
4080
|
-
* applied one at a time
|
|
4081
|
+
* applied one at a time.
|
|
4081
4082
|
*
|
|
4082
4083
|
* Children are `add`, `remove`, or `update`. `update` does not name what it
|
|
4083
4084
|
* changed, so it survives as a step that tells the applier to drop the cache
|
|
@@ -4357,7 +4358,7 @@ class WhalibmobClient extends EventEmitter {
|
|
|
4357
4358
|
|
|
4358
4359
|
// The acknowledgement a server push gets, whatever tag it came in on.
|
|
4359
4360
|
//
|
|
4360
|
-
// Mirrors the one
|
|
4361
|
+
// Mirrors the one the reference client sends: the stanza's own tag as the class, its id,
|
|
4361
4362
|
// and back to whoever sent it, carrying `participant` and `recipient` through
|
|
4362
4363
|
// when the stanza named them. `type` rides along for everything but a message,
|
|
4363
4364
|
// where it means something else entirely.
|
|
@@ -6335,7 +6336,7 @@ class WhalibmobClient extends EventEmitter {
|
|
|
6335
6336
|
* directPath, its own mediaKey, its own digests β carried beside the text
|
|
6336
6337
|
* rather than inside it, and encrypted under a key name of its own. So
|
|
6337
6338
|
* `downloadMedia` cannot fetch it: that reads the message's own media, and a
|
|
6338
|
-
* text message has none. This is
|
|
6339
|
+
* text message has none. This is the reference client's thumbnail download.
|
|
6339
6340
|
*
|
|
6340
6341
|
* The small inline preview is a different thing and needs no download: it is
|
|
6341
6342
|
* already on the decoded message as `jpegThumbnail`.
|
|
@@ -7391,7 +7392,7 @@ class WhalibmobClient extends EventEmitter {
|
|
|
7391
7392
|
*
|
|
7392
7393
|
* Both JIDs are taken without their device: a vote belongs to an account.
|
|
7393
7394
|
*
|
|
7394
|
-
* This is
|
|
7395
|
+
* This is the reference client's poll-vote decryption. Nothing here could read a vote before:
|
|
7395
7396
|
* `sendPoll` handed back the key and left the rest to the caller.
|
|
7396
7397
|
*
|
|
7397
7398
|
* @param {object} vote the `message` event payload, or its `decoded`
|
package/lib/DeviceManager.js
CHANGED
|
@@ -1211,14 +1211,12 @@ class DeviceManager {
|
|
|
1211
1211
|
* notification as a whole. A contact linking two devices in one sitting sends
|
|
1212
1212
|
* two children with two different hashes, and reading them as one change with
|
|
1213
1213
|
* one hash β which is what this did β meant the notification could never
|
|
1214
|
-
* verify and the cache was dropped every time. Stepping through them
|
|
1215
|
-
*
|
|
1216
|
-
* the case that used to defeat it.
|
|
1214
|
+
* verify and the cache was dropped every time. Stepping through them one at a
|
|
1215
|
+
* time keeps the cache across exactly the case that used to defeat it.
|
|
1217
1216
|
*
|
|
1218
1217
|
* A step that fails to verify drops the cache but not the running list, so a
|
|
1219
|
-
* later step whose hash does match puts a proven list back β the
|
|
1220
|
-
*
|
|
1221
|
-
* cached one.
|
|
1218
|
+
* later step whose hash does match puts a proven list back β the recovery
|
|
1219
|
+
* that comes from mutating the local copy after deleting the cached one.
|
|
1222
1220
|
*
|
|
1223
1221
|
* @param {object} opts
|
|
1224
1222
|
* @param {string} opts.priKey the cache entry: digits, or 'lid:<user>'
|
|
@@ -1259,7 +1257,7 @@ class DeviceManager {
|
|
|
1259
1257
|
|
|
1260
1258
|
// `update` does not say what changed. The list on file cannot be trusted
|
|
1261
1259
|
// and cannot be repaired, so it goes β and the remaining steps still get
|
|
1262
|
-
// their turn
|
|
1260
|
+
// their turn.
|
|
1263
1261
|
if (step.tag === 'update') {
|
|
1264
1262
|
this._dcDel([priKey]);
|
|
1265
1263
|
out.primaryOk = false;
|
package/lib/MediaService.js
CHANGED
|
@@ -266,8 +266,8 @@ function _digestMismatch(actual, expected, what) {
|
|
|
266
266
|
* The MAC is the guarantee β its key comes from the mediaKey, which only the
|
|
267
267
|
* sender and the recipients hold β and it was always checked. The two digests
|
|
268
268
|
* were not: fileEncSha256 only when the caller asked for it, and fileSha256
|
|
269
|
-
* never at all, though it was written on every upload.
|
|
270
|
-
* every download
|
|
269
|
+
* never at all, though it was written on every upload. Both are meant to be
|
|
270
|
+
* checked on every download, and now so does this.
|
|
271
271
|
*
|
|
272
272
|
* They tell failures apart, too. A truncated or substituted download is caught
|
|
273
273
|
* before any work is spent decrypting it, and a plaintext that decrypts but is
|
package/lib/PushClient.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
2
|
+
//push here
|
|
3
3
|
// βββ Push clients βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
4
4
|
//
|
|
5
5
|
// Every real WhatsApp install can be woken by the server, and which line it is
|
package/lib/Registration.js
CHANGED
package/lib/WAM/BinaryInfo.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
// What an outgoing WAM buffer is assembled from.
|
|
4
4
|
//
|
|
5
|
-
//
|
|
6
|
-
// the
|
|
7
|
-
//
|
|
5
|
+
// A protocol version, a sequence number that the server uses to order buffers,
|
|
6
|
+
// the events queued for the next flush, and the scratch list the encoder fills
|
|
7
|
+
// with byte chunks.
|
|
8
8
|
|
|
9
9
|
class BinaryInfo {
|
|
10
10
|
constructor(options = {}) {
|
package/lib/WAM/constants.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
// The WAM event and global tables, exactly as the reference client defines them.
|
|
4
4
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// the
|
|
5
|
+
// Every event id, every field id and every type is taken unchanged from
|
|
6
|
+
// WhatsApp Web itself β a generated table scraped from the client, not
|
|
7
|
+
// something to hand-edit: an id that drifts from what the server expects makes
|
|
8
|
+
// the whole buffer unparseable on the other side.
|
|
9
9
|
//
|
|
10
10
|
// WEB_EVENTS one entry per event: { name, id, props: { field: [id, type] },
|
|
11
11
|
// wamChannel, weight }
|
package/lib/WAM/encode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// The WAM binary encoder
|
|
3
|
+
// The WAM binary encoder.
|
|
4
4
|
//
|
|
5
5
|
// A buffer is a 'WAM' magic header, then a run of length-prefixed values whose
|
|
6
6
|
// flags say whether each one is a global attribute, an event, or a field of the
|
package/lib/playstore-device.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Aurora-style device profile posted to the anonymous token dispenser.
|
|
2
|
-
//
|
|
2
|
+
// Describes an emulator-class device (sdk-gphone64-x86_64) β the dispenser
|
|
3
3
|
// mints an account shaped for this device, and the Play catalogue decides
|
|
4
4
|
// what it is allowed to download from it.
|
|
5
5
|
|
|
@@ -360,8 +360,7 @@ function encodeMessage(type, payload) {
|
|
|
360
360
|
// message is buried inside a DeviceSentMessage the copy inside it is a level
|
|
361
361
|
// too deep for anything that does not know to go looking. A poll echoed to our
|
|
362
362
|
// own devices reached them without a message secret, so none of them could ever
|
|
363
|
-
// decrypt a vote on it.
|
|
364
|
-
// in marshalMessage) and Baileys both duplicate it for the same reason.
|
|
363
|
+
// decrypt a vote on it. The reference clients duplicate it for the same reason.
|
|
365
364
|
//
|
|
366
365
|
// phash is left unset, as it is by every other implementation: it describes the
|
|
367
366
|
// participant list, the server checks that against the hash on the stanza, and
|
|
@@ -770,7 +769,8 @@ function decodeMessageContainer(buf, depth) {
|
|
|
770
769
|
// own JID and names nothing: the conversation it belongs to is only ever
|
|
771
770
|
// written here, in the envelope. It was being opened and thrown away, so
|
|
772
771
|
// a message sent from the phone arrived with no way to tell which chat
|
|
773
|
-
// it was in.
|
|
772
|
+
// it was in. The reference client keeps the same two fields on its
|
|
773
|
+
// device-sent metadata.
|
|
774
774
|
if (w.field === 31) {
|
|
775
775
|
try {
|
|
776
776
|
const env = _decodeFields(f[31]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whalibmob",
|
|
3
|
-
"version": "5.33.
|
|
3
|
+
"version": "5.33.7",
|
|
4
4
|
"description": "Node.js library for WhatsApp β register a number over SMS, or link as a companion by QR. Signal E2E encryption, media, groups, channels.",
|
|
5
5
|
"author": "Kunboruto20",
|
|
6
6
|
"main": "index.js",
|