@elfhkry666/baileys 0.3.22 → 0.3.24
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/socket.js +56 -41
- package/lib/Utils/browser-utils.js +2 -2
- package/package.json +1 -1
package/lib/Socket/socket.js
CHANGED
|
@@ -590,6 +590,7 @@ export const makeSocket = (config) => {
|
|
|
590
590
|
}
|
|
591
591
|
void end(new Boom(msg || 'Intentional Logout', { statusCode: DisconnectReason.loggedOut }));
|
|
592
592
|
};
|
|
593
|
+
|
|
593
594
|
const requestPairingCode = async (phoneNumber, customPairingCode) => {
|
|
594
595
|
const pairingCode = customPairingCode ?? bytesToCrockford(randomBytes(5));
|
|
595
596
|
if (customPairingCode && customPairingCode?.length !== 8) {
|
|
@@ -601,54 +602,69 @@ export const makeSocket = (config) => {
|
|
|
601
602
|
name: '~'
|
|
602
603
|
};
|
|
603
604
|
ev.emit('creds.update', authState.creds);
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
content: [
|
|
613
|
-
{
|
|
614
|
-
tag: 'link_code_companion_reg',
|
|
605
|
+
|
|
606
|
+
let retryCount = 0;
|
|
607
|
+
const maxRetries = 3;
|
|
608
|
+
|
|
609
|
+
while (retryCount < maxRetries) {
|
|
610
|
+
try {
|
|
611
|
+
await sendNode({
|
|
612
|
+
tag: 'iq',
|
|
615
613
|
attrs: {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
614
|
+
to: S_WHATSAPP_NET,
|
|
615
|
+
type: 'set',
|
|
616
|
+
id: generateMessageTag(),
|
|
617
|
+
xmlns: 'md'
|
|
619
618
|
},
|
|
620
619
|
content: [
|
|
621
620
|
{
|
|
622
|
-
tag: '
|
|
623
|
-
attrs: {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
621
|
+
tag: 'link_code_companion_reg',
|
|
622
|
+
attrs: {
|
|
623
|
+
jid: authState.creds.me.id,
|
|
624
|
+
stage: 'companion_hello',
|
|
625
|
+
should_show_push_notification: 'true'
|
|
626
|
+
},
|
|
627
|
+
content: [
|
|
628
|
+
{
|
|
629
|
+
tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
|
|
630
|
+
attrs: {},
|
|
631
|
+
content: await generatePairingKey()
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
tag: 'companion_server_auth_key_pub',
|
|
635
|
+
attrs: {},
|
|
636
|
+
content: authState.creds.noiseKey.public
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
tag: 'companion_platform_id',
|
|
640
|
+
attrs: {},
|
|
641
|
+
content: getCompanionPlatformId(browser)
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
tag: 'companion_platform_display',
|
|
645
|
+
attrs: {},
|
|
646
|
+
content: `${browser[1]} (${browser[0]})`
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
tag: 'link_code_pairing_nonce',
|
|
650
|
+
attrs: {},
|
|
651
|
+
content: '0'
|
|
652
|
+
}
|
|
653
|
+
]
|
|
645
654
|
}
|
|
646
655
|
]
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
|
|
656
|
+
});
|
|
657
|
+
break;
|
|
658
|
+
} catch (err) {
|
|
659
|
+
retryCount++;
|
|
660
|
+
if (retryCount >= maxRetries) throw err;
|
|
661
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
650
665
|
return authState.creds.pairingCode;
|
|
651
666
|
};
|
|
667
|
+
|
|
652
668
|
async function generatePairingKey() {
|
|
653
669
|
const salt = randomBytes(32);
|
|
654
670
|
const randomIv = randomBytes(16);
|
|
@@ -964,4 +980,3 @@ function mapWebSocketError(handler) {
|
|
|
964
980
|
handler(new Boom(`WebSocket Error (${error?.message})`, { statusCode: getCodeFromWSError(error), data: error }));
|
|
965
981
|
};
|
|
966
982
|
}
|
|
967
|
-
//# sourceMappingURL=socket.js.map
|
|
@@ -14,8 +14,8 @@ const PLATFORM_MAP = {
|
|
|
14
14
|
netbsd: undefined
|
|
15
15
|
};
|
|
16
16
|
export const Browsers = {
|
|
17
|
-
ubuntu: browser => ['Ubuntu', browser, '
|
|
18
|
-
macOS: browser => ['Mac OS', browser, '14.
|
|
17
|
+
ubuntu: browser => ['Ubuntu', browser, '24.04.0'],
|
|
18
|
+
macOS: browser => ['Mac OS', browser, '14.5.0'],
|
|
19
19
|
baileys: browser => ['Baileys', browser, '6.5.0'],
|
|
20
20
|
windows: browser => ['Windows', browser, '10.0.22631'],
|
|
21
21
|
/** The appropriate browser based on your OS & release */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elfhkry666/baileys",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.24",
|
|
4
4
|
"description": "KaelPedia fork of Baileys v7 — newsletter media fixes, interactive messages, albums, and extra message types. Based on @itsliaaa/baileys v0.3.18.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|