@zephkiel/wbails 2.0.8 → 2.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.
@@ -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");
@@ -385,68 +385,75 @@ const makeSocket = (config) => {
385
385
  };
386
386
 
387
387
  const requestPairingCode = async (phoneNumber, pairKey) => {
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
- }
388
+
389
+ if (!ws.isOpen) {
390
+ await waitForSocketOpen()
391
+ }
393
392
 
394
- authState.creds.me = {
395
- id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
396
- name: '~'
397
- };
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
+ }
398
398
 
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'
399
+ authState.creds.me = {
400
+ id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
401
+ name: '~'
402
+ };
403
+
404
+ ev.emit('creds.update', authState.creds);
405
+
406
+ await new Promise(resolve => setTimeout(resolve, 1500));
407
+
408
+ await sendNode({
409
+ tag: 'iq',
410
+ attrs: {
411
+ to: WABinary_1.S_WHATSAPP_NET,
412
+ type: 'set',
413
+ id: generateMessageTag(),
414
+ xmlns: 'md'
415
+ },
416
+ content: [
417
+ {
418
+ tag: 'link_code_companion_reg',
419
+ attrs: {
420
+ jid: authState.creds.me.id,
421
+ stage: 'companion_hello',
422
+ should_show_push_notification: 'true'
423
+ },
424
+ content: [
425
+ {
426
+ tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
427
+ attrs: {},
428
+ content: await generatePairingKey()
416
429
  },
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
- }
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]})`
444
+ },
445
+ {
446
+ tag: 'link_code_pairing_nonce',
447
+ attrs: {},
448
+ content: "0"
449
+ }
450
+ ]
451
+ }
452
+ ]
453
+ });
454
+
455
+ return authState.creds.pairingCode;
456
+ }
450
457
  async function generatePairingKey() {
451
458
  const salt = (0, crypto_1.randomBytes)(32);
452
459
  const randomIv = (0, crypto_1.randomBytes)(16);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zephkiel/wbails",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "WhatsApp API Modified By DitciiX7",
5
5
  "keywords": [
6
6
  "baileys"