@budetzz/baileys 2.0.3
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 +393 -0
- package/WAProto/index.js +169661 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.js +147 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.js +15 -0
- package/lib/Signal/Group/group-session-builder.js +64 -0
- package/lib/Signal/Group/group_cipher.js +96 -0
- package/lib/Signal/Group/index.js +57 -0
- package/lib/Signal/Group/keyhelper.js +55 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.js +34 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js +69 -0
- package/lib/Signal/Group/sender-key-name.js +51 -0
- package/lib/Signal/Group/sender-key-record.js +53 -0
- package/lib/Signal/Group/sender-key-state.js +99 -0
- package/lib/Signal/Group/sender-message-key.js +29 -0
- package/lib/Signal/libsignal.js +174 -0
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.js +19 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/business.js +260 -0
- package/lib/Socket/chats.js +983 -0
- package/lib/Socket/dugong.js +484 -0
- package/lib/Socket/groups.js +317 -0
- package/lib/Socket/index.js +11 -0
- package/lib/Socket/messages-recv.js +1110 -0
- package/lib/Socket/messages-send.js +909 -0
- package/lib/Socket/newsletter.js +404 -0
- package/lib/Socket/newsletter.js.bak +404 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.js +665 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.js +427 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Store/p +1 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.js +4 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.js +27 -0
- package/lib/Types/LabelAssociation.js +9 -0
- package/lib/Types/Message.js +9 -0
- package/lib/Types/Newsletter.js +38 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.js +2 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.js +42 -0
- package/lib/Utils/auth-utils.js +206 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.js +234 -0
- package/lib/Utils/chat-utils.js +729 -0
- package/lib/Utils/crypto.js +151 -0
- package/lib/Utils/decode-wa-message.js +198 -0
- package/lib/Utils/event-buffer.js +514 -0
- package/lib/Utils/generics.js +423 -0
- package/lib/Utils/history.js +96 -0
- package/lib/Utils/index.js +33 -0
- package/lib/Utils/link-preview.js +93 -0
- package/lib/Utils/logger.js +7 -0
- package/lib/Utils/lt-hash.js +51 -0
- package/lib/Utils/make-mutex.js +43 -0
- package/lib/Utils/messages-media.js +819 -0
- package/lib/Utils/messages.js +784 -0
- package/lib/Utils/noise-handler.js +155 -0
- package/lib/Utils/p +1 -0
- package/lib/Utils/process-message.js +321 -0
- package/lib/Utils/signal.js +153 -0
- package/lib/Utils/use-multi-file-auth-state.js +119 -0
- package/lib/Utils/validate-connection.js +229 -0
- package/lib/WABinary/constants.js +40 -0
- package/lib/WABinary/decode.js +252 -0
- package/lib/WABinary/encode.js +265 -0
- package/lib/WABinary/generic-utils.js +198 -0
- package/lib/WABinary/index.js +21 -0
- package/lib/WABinary/jid-utils.js +62 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.js +13 -0
- package/lib/WAM/constants.js +15350 -0
- package/lib/WAM/encode.js +155 -0
- package/lib/WAM/index.js +19 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.js +89 -0
- package/lib/WAUSync/USyncUser.js +26 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.js +43 -0
- package/package.json +93 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LT_HASH_ANTI_TAMPERING = void 0;
|
|
4
|
+
const crypto_1 = require("./crypto");
|
|
5
|
+
/**
|
|
6
|
+
* LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data
|
|
7
|
+
* over a series of mutations. You can add/remove mutations and it'll return a hash equal to
|
|
8
|
+
* if the same series of mutations was made sequentially.
|
|
9
|
+
*/
|
|
10
|
+
const o = 128;
|
|
11
|
+
class d {
|
|
12
|
+
constructor(e) {
|
|
13
|
+
this.salt = e;
|
|
14
|
+
}
|
|
15
|
+
add(e, t) {
|
|
16
|
+
var r = this;
|
|
17
|
+
for (const item of t) {
|
|
18
|
+
e = r._addSingle(e, item);
|
|
19
|
+
}
|
|
20
|
+
return e;
|
|
21
|
+
}
|
|
22
|
+
subtract(e, t) {
|
|
23
|
+
var r = this;
|
|
24
|
+
for (const item of t) {
|
|
25
|
+
e = r._subtractSingle(e, item);
|
|
26
|
+
}
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
subtractThenAdd(e, t, r) {
|
|
30
|
+
var n = this;
|
|
31
|
+
return n.add(n.subtract(e, r), t);
|
|
32
|
+
}
|
|
33
|
+
_addSingle(e, t) {
|
|
34
|
+
var r = this;
|
|
35
|
+
const n = new Uint8Array((0, crypto_1.hkdf)(Buffer.from(t), o, { info: r.salt })).buffer;
|
|
36
|
+
return r.performPointwiseWithOverflow(e, n, ((e, t) => e + t));
|
|
37
|
+
}
|
|
38
|
+
_subtractSingle(e, t) {
|
|
39
|
+
var r = this;
|
|
40
|
+
const n = new Uint8Array((0, crypto_1.hkdf)(Buffer.from(t), o, { info: r.salt })).buffer;
|
|
41
|
+
return r.performPointwiseWithOverflow(e, n, ((e, t) => e - t));
|
|
42
|
+
}
|
|
43
|
+
performPointwiseWithOverflow(e, t, r) {
|
|
44
|
+
const n = new DataView(e), i = new DataView(t), a = new ArrayBuffer(n.byteLength), s = new DataView(a);
|
|
45
|
+
for (let e = 0; e < n.byteLength; e += 2) {
|
|
46
|
+
s.setUint16(e, r(n.getUint16(e, !0), i.getUint16(e, !0)), !0);
|
|
47
|
+
}
|
|
48
|
+
return a;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.LT_HASH_ANTI_TAMPERING = new d('WhatsApp Patch Integrity');
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeKeyedMutex = exports.makeMutex = void 0;
|
|
4
|
+
const makeMutex = () => {
|
|
5
|
+
let task = Promise.resolve();
|
|
6
|
+
let taskTimeout;
|
|
7
|
+
return {
|
|
8
|
+
mutex(code) {
|
|
9
|
+
task = (async () => {
|
|
10
|
+
// wait for the previous task to complete
|
|
11
|
+
// if there is an error, we swallow so as to not block the queue
|
|
12
|
+
try {
|
|
13
|
+
await task;
|
|
14
|
+
}
|
|
15
|
+
catch (_a) { }
|
|
16
|
+
try {
|
|
17
|
+
// execute the current task
|
|
18
|
+
const result = await code();
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
clearTimeout(taskTimeout);
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
// we replace the existing task, appending the new piece of execution to it
|
|
26
|
+
// so the next task will have to wait for this one to finish
|
|
27
|
+
return task;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.makeMutex = makeMutex;
|
|
32
|
+
const makeKeyedMutex = () => {
|
|
33
|
+
const map = {};
|
|
34
|
+
return {
|
|
35
|
+
mutex(key, task) {
|
|
36
|
+
if (!map[key]) {
|
|
37
|
+
map[key] = (0, exports.makeMutex)();
|
|
38
|
+
}
|
|
39
|
+
return map[key].mutex(task);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.makeKeyedMutex = makeKeyedMutex;
|