dtec-bail 1.0.7 → 1.0.9

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.
@@ -11,7 +11,6 @@ const Types_1 = require("../Types");
11
11
  const Utils_1 = require("../Utils");
12
12
  const WABinary_1 = require("../WABinary");
13
13
  const Client_1 = require("./Client");
14
-
15
14
  /**
16
15
  * Connects to WA servers and performs:
17
16
  * - simple queries (no retry mechanism, wait for connection establishment)
@@ -23,8 +22,8 @@ const makeSocket = (config) => {
23
22
  const { waWebSocketUrl, connectTimeoutMs, logger, keepAliveIntervalMs, browser, auth: authState, printQRInTerminal, defaultQueryTimeoutMs, transactionOpts, qrTimeout, makeSignalRepository, } = config;
24
23
  const url = typeof waWebSocketUrl === 'string' ? new url_1.URL(waWebSocketUrl) : waWebSocketUrl;
25
24
  if (config.mobile || url.protocol === 'tcp:') {
26
- throw new boom_1.Boom('Mobile API is not supported anymore', {
27
- statusCode: Types_1.DisconnectReason.loggedOut
25
+ throw new boom_1.Boom('Mobile API is not supported anymore', {
26
+ statusCode: Types_1.DisconnectReason.loggedOut
28
27
  });
29
28
  }
30
29
  if (url.protocol === 'wss' && ((_a = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _a === void 0 ? void 0 : _a.routingInfo)) {
@@ -384,29 +383,24 @@ const makeSocket = (config) => {
384
383
  }
385
384
  end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
386
385
  };
387
-
388
- /** Custom random code generator with DNUZ prefix */
389
- const generateRandomCode = () => {
390
- const prefix = "DNUZ";
391
- const randomPart = Math.random().toString(36).substring(2, 6).toUpperCase();
392
- return prefix + randomPart;
393
- };
394
-
395
- /** This method was created by DanuZz, and implemented by DanuZz */
386
+
387
+ /** This method was created by snowi, and implemented by KyuuRzy */
396
388
  /** hey bro, if you delete this text */
397
389
  /** you are the most cursed human being who likes to claim other people's property 😹🙌🏻 */
398
390
  const requestPairingCode = async (phoneNumber, pairKey) => {
399
391
  if (pairKey) {
400
392
  authState.creds.pairingCode = pairKey.toUpperCase();
401
393
  } else {
402
- authState.creds.pairingCode = generateRandomCode();
394
+ authState.creds.pairingCode = (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5));
403
395
  }
396
+
404
397
  authState.creds.me = {
405
398
  id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
406
399
  name: '~'
407
400
  };
401
+
408
402
  ev.emit('creds.update', authState.creds);
409
-
403
+
410
404
  await sendNode({
411
405
  tag: 'iq',
412
406
  attrs: {
@@ -453,7 +447,7 @@ const makeSocket = (config) => {
453
447
  }
454
448
  ]
455
449
  });
456
-
450
+
457
451
  return authState.creds.pairingCode;
458
452
  }
459
453
  async function generatePairingKey() {
@@ -636,7 +630,7 @@ const makeSocket = (config) => {
636
630
  ev,
637
631
  authState: {
638
632
  creds,
639
- keys
633
+ keys
640
634
  },
641
635
  signalRepository,
642
636
  get user() {
@@ -176,7 +176,7 @@ const generateMessageIDV2 = (userId) => {
176
176
  };
177
177
  exports.generateMessageIDV2 = generateMessageIDV2;
178
178
  // generate a random ID to attach to a message
179
- const generateMessageID = () => 'ILSYM-' + (0, crypto_1.randomBytes)(6).toString('hex').toUpperCase();
179
+ const generateMessageID = () => '7EPP3LI-' + (0, crypto_1.randomBytes)(6).toString('hex').toUpperCase();
180
180
  exports.generateMessageID = generateMessageID;
181
181
  function bindWaitForEvent(ev, event) {
182
182
  return async (check, timeoutMs) => {