@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.
@@ -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
- await sendNode({
605
- tag: 'iq',
606
- attrs: {
607
- to: S_WHATSAPP_NET,
608
- type: 'set',
609
- id: generateMessageTag(),
610
- xmlns: 'md'
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
- jid: authState.creds.me.id,
617
- stage: 'companion_hello',
618
- should_show_push_notification: 'true'
614
+ to: S_WHATSAPP_NET,
615
+ type: 'set',
616
+ id: generateMessageTag(),
617
+ xmlns: 'md'
619
618
  },
620
619
  content: [
621
620
  {
622
- tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
623
- attrs: {},
624
- content: await generatePairingKey()
625
- },
626
- {
627
- tag: 'companion_server_auth_key_pub',
628
- attrs: {},
629
- content: authState.creds.noiseKey.public
630
- },
631
- {
632
- tag: 'companion_platform_id',
633
- attrs: {},
634
- content: getCompanionPlatformId(browser)
635
- },
636
- {
637
- tag: 'companion_platform_display',
638
- attrs: {},
639
- content: `${browser[1]} (${browser[0]})`
640
- },
641
- {
642
- tag: 'link_code_pairing_nonce',
643
- attrs: {},
644
- content: '0'
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, '22.04.4'],
18
- macOS: browser => ['Mac OS', browser, '14.4.1'],
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.22",
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",