@baileys-md/baileys 12.0.1 → 12.2.0
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/LICENSE +21 -13
- package/WAProto/index.js +12 -1
- package/lib/Defaults/index.js +23 -13
- package/lib/KeyDB/BinarySearch.js +28 -18
- package/lib/KeyDB/KeyedDB.js +14 -3
- package/lib/KeyDB/index.js +12 -2
- package/lib/Signal/Group/ciphertext-message.js +12 -2
- package/lib/Signal/Group/group-session-builder.js +13 -2
- package/lib/Signal/Group/group_cipher.js +14 -4
- package/lib/Signal/Group/index.js +12 -2
- package/lib/Signal/Group/keyhelper.js +15 -4
- package/lib/Signal/Group/sender-chain-key.js +14 -4
- package/lib/Signal/Group/sender-key-distribution-message.js +14 -3
- package/lib/Signal/Group/sender-key-message.js +14 -4
- package/lib/Signal/Group/sender-key-name.js +15 -5
- package/lib/Signal/Group/sender-key-record.js +13 -3
- package/lib/Signal/Group/sender-key-state.js +13 -3
- package/lib/Signal/Group/sender-message-key.js +14 -4
- package/lib/Signal/libsignal.js +18 -7
- package/lib/Signal/lid-mapping.js +14 -3
- package/lib/Socket/Client/index.js +12 -2
- package/lib/Socket/Client/websocket.js +13 -3
- package/lib/Socket/index.js +13 -3
- package/lib/Socket/newsletter.js +10 -3
- package/lib/Socket/socket.js +15 -5
- package/lib/Store/index.js +13 -1
- package/lib/Types/Auth.js +12 -2
- package/lib/Types/Bussines.js +12 -2
- package/lib/Types/Call.js +12 -2
- package/lib/Types/Chat.js +12 -2
- package/lib/Types/Contact.js +12 -2
- package/lib/Types/Events.js +12 -2
- package/lib/Types/GroupMetadata.js +12 -2
- package/lib/Types/Label.js +22 -3
- package/lib/Types/LabelAssociation.js +12 -2
- package/lib/Types/Message.js +13 -3
- package/lib/Types/Newsletter.js +13 -3
- package/lib/Types/Product.js +12 -2
- package/lib/Types/Signal.js +12 -2
- package/lib/Types/Socket.js +12 -2
- package/lib/Types/State.js +13 -3
- package/lib/Types/USync.js +12 -2
- package/lib/Types/index.js +13 -3
- package/lib/Utils/auth-utils.js +15 -5
- package/lib/Utils/baileys-event-stream.js +14 -4
- package/lib/Utils/crypto.js +2 -2
- package/lib/Utils/index.js +12 -2
- package/lib/Utils/messages-media.js +58 -75
- package/lib/Utils/messages.js +5 -8
- package/lib/Utils/pre-key-manager.js +14 -4
- package/lib/Utils/process-message.js +20 -10
- package/lib/Utils/signal.js +22 -12
- package/lib/Utils/use-multi-file-auth-state.js +14 -4
- package/lib/Utils/validate-connection.js +22 -12
- package/lib/WABinary/constants.js +13 -3
- package/lib/WABinary/decode.js +16 -6
- package/lib/WABinary/encode.js +20 -10
- package/lib/WABinary/generic-utils.js +13 -1
- package/lib/WABinary/index.js +12 -2
- package/lib/WABinary/jid-utils.js +19 -9
- package/lib/WABinary/types.js +12 -2
- package/lib/WAM/BinaryInfo.js +12 -2
- package/lib/WAM/constants.js +12 -0
- package/lib/WAM/encode.js +18 -8
- package/lib/WAM/index.js +12 -2
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +14 -4
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +15 -4
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +15 -4
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +14 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +15 -4
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +14 -3
- package/lib/WAUSync/Protocols/index.js +14 -3
- package/lib/WAUSync/USyncQuery.js +15 -4
- package/lib/WAUSync/USyncUser.js +14 -3
- package/lib/WAUSync/index.js +14 -3
- package/lib/index.js +14 -6
- package/package.json +43 -43
package/LICENSE
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 Sixx.js </> | @sixcore/baileys
|
|
4
|
+
Mozambique 🇲🇿
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
7
|
+
of this software and associated documentation files (the "Software"), to use,
|
|
8
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
11
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
copies or substantial portions of the Software.
|
|
12
|
+
1. The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
SOFTWARE
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
20
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
22
|
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Project: @sixcore/baileys
|
|
27
|
+
Author: Sixx.js </> 🌿
|
|
28
|
+
Country: Mozambique 🇲🇿
|
|
29
|
+
Description: Node.js library for WhatsApp integration and automation using Baileys.
|
package/WAProto/index.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
import $protobuf from "protobufjs/minimal.js";
|
|
3
14
|
|
|
4
15
|
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
package/lib/Defaults/index.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
2
14
|
import { makeLibSignalRepository } from "../Signal/libsignal.js";
|
|
3
15
|
import { Browsers } from "../Utils/browser-utils.js";
|
|
4
16
|
import { proto } from "../../WAProto/index.js";
|
|
5
17
|
import logger from "../Utils/logger.js";
|
|
6
|
-
|
|
18
|
+
|
|
7
19
|
export const version = [2, 3000, 1033846690]
|
|
8
20
|
export const DICT_VERSION = 3;
|
|
9
|
-
//=======================================================//
|
|
10
21
|
export const NOISE_WA_HEADER = Buffer.from([87, 65, 6, DICT_VERSION]);
|
|
11
22
|
export const CALL_VIDEO_PREFIX = "https://call.whatsapp.com/video/";
|
|
12
23
|
export const CALL_AUDIO_PREFIX = "https://call.whatsapp.com/voice/";
|
|
@@ -22,13 +33,13 @@ export const KEY_BUNDLE_TYPE = Buffer.from([5]);
|
|
|
22
33
|
export const PHONE_CONNECTION_CB = "CB:Pong";
|
|
23
34
|
export const DEF_CALLBACK_PREFIX = "CB:";
|
|
24
35
|
export const DEF_TAG_PREFIX = "TAG:";
|
|
25
|
-
|
|
36
|
+
|
|
26
37
|
export const URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
|
|
27
|
-
|
|
38
|
+
|
|
28
39
|
export const WA_CERT_DETAILS = {
|
|
29
40
|
SERIAL: 0
|
|
30
41
|
};
|
|
31
|
-
|
|
42
|
+
|
|
32
43
|
export const PROCESSABLE_HISTORY_TYPES = [
|
|
33
44
|
proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
34
45
|
proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME,
|
|
@@ -38,13 +49,13 @@ export const PROCESSABLE_HISTORY_TYPES = [
|
|
|
38
49
|
proto.Message.HistorySyncNotification.HistorySyncType.NON_BLOCKING_DATA,
|
|
39
50
|
proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_STATUS_V3
|
|
40
51
|
];
|
|
41
|
-
|
|
52
|
+
|
|
42
53
|
export const DEFAULT_CONNECTION_CONFIG = {
|
|
43
54
|
"version": version,
|
|
44
55
|
"browser": Browsers.iOS("Safari"),
|
|
45
56
|
"waWebSocketUrl": "wss://web.whatsapp.com/ws/chat",
|
|
46
57
|
"connectTimeoutMs": 20000,
|
|
47
|
-
"keepAliveIntervalMs":
|
|
58
|
+
"keepAliveIntervalMs": 5000,
|
|
48
59
|
"logger": logger.child({ "class": "baileys" }),
|
|
49
60
|
"emitOwnEvents": true,
|
|
50
61
|
"defaultQueryTimeoutMs": 60000,
|
|
@@ -60,7 +71,7 @@ export const DEFAULT_CONNECTION_CONFIG = {
|
|
|
60
71
|
"shouldIgnoreJid": () => false,
|
|
61
72
|
"linkPreviewImageThumbnailWidth": 192,
|
|
62
73
|
"transactionOpts": { "maxCommitRetries": 10, "delayBetweenTriesMs": 3000 },
|
|
63
|
-
"generateHighQualityLinkPreview":
|
|
74
|
+
"generateHighQualityLinkPreview": true,
|
|
64
75
|
"enableAutoSessionRecreation": true,
|
|
65
76
|
"enableRecentMessageCache": true,
|
|
66
77
|
"options": {},
|
|
@@ -73,7 +84,7 @@ export const DEFAULT_CONNECTION_CONFIG = {
|
|
|
73
84
|
"cachedGroupMetadata": async () => undefined,
|
|
74
85
|
"makeSignalRepository": makeLibSignalRepository
|
|
75
86
|
};
|
|
76
|
-
|
|
87
|
+
|
|
77
88
|
export const MEDIA_PATH_MAP = {
|
|
78
89
|
"image": "/mms/image",
|
|
79
90
|
"video": "/mms/video",
|
|
@@ -86,7 +97,7 @@ export const MEDIA_PATH_MAP = {
|
|
|
86
97
|
"md-msg-hist": "/mms/md-app-state",
|
|
87
98
|
"biz-cover-photo": "/pps/biz-cover-photo"
|
|
88
99
|
};
|
|
89
|
-
|
|
100
|
+
|
|
90
101
|
export const MEDIA_HKDF_KEY_MAPPING = {
|
|
91
102
|
"audio": "Audio",
|
|
92
103
|
"document": "Document",
|
|
@@ -108,7 +119,7 @@ export const MEDIA_HKDF_KEY_MAPPING = {
|
|
|
108
119
|
"ptv": "Video",
|
|
109
120
|
"biz-cover-photo": "Image"
|
|
110
121
|
};
|
|
111
|
-
|
|
122
|
+
|
|
112
123
|
export const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP);
|
|
113
124
|
export const MIN_PREKEY_COUNT = 5;
|
|
114
125
|
export const INITIAL_PREKEY_COUNT = 812;
|
|
@@ -120,4 +131,3 @@ export const DEFAULT_CACHE_TTLS = {
|
|
|
120
131
|
CALL_OFFER: 5 * 60,
|
|
121
132
|
USER_DEVICES: 5 * 60
|
|
122
133
|
};
|
|
123
|
-
//=======================================================//
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
2
14
|
export default function binarySearch(array, predicate) {
|
|
3
|
-
let low = 0
|
|
4
|
-
let high = array.length
|
|
5
|
-
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
else if (pred > 0) low = mid + 1;
|
|
16
|
-
else return mid;
|
|
15
|
+
let low = 0
|
|
16
|
+
let high = array.length
|
|
17
|
+
|
|
18
|
+
if (high === 0) return -1
|
|
19
|
+
|
|
20
|
+
while (low < high) {
|
|
21
|
+
const Mafilzin = (low + high) >> 1
|
|
22
|
+
const ninja = predicate(array[Mafilzin])
|
|
23
|
+
|
|
24
|
+
if (ninja === 0) return Mafilzin
|
|
25
|
+
if (ninja < 0) high = Mafilzin
|
|
26
|
+
else low = Mafilzin + 1
|
|
17
27
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
|
|
29
|
+
return -1
|
|
30
|
+
}
|
package/lib/KeyDB/KeyedDB.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
2
14
|
import binarySearch from "./BinarySearch.js";
|
|
3
|
-
|
|
15
|
+
|
|
4
16
|
export default class KeyedDB {
|
|
5
17
|
constructor(key, id) {
|
|
6
18
|
this.key = key;
|
|
@@ -164,4 +176,3 @@ export default class KeyedDB {
|
|
|
164
176
|
return binarySearch(this.array, v => this.key.compare(valueKey, this.key.key(v)));
|
|
165
177
|
}
|
|
166
178
|
}
|
|
167
|
-
//===================================//
|
package/lib/KeyDB/index.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
export * from "./BinarySearch.js"
|
|
3
14
|
export * from "./KeyedDB.js"
|
|
4
|
-
//===================================//
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
export class CiphertextMessage {
|
|
3
14
|
constructor() {
|
|
4
15
|
this.UNSUPPORTED_VERSION = 1;
|
|
@@ -10,4 +21,3 @@ export class CiphertextMessage {
|
|
|
10
21
|
this.ENCRYPTED_MESSAGE_OVERHEAD = 53;
|
|
11
22
|
}
|
|
12
23
|
}
|
|
13
|
-
//=======================================================//
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
import { SenderKeyDistributionMessage } from "./sender-key-distribution-message.js";
|
|
3
14
|
import { SenderKeyRecord } from "./sender-key-record.js";
|
|
4
15
|
import { SenderKeyName } from "./sender-key-name.js";
|
|
5
16
|
import * as keyhelper from "./keyhelper.js";
|
|
6
|
-
|
|
17
|
+
|
|
7
18
|
export class GroupSessionBuilder {
|
|
8
19
|
constructor(senderKeyStore) {
|
|
9
20
|
this.senderKeyStore = senderKeyStore;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { decrypt, encrypt } from "libsignal-xeuka/src/crypto.js";
|
|
3
14
|
import { SenderKeyMessage } from "./sender-key-message.js";
|
|
4
15
|
import { SenderKeyRecord } from "./sender-key-record.js";
|
|
5
16
|
import { SenderKeyState } from "./sender-key-state.js";
|
|
6
17
|
import { SenderKeyName } from "./sender-key-name.js";
|
|
7
|
-
|
|
18
|
+
|
|
8
19
|
export class GroupCipher {
|
|
9
20
|
constructor(senderKeyStore, senderKeyName) {
|
|
10
21
|
this.senderKeyStore = senderKeyStore;
|
|
@@ -81,4 +92,3 @@ export class GroupCipher {
|
|
|
81
92
|
}
|
|
82
93
|
}
|
|
83
94
|
}
|
|
84
|
-
//=======================================================//
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
export { SenderKeyDistributionMessage } from "./sender-key-distribution-message.js";
|
|
3
14
|
export { GroupSessionBuilder } from "./group-session-builder.js";
|
|
4
15
|
export { CiphertextMessage } from "./ciphertext-message.js";
|
|
@@ -10,4 +21,3 @@ export { SenderChainKey } from "./sender-chain-key.js";
|
|
|
10
21
|
export { SenderKeyName } from "./sender-key-name.js";
|
|
11
22
|
export { GroupCipher } from "./group_cipher.js";
|
|
12
23
|
export * as keyhelper from "./keyhelper.js";
|
|
13
|
-
//=======================================================//
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { generateKeyPair } from "libsignal-xeuka/src/curve.js";
|
|
3
14
|
import * as nodeCrypto from "crypto";
|
|
4
|
-
|
|
15
|
+
|
|
5
16
|
export function generateSenderKey() {
|
|
6
17
|
return nodeCrypto.randomBytes(32);
|
|
7
18
|
}
|
|
@@ -17,4 +28,4 @@ export function generateSenderSigningKey(key) {
|
|
|
17
28
|
private: Buffer.from(key.privKey)
|
|
18
29
|
};
|
|
19
30
|
}
|
|
20
|
-
|
|
31
|
+
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { calculateMAC } from "libsignal-xeuka/src/crypto.js";
|
|
3
14
|
import { SenderMessageKey } from "./sender-message-key.js";
|
|
4
|
-
|
|
15
|
+
|
|
5
16
|
export class SenderChainKey {
|
|
6
17
|
constructor(iteration, chainKey) {
|
|
7
18
|
this.MESSAGE_KEY_SEED = Buffer.from([0x01]);
|
|
@@ -25,4 +36,3 @@ export class SenderChainKey {
|
|
|
25
36
|
return calculateMAC(key, seed);
|
|
26
37
|
}
|
|
27
38
|
}
|
|
28
|
-
//=======================================================//
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
2
14
|
import { CiphertextMessage } from "./ciphertext-message.js";
|
|
3
15
|
import { proto } from "../../../WAProto/index.js";
|
|
4
|
-
|
|
16
|
+
|
|
5
17
|
export class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
6
18
|
constructor(id, iteration, chainKey, signatureKey, serialized) {
|
|
7
19
|
super();
|
|
@@ -62,4 +74,3 @@ export class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
|
62
74
|
return this.id;
|
|
63
75
|
}
|
|
64
76
|
}
|
|
65
|
-
//=======================================================//
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { calculateSignature, verifySignature } from "libsignal-xeuka/src/curve.js";
|
|
3
14
|
import { CiphertextMessage } from "./ciphertext-message.js";
|
|
4
15
|
import { proto } from "../../../WAProto/index.js";
|
|
5
|
-
|
|
16
|
+
|
|
6
17
|
export class SenderKeyMessage extends CiphertextMessage {
|
|
7
18
|
constructor(keyId, iteration, ciphertext, signatureKey, serialized) {
|
|
8
19
|
super();
|
|
@@ -65,4 +76,3 @@ export class SenderKeyMessage extends CiphertextMessage {
|
|
|
65
76
|
return 4;
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
|
-
//=======================================================//
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
function isNull(str) {
|
|
3
14
|
return str === null || str === "";
|
|
4
15
|
}
|
|
5
|
-
|
|
16
|
+
|
|
6
17
|
function intValue(num) {
|
|
7
18
|
const MAX_VALUE = 0x7fffffff;
|
|
8
19
|
const MIN_VALUE = -0x80000000;
|
|
@@ -11,7 +22,7 @@ function intValue(num) {
|
|
|
11
22
|
}
|
|
12
23
|
return num;
|
|
13
24
|
}
|
|
14
|
-
|
|
25
|
+
|
|
15
26
|
function hashCode(strKey) {
|
|
16
27
|
let hash = 0;
|
|
17
28
|
if (!isNull(strKey)) {
|
|
@@ -22,7 +33,7 @@ function hashCode(strKey) {
|
|
|
22
33
|
}
|
|
23
34
|
return hash;
|
|
24
35
|
}
|
|
25
|
-
|
|
36
|
+
|
|
26
37
|
export class SenderKeyName {
|
|
27
38
|
constructor(groupId, sender) {
|
|
28
39
|
this.groupId = groupId;
|
|
@@ -49,4 +60,3 @@ export class SenderKeyName {
|
|
|
49
60
|
return hashCode(this.groupId) ^ hashCode(this.sender.toString());
|
|
50
61
|
}
|
|
51
62
|
}
|
|
52
|
-
//=======================================================//
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
import { SenderKeyState } from "./sender-key-state.js";
|
|
3
14
|
import { BufferJSON } from "../../Utils/generics.js";
|
|
4
|
-
|
|
15
|
+
|
|
5
16
|
export class SenderKeyRecord {
|
|
6
17
|
constructor(serialized) {
|
|
7
18
|
this.MAX_STATES = 5;
|
|
@@ -40,4 +51,3 @@ export class SenderKeyRecord {
|
|
|
40
51
|
return new SenderKeyRecord(parsed);
|
|
41
52
|
}
|
|
42
53
|
}
|
|
43
|
-
//=======================================================//
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
import { SenderMessageKey } from "./sender-message-key.js";
|
|
3
14
|
import { SenderChainKey } from "./sender-chain-key.js";
|
|
4
|
-
|
|
15
|
+
|
|
5
16
|
export class SenderKeyState {
|
|
6
17
|
constructor(id, iteration, chainKey, signatureKeyPair, signatureKeyPublic, signatureKeyPrivate, senderKeyStateStructure) {
|
|
7
18
|
this.MAX_MESSAGE_KEYS = 2000;
|
|
@@ -83,4 +94,3 @@ export class SenderKeyState {
|
|
|
83
94
|
return this.senderKeyStateStructure;
|
|
84
95
|
}
|
|
85
96
|
}
|
|
86
|
-
//=======================================================//
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { deriveSecrets } from "libsignal-xeuka/src/crypto.js";
|
|
14
|
+
|
|
4
15
|
export class SenderMessageKey {
|
|
5
16
|
constructor(iteration, seed) {
|
|
6
17
|
const derivative = deriveSecrets(seed, Buffer.alloc(32), Buffer.from("WhisperGroup"));
|
|
@@ -25,4 +36,3 @@ export class SenderMessageKey {
|
|
|
25
36
|
return this.seed;
|
|
26
37
|
}
|
|
27
38
|
}
|
|
28
|
-
//=======================================================//
|
package/lib/Signal/libsignal.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
//========================================//
|
|
2
|
+
/**
|
|
3
|
+
* @project @sixcore/baileys
|
|
4
|
+
* @author Sixx.js </>🌿
|
|
5
|
+
* @version 1.0.3
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @country Mozambique 🇲🇿♥️
|
|
8
|
+
* @chamadas || sms +258860817689
|
|
9
|
+
* @whatsApp +55889616-2417 || +258851907875
|
|
10
|
+
* @description Biblioteca Node.js para integração e automação no WhatsApp usando Baileys
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
2
14
|
import { isHostedLidUser, isHostedPnUser, isLidUser, isPnUser, jidDecode, transferDevice, WAJIDDomains } from "../WABinary/index.js";
|
|
3
15
|
import { GroupCipher, GroupSessionBuilder, SenderKeyDistributionMessage } from "./Group/index.js";
|
|
4
16
|
import { SenderKeyRecord } from "./Group/sender-key-record.js";
|
|
5
17
|
import { SenderKeyName } from "./Group/sender-key-name.js";
|
|
6
18
|
import { generateSignalPubKey } from "../Utils/index.js";
|
|
7
19
|
import { LIDMappingStore } from "./lid-mapping.js";
|
|
8
|
-
import * as libsignal from "
|
|
20
|
+
import * as libsignal from "libsignal-xeuka";
|
|
9
21
|
import { LRUCache } from "lru-cache";
|
|
10
|
-
|
|
22
|
+
|
|
11
23
|
export function makeLibSignalRepository(auth, logger, pnToLIDFunc) {
|
|
12
24
|
const lidMapping = new LIDMappingStore(auth.keys, logger, pnToLIDFunc);
|
|
13
25
|
const storage = signalStorage(auth, lidMapping);
|
|
@@ -223,7 +235,7 @@ export function makeLibSignalRepository(auth, logger, pnToLIDFunc) {
|
|
|
223
235
|
};
|
|
224
236
|
return repository;
|
|
225
237
|
}
|
|
226
|
-
|
|
238
|
+
|
|
227
239
|
const jidToSignalProtocolAddress = (jid) => {
|
|
228
240
|
const decoded = jidDecode(jid);
|
|
229
241
|
const { user, device, server, domainType } = decoded;
|
|
@@ -237,11 +249,11 @@ const jidToSignalProtocolAddress = (jid) => {
|
|
|
237
249
|
}
|
|
238
250
|
return new libsignal.ProtocolAddress(signalUser, finalDevice);
|
|
239
251
|
};
|
|
240
|
-
|
|
252
|
+
|
|
241
253
|
const jidToSignalSenderKeyName = (group, user) => {
|
|
242
254
|
return new SenderKeyName(group, jidToSignalProtocolAddress(user));
|
|
243
255
|
};
|
|
244
|
-
|
|
256
|
+
|
|
245
257
|
function signalStorage({ creds, keys }, lidMapping) {
|
|
246
258
|
const resolveLIDSignalAddress = async (id) => {
|
|
247
259
|
if (id.includes(".")) {
|
|
@@ -321,4 +333,3 @@ function signalStorage({ creds, keys }, lidMapping) {
|
|
|
321
333
|
}
|
|
322
334
|
};
|
|
323
335
|
}
|
|
324
|
-
//=======================================================//
|