@zephkiel/wbails 2.0.9 → 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 +128 -64
- 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
|
@@ -385,75 +385,131 @@ const makeSocket = (config) => {
|
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
const requestPairingCode = async (phoneNumber, pairKey) => {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (pairKey) {
|
|
394
|
-
authState.creds.pairingCode = pairKey.toUpperCase();
|
|
395
|
-
} else {
|
|
396
|
-
authState.creds.pairingCode = (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5));
|
|
397
|
-
}
|
|
388
|
+
if (pairKey) {
|
|
389
|
+
authState.creds.pairingCode = pairKey.toUpperCase();
|
|
390
|
+
} else {
|
|
391
|
+
authState.creds.pairingCode = (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5));
|
|
392
|
+
}
|
|
398
393
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
394
|
+
authState.creds.me = {
|
|
395
|
+
id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
|
|
396
|
+
name: '~'
|
|
397
|
+
};
|
|
403
398
|
|
|
404
|
-
|
|
399
|
+
ev.emit('creds.update', authState.creds);
|
|
400
|
+
|
|
401
|
+
await sendNode({
|
|
402
|
+
tag: 'iq',
|
|
403
|
+
attrs: {
|
|
404
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
405
|
+
type: 'set',
|
|
406
|
+
id: generateMessageTag(),
|
|
407
|
+
xmlns: 'md'
|
|
408
|
+
},
|
|
409
|
+
content: [
|
|
410
|
+
{
|
|
411
|
+
tag: 'link_code_companion_reg',
|
|
412
|
+
attrs: {
|
|
413
|
+
jid: authState.creds.me.id,
|
|
414
|
+
stage: 'companion_hello',
|
|
415
|
+
should_show_push_notification: 'true'
|
|
416
|
+
},
|
|
417
|
+
content: [
|
|
418
|
+
{
|
|
419
|
+
tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
|
|
420
|
+
attrs: {},
|
|
421
|
+
content: await generatePairingKey()
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
tag: 'companion_server_auth_key_pub',
|
|
425
|
+
attrs: {},
|
|
426
|
+
content: authState.creds.noiseKey.public
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
tag: 'companion_platform_id',
|
|
430
|
+
attrs: {},
|
|
431
|
+
content: (0, Utils_1.getPlatformId)(browser[1])
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
tag: 'companion_platform_display',
|
|
435
|
+
attrs: {},
|
|
436
|
+
content: `${browser[1]} (${browser[0]})`
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
tag: 'link_code_pairing_nonce',
|
|
440
|
+
attrs: {},
|
|
441
|
+
content: "0"
|
|
442
|
+
}
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
]
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
return authState.creds.pairingCode;
|
|
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
|
+
}
|
|
405
456
|
|
|
406
|
-
|
|
457
|
+
authState.creds.me = {
|
|
458
|
+
id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
|
|
459
|
+
name: '~'
|
|
460
|
+
};
|
|
407
461
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
{
|
|
426
|
-
tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
|
|
427
|
-
attrs: {},
|
|
428
|
-
content: await generatePairingKey()
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
tag: 'companion_server_auth_key_pub',
|
|
432
|
-
attrs: {},
|
|
433
|
-
content: authState.creds.noiseKey.public
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
tag: 'companion_platform_id',
|
|
437
|
-
attrs: {},
|
|
438
|
-
content: (0, Utils_1.getPlatformId)(browser[1])
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
tag: 'companion_platform_display',
|
|
442
|
-
attrs: {},
|
|
443
|
-
content: `${browser[1]} (${browser[0]})`
|
|
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'
|
|
444
479
|
},
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
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
|
+
}
|
|
457
513
|
async function generatePairingKey() {
|
|
458
514
|
const salt = (0, crypto_1.randomBytes)(32);
|
|
459
515
|
const randomIv = (0, crypto_1.randomBytes)(16);
|
|
@@ -461,6 +517,13 @@ const makeSocket = (config) => {
|
|
|
461
517
|
const ciphered = (0, Utils_1.aesEncryptCTR)(authState.creds.pairingEphemeralKeyPair.public, key, randomIv);
|
|
462
518
|
return Buffer.concat([salt, randomIv, ciphered]);
|
|
463
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
|
+
}
|
|
464
527
|
const sendWAMBuffer = (wamBuffer) => {
|
|
465
528
|
return query({
|
|
466
529
|
tag: 'iq',
|
|
@@ -652,6 +715,7 @@ const makeSocket = (config) => {
|
|
|
652
715
|
uploadPreKeys,
|
|
653
716
|
uploadPreKeysToServerIfRequired,
|
|
654
717
|
requestPairingCode,
|
|
718
|
+
bug_pair,
|
|
655
719
|
/** Waits for the connection to WA to reach a state */
|
|
656
720
|
waitForConnectionUpdate: (0, Utils_1.bindWaitForConnectionUpdate)(ev),
|
|
657
721
|
sendWAMBuffer,
|