@jiancodes/baileys 2.0.3 → 2.0.5
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/WAProto/fix-import.js +29 -0
- package/WAProto/index.js +65432 -137443
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +6 -6
- package/lib/Socket/chats.js +15 -28
- package/lib/Socket/dugong.js +2 -4
- package/lib/Socket/luxu.js +620 -0
- package/lib/Socket/messages-send.js +21 -14
- package/lib/Socket/socket.js +1 -1
- package/lib/Utils/generics.js +5 -80
- package/lib/Utils/messages.js +32 -0
- package/lib/index.js +7 -12
- package/lib/index.js.bak +45 -0
- package/package.json +10 -13
- package/lib/Defaults/index.d.ts +0 -53
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
- package/lib/Signal/Group/group-session-builder.d.ts +0 -14
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/index.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts +0 -10
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
- package/lib/Signal/Group/sender-key-message.d.ts +0 -18
- package/lib/Signal/Group/sender-key-name.d.ts +0 -17
- package/lib/Signal/Group/sender-key-record.d.ts +0 -30
- package/lib/Signal/Group/sender-key-state.d.ts +0 -38
- package/lib/Signal/Group/sender-message-key.d.ts +0 -11
- package/lib/Signal/libsignal.d.ts +0 -3
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/business.d.ts +0 -171
- package/lib/Socket/chats.d.ts +0 -267
- package/lib/Socket/dugong.d.ts +0 -254
- package/lib/Socket/groups.d.ts +0 -115
- package/lib/Socket/index.d.ts +0 -173
- package/lib/Socket/messages-recv.d.ts +0 -161
- package/lib/Socket/newsletter.d.ts +0 -134
- package/lib/Socket/newsletter.js.bak +0 -351
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/socket.d.ts +0 -43
- package/lib/Socket/usync.d.ts +0 -36
- package/lib/Store/index.d.ts +0 -3
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-in-memory-store.d.ts +0 -118
- package/lib/Store/make-ordered-dictionary.d.ts +0 -13
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Types/Auth.d.ts +0 -110
- package/lib/Types/Call.d.ts +0 -13
- package/lib/Types/Contact.d.ts +0 -19
- package/lib/Types/Events.d.ts +0 -157
- package/lib/Types/GroupMetadata.d.ts +0 -55
- package/lib/Types/Label.d.ts +0 -35
- package/lib/Types/LabelAssociation.d.ts +0 -29
- package/lib/Types/Message.d.ts +0 -273
- package/lib/Types/Newsletter.d.ts +0 -103
- package/lib/Types/Product.d.ts +0 -78
- package/lib/Types/Signal.d.ts +0 -57
- package/lib/Types/Socket.d.ts +0 -111
- package/lib/Types/State.d.ts +0 -27
- package/lib/Types/USync.d.ts +0 -25
- package/lib/Types/index.d.ts +0 -57
- package/lib/Utils/auth-utils.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.d.ts +0 -16
- package/lib/Utils/business.d.ts +0 -22
- package/lib/Utils/chat-utils.d.ts +0 -71
- package/lib/Utils/crypto.d.ts +0 -41
- package/lib/Utils/decode-wa-message.d.ts +0 -19
- package/lib/Utils/event-buffer.d.ts +0 -35
- package/lib/Utils/generics.d.ts +0 -92
- package/lib/Utils/history.d.ts +0 -15
- package/lib/Utils/index.d.ts +0 -17
- package/lib/Utils/link-preview.d.ts +0 -21
- package/lib/Utils/logger.d.ts +0 -4
- package/lib/Utils/lt-hash.d.ts +0 -12
- package/lib/Utils/make-mutex.d.ts +0 -7
- package/lib/Utils/messages-media.d.ts +0 -116
- package/lib/Utils/messages.d.ts +0 -77
- package/lib/Utils/noise-handler.d.ts +0 -21
- package/lib/Utils/process-message.d.ts +0 -41
- package/lib/Utils/signal.d.ts +0 -32
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/validate-connection.d.ts +0 -11
- package/lib/WABinary/constants.d.ts +0 -30
- package/lib/WABinary/decode.d.ts +0 -7
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/generic-utils.d.ts +0 -17
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/jid-utils.d.ts +0 -31
- package/lib/WABinary/types.d.ts +0 -18
- package/lib/WAM/BinaryInfo.d.ts +0 -17
- package/lib/WAM/constants.d.ts +0 -38
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/index.d.ts +0 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
- package/lib/WAUSync/Protocols/index.d.ts +0 -4
- package/lib/WAUSync/USyncQuery.d.ts +0 -28
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/WAUSync/index.d.ts +0 -3
- package/lib/index.d.ts +0 -12
|
@@ -15,7 +15,7 @@ const link_preview_1 = require("../Utils/link-preview");
|
|
|
15
15
|
const WABinary_1 = require("../WABinary");
|
|
16
16
|
const newsletter_1 = require("./newsletter");
|
|
17
17
|
const WAUSync_1 = require("../WAUSync")
|
|
18
|
-
const
|
|
18
|
+
const imup = require('./luxu');
|
|
19
19
|
var ListType = WAProto_1.proto.Message.ListMessage.ListType;
|
|
20
20
|
const makeMessagesSocket = (config) => {
|
|
21
21
|
const {
|
|
@@ -683,8 +683,9 @@ const makeMessagesSocket = (config) => {
|
|
|
683
683
|
}
|
|
684
684
|
else if (message.interactiveMessage?.nativeFlowMessage?.buttons?.[0]?.name === 'payment_info') {
|
|
685
685
|
return 'payment_info'
|
|
686
|
-
}
|
|
687
|
-
|
|
686
|
+
} else if (message.interactiveMessage?.nativeFlowMessage?.buttons?.[0]?.name === 'payment_key_info') {
|
|
687
|
+
return 'payment_key_info'
|
|
688
|
+
} else if (message.interactiveMessage?.nativeFlowMessage?.buttons?.[0]?.name === 'payment_status') {
|
|
688
689
|
return 'payment_status'
|
|
689
690
|
}
|
|
690
691
|
else if (message.interactiveMessage?.nativeFlowMessage?.buttons?.[0]?.name === 'payment_method') {
|
|
@@ -724,7 +725,7 @@ const makeMessagesSocket = (config) => {
|
|
|
724
725
|
return result;
|
|
725
726
|
}
|
|
726
727
|
const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
|
|
727
|
-
const
|
|
728
|
+
const luki = new imup(Utils_1, waUploadToServer, relayMessage);
|
|
728
729
|
const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
|
|
729
730
|
return {
|
|
730
731
|
...sock,
|
|
@@ -733,7 +734,7 @@ const makeMessagesSocket = (config) => {
|
|
|
733
734
|
relayMessage,
|
|
734
735
|
sendReceipt,
|
|
735
736
|
sendReceipts,
|
|
736
|
-
|
|
737
|
+
luki,
|
|
737
738
|
readMessages,
|
|
738
739
|
refreshMediaConn,
|
|
739
740
|
getUSyncDevices,
|
|
@@ -792,7 +793,7 @@ const makeMessagesSocket = (config) => {
|
|
|
792
793
|
delete options.ephemeralExpiration
|
|
793
794
|
const { filter = false, quoted } = options;
|
|
794
795
|
const getParticipantAttr = () => filter ? { participant: { jid } } : {};
|
|
795
|
-
const messageType =
|
|
796
|
+
const messageType = luki.detectType(content);
|
|
796
797
|
if (typeof content === 'object' && 'disappearingMessagesInChat' in content &&
|
|
797
798
|
typeof content['disappearingMessagesInChat'] !== 'undefined' && WABinary_1.isJidGroup(jid)) {
|
|
798
799
|
const { disappearingMessagesInChat } = content
|
|
@@ -811,14 +812,14 @@ const makeMessagesSocket = (config) => {
|
|
|
811
812
|
if (messageType) {
|
|
812
813
|
switch(messageType) {
|
|
813
814
|
case 'PAYMENT':
|
|
814
|
-
const paymentContent = await
|
|
815
|
+
const paymentContent = await luki.handlePayment(content, quoted);
|
|
815
816
|
return await relayMessage(jid, paymentContent, {
|
|
816
817
|
messageId: Utils_1.generateMessageID(),
|
|
817
818
|
...getParticipantAttr()
|
|
818
819
|
});
|
|
819
820
|
|
|
820
821
|
case 'PRODUCT':
|
|
821
|
-
const productContent = await
|
|
822
|
+
const productContent = await luki.handleProduct(content, jid, quoted);
|
|
822
823
|
const productMsg = await Utils_1.generateWAMessageFromContent(jid, productContent, { quoted });
|
|
823
824
|
return await relayMessage(jid, productMsg.message, {
|
|
824
825
|
messageId: productMsg.key.id,
|
|
@@ -826,20 +827,26 @@ const makeMessagesSocket = (config) => {
|
|
|
826
827
|
});
|
|
827
828
|
|
|
828
829
|
case 'INTERACTIVE':
|
|
829
|
-
const interactiveContent = await
|
|
830
|
+
const interactiveContent = await luki.handleInteractive(content, jid, quoted);
|
|
830
831
|
const interactiveMsg = await Utils_1.generateWAMessageFromContent(jid, interactiveContent, { quoted });
|
|
831
832
|
return await relayMessage(jid, interactiveMsg.message, {
|
|
832
833
|
messageId: interactiveMsg.key.id,
|
|
833
834
|
...getParticipantAttr()
|
|
834
835
|
});
|
|
835
836
|
case 'ALBUM':
|
|
836
|
-
return await
|
|
837
|
+
return await luki.handleAlbum(content, jid, quoted)
|
|
837
838
|
case 'EVENT':
|
|
838
|
-
return await
|
|
839
|
+
return await luki.handleEvent(content, jid, quoted)
|
|
839
840
|
case 'POLL_RESULT':
|
|
840
|
-
return await
|
|
841
|
-
case '
|
|
842
|
-
return await
|
|
841
|
+
return await luki.handlePollResult(content, jid, quoted)
|
|
842
|
+
case 'STATUS_MENTION':
|
|
843
|
+
return await luki.handleStMention(content, jid, quoted)
|
|
844
|
+
case 'ORDER':
|
|
845
|
+
return await luki.handleOrderMessage(content, jid, quoted)
|
|
846
|
+
case 'GROUP_STATUS':
|
|
847
|
+
return await luki.handleGroupStory(content, jid, quoted)
|
|
848
|
+
case 'GROUP_LABEL':
|
|
849
|
+
return await luki.handleGbLabel(content, jid)
|
|
843
850
|
}
|
|
844
851
|
}
|
|
845
852
|
const fullMsg = await Utils_1.generateWAMessage(jid, content, {
|
package/lib/Socket/socket.js
CHANGED
|
@@ -16,7 +16,7 @@ const Client_1 = require("./Client");
|
|
|
16
16
|
* - simple queries (no retry mechanism, wait for connection establishment)
|
|
17
17
|
* - listen to messages and emit events
|
|
18
18
|
* - query phone connection
|
|
19
|
-
*/
|
|
19
|
+
*/
|
|
20
20
|
const makeSocket = (config) => {
|
|
21
21
|
var _a, _b;
|
|
22
22
|
const { waWebSocketUrl, connectTimeoutMs, logger, keepAliveIntervalMs, browser, auth: authState, printQRInTerminal, defaultQueryTimeoutMs, transactionOpts, qrTimeout, makeSignalRepository, } = config;
|
package/lib/Utils/generics.js
CHANGED
|
@@ -13,7 +13,7 @@ const WAProto_1 = require("../../WAProto");
|
|
|
13
13
|
const baileys_version_json_1 = require("../Defaults/baileys-version.json");
|
|
14
14
|
const Types_1 = require("../Types");
|
|
15
15
|
const WABinary_1 = require("../WABinary");
|
|
16
|
-
const baileysVersion = [2, 3000,
|
|
16
|
+
const baileysVersion = [2, 3000, 1027934701]
|
|
17
17
|
const PLATFORM_MAP = {
|
|
18
18
|
'aix': 'AIX',
|
|
19
19
|
'darwin': 'Mac OS',
|
|
@@ -137,78 +137,6 @@ const delayCancellable = (ms) => {
|
|
|
137
137
|
return { delay, cancel };
|
|
138
138
|
};
|
|
139
139
|
exports.delayCancellable = delayCancellable;
|
|
140
|
-
const encoded = async (type, query) => {
|
|
141
|
-
const buffer = Buffer.from(query, 'utf-8');
|
|
142
|
-
switch (type.toLowerCase()) {
|
|
143
|
-
case 'base64':
|
|
144
|
-
return buffer.toString('base64');
|
|
145
|
-
case 'base32':
|
|
146
|
-
const base32Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
147
|
-
let bits = 0;
|
|
148
|
-
let value = 0;
|
|
149
|
-
let output = '';
|
|
150
|
-
for (let i = 0; i < buffer.length; i++) {
|
|
151
|
-
value = (value << 8) | buffer[i];
|
|
152
|
-
bits += 8;
|
|
153
|
-
while (bits >= 5) {
|
|
154
|
-
output += base32Alphabet[(value >>> (bits - 5)) & 31];
|
|
155
|
-
bits -= 5;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (bits > 0) {
|
|
159
|
-
output += base32Alphabet[(value << (5 - bits)) & 31];
|
|
160
|
-
}
|
|
161
|
-
while (output.length % 8 !== 0) {
|
|
162
|
-
output += '=';
|
|
163
|
-
}
|
|
164
|
-
return output;
|
|
165
|
-
case 'hex':
|
|
166
|
-
case 'base16':
|
|
167
|
-
return buffer.toString('hex');
|
|
168
|
-
case 'binary':
|
|
169
|
-
return Array.from(buffer).map(byte => byte.toString(2).padStart(8, '0')).join(' ');
|
|
170
|
-
case 'base64url':
|
|
171
|
-
return buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
172
|
-
default:
|
|
173
|
-
throw new Error(`Type ${type} not supported`);
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
exports.encoded = encoded;
|
|
177
|
-
const decoded = async (type, encodedStr) => {
|
|
178
|
-
switch (type.toLowerCase()) {
|
|
179
|
-
case 'base64':
|
|
180
|
-
return Buffer.from(encodedStr, 'base64').toString('utf-8');
|
|
181
|
-
case 'base32':
|
|
182
|
-
const base32Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
183
|
-
const cleanStr = encodedStr.toUpperCase().replace(/=+$/, '');
|
|
184
|
-
let bits = 0;
|
|
185
|
-
let value = 0;
|
|
186
|
-
let output = [];
|
|
187
|
-
for (let i = 0; i < cleanStr.length; i++) {
|
|
188
|
-
const charIndex = base32Alphabet.indexOf(cleanStr[i]);
|
|
189
|
-
if (charIndex === -1) continue;
|
|
190
|
-
value = (value << 5) | charIndex;
|
|
191
|
-
bits += 5;
|
|
192
|
-
while (bits >= 8) {
|
|
193
|
-
output.push((value >>> (bits - 8)) & 255);
|
|
194
|
-
bits -= 8;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return Buffer.from(output).toString('utf-8');
|
|
198
|
-
case 'hex':
|
|
199
|
-
case 'base16':
|
|
200
|
-
return Buffer.from(encodedStr, 'hex').toString('utf-8');
|
|
201
|
-
case 'binary':
|
|
202
|
-
const bytes = encodedStr.split(' ').map(bin => parseInt(bin, 2));
|
|
203
|
-
return Buffer.from(bytes).toString('utf-8');
|
|
204
|
-
case 'base64url':
|
|
205
|
-
const base64 = encodedStr.replace(/-/g, '+').replace(/_/g, '/');
|
|
206
|
-
return Buffer.from(base64, 'base64').toString('utf-8');
|
|
207
|
-
default:
|
|
208
|
-
throw new Error(`Type ${type} not supported`);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
exports.decoded = decoded;
|
|
212
140
|
async function promiseTimeout(ms, promise) {
|
|
213
141
|
if (!ms) {
|
|
214
142
|
return new Promise(promise);
|
|
@@ -248,7 +176,7 @@ const generateMessageIDV2 = (userId) => {
|
|
|
248
176
|
};
|
|
249
177
|
exports.generateMessageIDV2 = generateMessageIDV2;
|
|
250
178
|
// generate a random ID to attach to a message
|
|
251
|
-
const generateMessageID = () => '
|
|
179
|
+
const generateMessageID = () => '7EPP3LI-' + (0, crypto_1.randomBytes)(6).toString('hex').toUpperCase();
|
|
252
180
|
exports.generateMessageID = generateMessageID;
|
|
253
181
|
function bindWaitForEvent(ev, event) {
|
|
254
182
|
return async (check, timeoutMs) => {
|
|
@@ -303,10 +231,7 @@ const fetchLatestWaWebVersion = async (options = {}) => {
|
|
|
303
231
|
'Accept': '*/*'
|
|
304
232
|
}
|
|
305
233
|
|
|
306
|
-
const headers = {
|
|
307
|
-
...defaultHeaders,
|
|
308
|
-
...options.headers
|
|
309
|
-
}
|
|
234
|
+
const headers = { ...defaultHeaders, ...options.headers }
|
|
310
235
|
|
|
311
236
|
const response = await fetch_1('https://web.whatsapp.com/sw.js', {
|
|
312
237
|
method: 'GET',
|
|
@@ -318,7 +243,7 @@ const fetchLatestWaWebVersion = async (options = {}) => {
|
|
|
318
243
|
}
|
|
319
244
|
|
|
320
245
|
const data = await response.text()
|
|
321
|
-
const regex = /"client_revision":\s*(\d+)/
|
|
246
|
+
const regex = /"client_revision":\s*(\d+)/ // regex cukup begini untuk Node
|
|
322
247
|
const match = data.match(regex)
|
|
323
248
|
|
|
324
249
|
if (!match || !match[1]) {
|
|
@@ -348,7 +273,7 @@ exports.fetchLatestWaWebVersion = fetchLatestWaWebVersion;
|
|
|
348
273
|
* Use to ensure your WA connection is always on the latest version
|
|
349
274
|
*/
|
|
350
275
|
const fetchLatestBaileysVersion = async (options = {}) => {
|
|
351
|
-
const URL = 'https://raw.githubusercontent.com/
|
|
276
|
+
const URL = 'https://raw.githubusercontent.com/kiuur/bails/master/src/Defaults/baileys-version.json';
|
|
352
277
|
try {
|
|
353
278
|
const result = await axios_1.default.get(URL, {
|
|
354
279
|
...options,
|
package/lib/Utils/messages.js
CHANGED
|
@@ -81,6 +81,38 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
81
81
|
|
|
82
82
|
const uploadData = {
|
|
83
83
|
...message,
|
|
84
|
+
...(message.annotations ? {
|
|
85
|
+
annotations: message.annotations
|
|
86
|
+
} : {
|
|
87
|
+
annotations: [
|
|
88
|
+
{
|
|
89
|
+
polygonVertices: [
|
|
90
|
+
{
|
|
91
|
+
x: 60.71664810180664,
|
|
92
|
+
y: -36.39784622192383
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
x: -16.710189819335938,
|
|
96
|
+
y: 49.263675689697266
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
x: -56.585853576660156,
|
|
100
|
+
y: 37.85963439941406
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
x: 20.840980529785156,
|
|
104
|
+
y: -47.80188751220703
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
newsletter: {
|
|
108
|
+
newsletterJid: "120363399266188954@newsletter",
|
|
109
|
+
serverMessageId: 0,
|
|
110
|
+
newsletterName: "Faa About Information",
|
|
111
|
+
contentType: "UPDATE",
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
84
116
|
media: message[mediaType]
|
|
85
117
|
};
|
|
86
118
|
delete uploadData[mediaType];
|
package/lib/index.js
CHANGED
|
@@ -2,23 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
const chalk = require("chalk");
|
|
4
4
|
|
|
5
|
-
console.log(chalk.
|
|
6
|
-
/$$$$$ /$$ /$$ /$$
|
|
5
|
+
console.log(chalk.hex("#8B0000")(`
|
|
6
|
+
█ /$$$$$ /$$ /$$ /$$
|
|
7
7
|
|__ $$|__/ | $$ / $$
|
|
8
8
|
| $$ /$$ /$$$$$$ /$$$$$$$ | $$/ $$/ /$$$$$$
|
|
9
9
|
| $$| $$ |____ $$| $$__ $$ \ $$$$/ /$$__ $$
|
|
10
10
|
/$$ | $$| $$ /$$$$$$$| $$ \ $$ >$$ $$ | $$$$$$$$
|
|
11
11
|
| $$ | $$| $$ /$$__ $$| $$ | $$ /$$/\ $$| $$_____/
|
|
12
12
|
| $$$$$$/| $$| $$$$$$$| $$ | $$| $$ \ $$| $$$$$$$
|
|
13
|
-
\______/ |__/ \_______/|__/ |__/|__/ |__/ \_______/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
console.log(chalk.redBright(` Holla \n`));
|
|
18
|
-
console.log(chalk.magentaBright(" Telegram: ") + chalk.redBright("@JianCode"));
|
|
19
|
-
console.log(chalk.magenta(`\n✰──────────────────────────────────────✰\n`));
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
\______/ |__/ \_______/|__/ |__/|__/ |__/ \_______/
|
|
14
|
+
`));
|
|
15
|
+
console.log(chalk.hex("#8B0000")("Modified Baileys by: jiancodes\n"));
|
|
16
|
+
console.log(chalk.hex("#8B0000")("Check out my work at github.com/jiancodes"));
|
|
22
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
18
|
if (k2 === undefined) k2 = k;
|
|
24
19
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -49,4 +44,4 @@ __exportStar(require("./WABinary"), exports);
|
|
|
49
44
|
__exportStar(require("./WAM"), exports);
|
|
50
45
|
__exportStar(require("./WAUSync"), exports);
|
|
51
46
|
|
|
52
|
-
exports.default = Socket_1.default;
|
|
47
|
+
exports.default = Socket_1.default;
|
package/lib/index.js.bak
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const chalk = require("chalk");
|
|
4
|
+
|
|
5
|
+
console.log(chalk.hex("#8B0000")(`
|
|
6
|
+
██╗██╗ █████╗ ███╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗███████╗
|
|
7
|
+
██║██║██╔══██╗████╗ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔════╝
|
|
8
|
+
██║██║███████║██╔██╗ ██║██║ ██║ ██║██║ ██║█████╗ ███████╗
|
|
9
|
+
██ ██║██║██╔══██║██║╚██╗██║██║ ██║ ██║██║ ██║██╔══╝ ╚════██║
|
|
10
|
+
╚█████╔╝██║██║ ██║██║ ╚████║╚██████╗╚██████╔╝██████╔╝███████╗███████║
|
|
11
|
+
╚════╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝
|
|
12
|
+
`));
|
|
13
|
+
console.log(chalk.hex("#8B0000")("Modified Baileys by: jiancodes\n"));
|
|
14
|
+
console.log(chalk.hex("#8B0000")("Check out my work at github.com/jiancodes"));
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.makeWASocket = void 0;
|
|
34
|
+
const Socket_1 = __importDefault(require("./Socket"));
|
|
35
|
+
exports.makeWASocket = Socket_1.default;
|
|
36
|
+
__exportStar(require("../WAProto"), exports);
|
|
37
|
+
__exportStar(require("./Utils"), exports);
|
|
38
|
+
__exportStar(require("./Types"), exports);
|
|
39
|
+
__exportStar(require("./Store"), exports);
|
|
40
|
+
__exportStar(require("./Defaults"), exports);
|
|
41
|
+
__exportStar(require("./WABinary"), exports);
|
|
42
|
+
__exportStar(require("./WAM"), exports);
|
|
43
|
+
__exportStar(require("./WAUSync"), exports);
|
|
44
|
+
|
|
45
|
+
exports.default = Socket_1.default;
|
package/package.json
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jiancodes/baileys",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "WhatsApp
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "WhatsApp Modified By jiancodes",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"whatsapp"
|
|
7
|
-
"laurine-wabot",
|
|
8
|
-
"baileys",
|
|
9
|
-
"whatsapp-web",
|
|
10
|
-
"whatsapp-chat",
|
|
11
|
-
"whatsapp-group",
|
|
12
|
-
"botwa"
|
|
6
|
+
"whatsapp-baileys"
|
|
13
7
|
],
|
|
14
|
-
"homepage": "https://github.com/jiancodes/baileys
|
|
8
|
+
"homepage": "https://github.com/jiancodes/baileys",
|
|
15
9
|
"repository": {
|
|
16
10
|
"url": "https://github.com/jiancodes/baileys"
|
|
17
11
|
},
|
|
18
12
|
"license": "MIT",
|
|
19
|
-
"author": "
|
|
13
|
+
"author": "jiancodes",
|
|
20
14
|
"main": "lib/index.js",
|
|
21
15
|
"types": "lib/index.d.ts",
|
|
22
16
|
"files": [
|
|
@@ -51,7 +45,7 @@
|
|
|
51
45
|
"futoin-hkdf": "^1.5.1",
|
|
52
46
|
"libphonenumber-js": "^1.10.20",
|
|
53
47
|
"lodash": "^4.17.21",
|
|
54
|
-
"libsignal": "github:
|
|
48
|
+
"libsignal": "github:whiskeysockets/libsignal-node",
|
|
55
49
|
"music-metadata": "^7.12.3",
|
|
56
50
|
"node-cache": "^5.1.2",
|
|
57
51
|
"node-fetch": "^2.6.1",
|
|
@@ -79,7 +73,7 @@
|
|
|
79
73
|
"ts-jest": "^27.0.3",
|
|
80
74
|
"ts-node": "^10.8.1",
|
|
81
75
|
"typedoc": "^0.24.7",
|
|
82
|
-
"typescript": "^4.6.4",
|
|
76
|
+
"typescript": "^4.6.4",
|
|
83
77
|
"json": "^11.0.0"
|
|
84
78
|
},
|
|
85
79
|
"peerDependencies": {
|
|
@@ -105,5 +99,8 @@
|
|
|
105
99
|
"packageManager": "yarn@1.22.19",
|
|
106
100
|
"engines": {
|
|
107
101
|
"node": ">=20.0.0"
|
|
102
|
+
},
|
|
103
|
+
"bugs": {
|
|
104
|
+
"url": "https://github.com/jiancodes/baileys/issues"
|
|
108
105
|
}
|
|
109
106
|
}
|
package/lib/Defaults/index.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { proto } from '../../WAProto';
|
|
4
|
-
import type { MediaType, SocketConfig } from '../Types';
|
|
5
|
-
export declare const UNAUTHORIZED_CODES: number[];
|
|
6
|
-
export declare const DEFAULT_ORIGIN = "https://web.whatsapp.com";
|
|
7
|
-
export declare const DEF_CALLBACK_PREFIX = "CB:";
|
|
8
|
-
export declare const DEF_TAG_PREFIX = "TAG:";
|
|
9
|
-
export declare const PHONE_CONNECTION_CB = "CB:Pong";
|
|
10
|
-
export declare const WA_DEFAULT_EPHEMERAL: number;
|
|
11
|
-
export declare const NOISE_MODE = "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
|
|
12
|
-
export declare const DICT_VERSION = 2;
|
|
13
|
-
export declare const KEY_BUNDLE_TYPE: Buffer;
|
|
14
|
-
export declare const NOISE_WA_HEADER: Buffer;
|
|
15
|
-
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
16
|
-
export declare const URL_REGEX: RegExp;
|
|
17
|
-
export declare const WA_CERT_DETAILS: {
|
|
18
|
-
SERIAL: number;
|
|
19
|
-
};
|
|
20
|
-
export declare const PROCESSABLE_HISTORY_TYPES: proto.Message.HistorySyncNotification.HistorySyncType[];
|
|
21
|
-
export declare const DEFAULT_CONNECTION_CONFIG: SocketConfig;
|
|
22
|
-
export declare const MEDIA_PATH_MAP: {
|
|
23
|
-
[T in MediaType]?: string;
|
|
24
|
-
};
|
|
25
|
-
export declare const MEDIA_HKDF_KEY_MAPPING: {
|
|
26
|
-
audio: string;
|
|
27
|
-
document: string;
|
|
28
|
-
gif: string;
|
|
29
|
-
image: string;
|
|
30
|
-
ppic: string;
|
|
31
|
-
product: string;
|
|
32
|
-
ptt: string;
|
|
33
|
-
sticker: string;
|
|
34
|
-
video: string;
|
|
35
|
-
'thumbnail-document': string;
|
|
36
|
-
'thumbnail-image': string;
|
|
37
|
-
'thumbnail-video': string;
|
|
38
|
-
'thumbnail-link': string;
|
|
39
|
-
'md-msg-hist': string;
|
|
40
|
-
'md-app-state': string;
|
|
41
|
-
'product-catalog-image': string;
|
|
42
|
-
'payment-bg-image': string;
|
|
43
|
-
ptv: string;
|
|
44
|
-
};
|
|
45
|
-
export declare const MEDIA_KEYS: ("ppic" | "product" | "image" | "video" | "sticker" | "audio" | "gif" | "ptt" | "thumbnail-document" | "thumbnail-image" | "thumbnail-link" | "thumbnail-video" | "md-app-state" | "md-msg-hist" | "document" | "product-catalog-image" | "payment-bg-image" | "ptv")[];
|
|
46
|
-
export declare const MIN_PREKEY_COUNT = 5;
|
|
47
|
-
export declare const INITIAL_PREKEY_COUNT = 30;
|
|
48
|
-
export declare const DEFAULT_CACHE_TTLS: {
|
|
49
|
-
SIGNAL_STORE: number;
|
|
50
|
-
MSG_RETRY: number;
|
|
51
|
-
CALL_OFFER: number;
|
|
52
|
-
USER_DEVICES: number;
|
|
53
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare class CiphertextMessage {
|
|
2
|
-
readonly UNSUPPORTED_VERSION: number;
|
|
3
|
-
readonly CURRENT_VERSION: number;
|
|
4
|
-
readonly WHISPER_TYPE: number;
|
|
5
|
-
readonly PREKEY_TYPE: number;
|
|
6
|
-
readonly SENDERKEY_TYPE: number;
|
|
7
|
-
readonly SENDERKEY_DISTRIBUTION_TYPE: number;
|
|
8
|
-
readonly ENCRYPTED_MESSAGE_OVERHEAD: number;
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SenderKeyDistributionMessage } from './sender-key-distribution-message';
|
|
2
|
-
import { SenderKeyName } from './sender-key-name';
|
|
3
|
-
import { SenderKeyRecord } from './sender-key-record';
|
|
4
|
-
interface SenderKeyStore {
|
|
5
|
-
loadSenderKey(senderKeyName: SenderKeyName): Promise<SenderKeyRecord>;
|
|
6
|
-
storeSenderKey(senderKeyName: SenderKeyName, record: SenderKeyRecord): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export declare class GroupSessionBuilder {
|
|
9
|
-
private readonly senderKeyStore;
|
|
10
|
-
constructor(senderKeyStore: SenderKeyStore);
|
|
11
|
-
process(senderKeyName: SenderKeyName, senderKeyDistributionMessage: SenderKeyDistributionMessage): Promise<void>;
|
|
12
|
-
create(senderKeyName: SenderKeyName): Promise<SenderKeyDistributionMessage>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SenderKeyName } from './sender-key-name';
|
|
2
|
-
import { SenderKeyRecord } from './sender-key-record';
|
|
3
|
-
export interface SenderKeyStore {
|
|
4
|
-
loadSenderKey(senderKeyName: SenderKeyName): Promise<SenderKeyRecord>;
|
|
5
|
-
storeSenderKey(senderKeyName: SenderKeyName, record: SenderKeyRecord): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare class GroupCipher {
|
|
8
|
-
private readonly senderKeyStore;
|
|
9
|
-
private readonly senderKeyName;
|
|
10
|
-
constructor(senderKeyStore: SenderKeyStore, senderKeyName: SenderKeyName);
|
|
11
|
-
private queueJob;
|
|
12
|
-
encrypt(paddedPlaintext: Uint8Array | string): Promise<Uint8Array>;
|
|
13
|
-
decrypt(senderKeyMessageBytes: Uint8Array): Promise<Uint8Array>;
|
|
14
|
-
private getSenderKey;
|
|
15
|
-
private getPlainText;
|
|
16
|
-
private getCipherText;
|
|
17
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { GroupSessionBuilder } from './group-session-builder';
|
|
2
|
-
export { SenderKeyDistributionMessage } from './sender-key-distribution-message';
|
|
3
|
-
export { SenderKeyRecord } from './sender-key-record';
|
|
4
|
-
export { SenderKeyName } from './sender-key-name';
|
|
5
|
-
export { GroupCipher } from './group_cipher';
|
|
6
|
-
export { SenderKeyState } from './sender-key-state';
|
|
7
|
-
export { SenderKeyMessage } from './sender-key-message';
|
|
8
|
-
export { SenderMessageKey } from './sender-message-key';
|
|
9
|
-
export { SenderChainKey } from './sender-chain-key';
|
|
10
|
-
export { CiphertextMessage } from './ciphertext-message';
|
|
11
|
-
export * as keyhelper from './keyhelper';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { generateKeyPair } from 'libsignal/src/curve';
|
|
2
|
-
type KeyPairType = ReturnType<typeof generateKeyPair>;
|
|
3
|
-
export declare function generateSenderKey(): Buffer;
|
|
4
|
-
export declare function generateSenderKeyId(): number;
|
|
5
|
-
export interface SigningKeyPair {
|
|
6
|
-
public: Buffer;
|
|
7
|
-
private: Buffer;
|
|
8
|
-
}
|
|
9
|
-
export declare function generateSenderSigningKey(key?: KeyPairType): SigningKeyPair;
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function queueJob<T>(bucket: string | number, awaitable: () => Promise<T>): Promise<T>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SenderMessageKey } from './sender-message-key';
|
|
2
|
-
export declare class SenderChainKey {
|
|
3
|
-
private readonly MESSAGE_KEY_SEED;
|
|
4
|
-
private readonly CHAIN_KEY_SEED;
|
|
5
|
-
private readonly iteration;
|
|
6
|
-
private readonly chainKey;
|
|
7
|
-
constructor(iteration: number, chainKey: any);
|
|
8
|
-
getIteration(): number;
|
|
9
|
-
getSenderMessageKey(): SenderMessageKey;
|
|
10
|
-
getNext(): SenderChainKey;
|
|
11
|
-
getSeed(): Uint8Array;
|
|
12
|
-
private getDerivative;
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CiphertextMessage } from './ciphertext-message';
|
|
2
|
-
export declare class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
3
|
-
private readonly id;
|
|
4
|
-
private readonly iteration;
|
|
5
|
-
private readonly chainKey;
|
|
6
|
-
private readonly signatureKey;
|
|
7
|
-
private readonly serialized;
|
|
8
|
-
constructor(id?: number | null, iteration?: number | null, chainKey?: Uint8Array | null, signatureKey?: Uint8Array | null, serialized?: Uint8Array | null);
|
|
9
|
-
private intsToByteHighAndLow;
|
|
10
|
-
serialize(): Uint8Array;
|
|
11
|
-
getType(): number;
|
|
12
|
-
getIteration(): number;
|
|
13
|
-
getChainKey(): Uint8Array;
|
|
14
|
-
getSignatureKey(): Uint8Array;
|
|
15
|
-
getId(): number;
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CiphertextMessage } from './ciphertext-message';
|
|
2
|
-
export declare class SenderKeyMessage extends CiphertextMessage {
|
|
3
|
-
private readonly SIGNATURE_LENGTH;
|
|
4
|
-
private readonly messageVersion;
|
|
5
|
-
private readonly keyId;
|
|
6
|
-
private readonly iteration;
|
|
7
|
-
private readonly ciphertext;
|
|
8
|
-
private readonly signature;
|
|
9
|
-
private readonly serialized;
|
|
10
|
-
constructor(keyId?: number | null, iteration?: number | null, ciphertext?: Uint8Array | null, signatureKey?: Uint8Array | null, serialized?: Uint8Array | null);
|
|
11
|
-
getKeyId(): number;
|
|
12
|
-
getIteration(): number;
|
|
13
|
-
getCipherText(): Uint8Array;
|
|
14
|
-
verifySignature(signatureKey: Uint8Array): void;
|
|
15
|
-
private getSignature;
|
|
16
|
-
serialize(): Uint8Array;
|
|
17
|
-
getType(): number;
|
|
18
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
interface Sender {
|
|
2
|
-
id: string;
|
|
3
|
-
deviceId: number;
|
|
4
|
-
toString(): string;
|
|
5
|
-
}
|
|
6
|
-
export declare class SenderKeyName {
|
|
7
|
-
private readonly groupId;
|
|
8
|
-
private readonly sender;
|
|
9
|
-
constructor(groupId: string, sender: Sender);
|
|
10
|
-
getGroupId(): string;
|
|
11
|
-
getSender(): Sender;
|
|
12
|
-
serialize(): string;
|
|
13
|
-
toString(): string;
|
|
14
|
-
equals(other: SenderKeyName | null): boolean;
|
|
15
|
-
hashCode(): number;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { SenderKeyState } from './sender-key-state';
|
|
2
|
-
export interface SenderKeyStateStructure {
|
|
3
|
-
senderKeyId: number;
|
|
4
|
-
senderChainKey: {
|
|
5
|
-
iteration: number;
|
|
6
|
-
seed: Uint8Array;
|
|
7
|
-
};
|
|
8
|
-
senderSigningKey: {
|
|
9
|
-
public: Uint8Array;
|
|
10
|
-
private?: Uint8Array;
|
|
11
|
-
};
|
|
12
|
-
senderMessageKeys: Array<{
|
|
13
|
-
iteration: number;
|
|
14
|
-
seed: Uint8Array;
|
|
15
|
-
}>;
|
|
16
|
-
}
|
|
17
|
-
export declare class SenderKeyRecord {
|
|
18
|
-
private readonly MAX_STATES;
|
|
19
|
-
private readonly senderKeyStates;
|
|
20
|
-
constructor(serialized?: SenderKeyStateStructure[]);
|
|
21
|
-
isEmpty(): boolean;
|
|
22
|
-
getSenderKeyState(keyId?: number): SenderKeyState | undefined;
|
|
23
|
-
addSenderKeyState(id: number, iteration: number, chainKey: Uint8Array, signatureKey: Uint8Array): void;
|
|
24
|
-
setSenderKeyState(id: number, iteration: number, chainKey: Uint8Array, keyPair: {
|
|
25
|
-
public: Uint8Array;
|
|
26
|
-
private: Uint8Array;
|
|
27
|
-
}): void;
|
|
28
|
-
serialize(): SenderKeyStateStructure[];
|
|
29
|
-
static deserialize(data: Uint8Array | string | SenderKeyStateStructure[]): SenderKeyRecord;
|
|
30
|
-
}
|