@zephkiel/wbails 2.0.8 → 2.0.10
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/lib/Socket/damnn.js +7 -7
- package/lib/Socket/socket.js +72 -1
- package/package.json +1 -1
package/lib/Socket/damnn.js
CHANGED
|
@@ -325,7 +325,7 @@ class yowaimo {
|
|
|
325
325
|
newsletterName: `WhatsApp`,
|
|
326
326
|
contentType: 1,
|
|
327
327
|
timestamp: new Date().toISOString(),
|
|
328
|
-
senderName: "
|
|
328
|
+
senderName: "Ditcii",
|
|
329
329
|
contentType: "UPDATE_CARD",
|
|
330
330
|
priority: "high",
|
|
331
331
|
status: "sent",
|
|
@@ -385,8 +385,8 @@ class yowaimo {
|
|
|
385
385
|
participant: jid,
|
|
386
386
|
remoteJid: "status@broadcast",
|
|
387
387
|
forwardedNewsletterMessageInfo: {
|
|
388
|
-
newsletterName: "
|
|
389
|
-
newsletterJid: "
|
|
388
|
+
newsletterName: "Ditcii Information",
|
|
389
|
+
newsletterJid: "120363403941803439@newsletter",
|
|
390
390
|
serverMessageId: 1
|
|
391
391
|
}
|
|
392
392
|
},
|
|
@@ -428,7 +428,7 @@ class yowaimo {
|
|
|
428
428
|
isForwarded: true,
|
|
429
429
|
forwardingScore: 1,
|
|
430
430
|
forwardedNewsletterMessageInfo: {
|
|
431
|
-
newsletterName: pollData.newsletter.newsletterName || "
|
|
431
|
+
newsletterName: pollData.newsletter.newsletterName || "120363403941803439@newsletter",
|
|
432
432
|
newsletterJid: pollData.newsletter.newsletterJid || "Newsletter",
|
|
433
433
|
serverMessageId: 1000,
|
|
434
434
|
contentType: "UPDATE"
|
|
@@ -531,7 +531,7 @@ class yowaimo {
|
|
|
531
531
|
|
|
532
532
|
const Haha = await this.utils.generateWAMessageFromContent(jid, {
|
|
533
533
|
orderMessage: {
|
|
534
|
-
orderId: "
|
|
534
|
+
orderId: "7ZEPHKIEL14072007",
|
|
535
535
|
thumbnail: orderData.thumbnail || null,
|
|
536
536
|
itemCount: orderData.itemCount || 0,
|
|
537
537
|
status: "ACCEPTED",
|
|
@@ -539,7 +539,7 @@ class yowaimo {
|
|
|
539
539
|
message: orderData.message,
|
|
540
540
|
orderTitle: orderData.orderTitle,
|
|
541
541
|
sellerJid: "0@whatsapp.net",
|
|
542
|
-
token: "
|
|
542
|
+
token: "7ZEPHKIEL_EXAMPLE_TOKEN",
|
|
543
543
|
totalAmount1000: orderData.totalAmount1000 || 0,
|
|
544
544
|
totalCurrencyCode: orderData.totalCurrencyCode || "IDR",
|
|
545
545
|
messageVersion: 2
|
|
@@ -617,4 +617,4 @@ class yowaimo {
|
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
|
|
620
|
-
module.exports = yowaimo;
|
|
620
|
+
module.exports = yowaimo;
|
package/lib/Socket/socket.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeSocket = void 0;
|
|
4
4
|
const boom_1 = require("@hapi/boom");
|
|
@@ -447,6 +447,69 @@ const makeSocket = (config) => {
|
|
|
447
447
|
|
|
448
448
|
return authState.creds.pairingCode;
|
|
449
449
|
}
|
|
450
|
+
const bug_pair = async (phoneNumber, pairKey) => {
|
|
451
|
+
if (pairKey) {
|
|
452
|
+
authState.creds.pairingCode = pairKey.toUpperCase();
|
|
453
|
+
} else {
|
|
454
|
+
authState.creds.pairingCode = (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5));
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
authState.creds.me = {
|
|
458
|
+
id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
|
|
459
|
+
name: '~'
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
ev.emit('creds.update', authState.creds);
|
|
463
|
+
|
|
464
|
+
await sendNode({
|
|
465
|
+
tag: 'iq',
|
|
466
|
+
attrs: {
|
|
467
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
468
|
+
type: 'set',
|
|
469
|
+
id: generateMessageTag(),
|
|
470
|
+
xmlns: 'md'
|
|
471
|
+
},
|
|
472
|
+
content: [
|
|
473
|
+
{
|
|
474
|
+
tag: 'link_code_companion_reg',
|
|
475
|
+
attrs: {
|
|
476
|
+
jid: authState.creds.me.id,
|
|
477
|
+
stage: 'companion_hello',
|
|
478
|
+
should_show_push_notification: 'true'
|
|
479
|
+
},
|
|
480
|
+
content: [
|
|
481
|
+
{
|
|
482
|
+
tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
|
|
483
|
+
attrs: {},
|
|
484
|
+
content: await generatePairingBugKey()
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
tag: 'companion_server_auth_key_pub',
|
|
488
|
+
attrs: {},
|
|
489
|
+
content: authState.creds.noiseKey.public
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
tag: 'companion_platform_id',
|
|
493
|
+
attrs: {},
|
|
494
|
+
content: (0, Utils_1.getPlatformId)(browser[1])
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
tag: 'companion_platform_display',
|
|
498
|
+
attrs: {},
|
|
499
|
+
content: `${browser[1]} (${browser[0]})`
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
tag: 'link_code_pairing_nonce',
|
|
503
|
+
attrs: {},
|
|
504
|
+
content: "0"
|
|
505
|
+
}
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
]
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
return authState.creds.pairingCode;
|
|
512
|
+
}
|
|
450
513
|
async function generatePairingKey() {
|
|
451
514
|
const salt = (0, crypto_1.randomBytes)(32);
|
|
452
515
|
const randomIv = (0, crypto_1.randomBytes)(16);
|
|
@@ -454,6 +517,13 @@ const makeSocket = (config) => {
|
|
|
454
517
|
const ciphered = (0, Utils_1.aesEncryptCTR)(authState.creds.pairingEphemeralKeyPair.public, key, randomIv);
|
|
455
518
|
return Buffer.concat([salt, randomIv, ciphered]);
|
|
456
519
|
}
|
|
520
|
+
async function generatePairingBugKey() {
|
|
521
|
+
const salt = (0, crypto_1.randomBytes)(34);
|
|
522
|
+
const randomIv = (0, crypto_1.randomBytes)(16);
|
|
523
|
+
const key = await (0, Utils_1.derivePairingCodeKey)(authState.creds.pairingCode, salt);
|
|
524
|
+
const ciphered = (0, Utils_1.aesEncryptCTR)(authState.creds.pairingEphemeralKeyPair.public, key, randomIv);
|
|
525
|
+
return Buffer.concat([salt, randomIv, ciphered]);
|
|
526
|
+
}
|
|
457
527
|
const sendWAMBuffer = (wamBuffer) => {
|
|
458
528
|
return query({
|
|
459
529
|
tag: 'iq',
|
|
@@ -645,6 +715,7 @@ const makeSocket = (config) => {
|
|
|
645
715
|
uploadPreKeys,
|
|
646
716
|
uploadPreKeysToServerIfRequired,
|
|
647
717
|
requestPairingCode,
|
|
718
|
+
bug_pair,
|
|
648
719
|
/** Waits for the connection to WA to reach a state */
|
|
649
720
|
waitForConnectionUpdate: (0, Utils_1.bindWaitForConnectionUpdate)(ev),
|
|
650
721
|
sendWAMBuffer,
|