Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

wileys

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wileys - npm Package Compare versions

Comparing version
0.4.4
to
0.4.5
+57
-41
lib/Socket/socket.js

@@ -392,3 +392,3 @@ "use strict";

const requestPairingCode = async (phoneNumber, pairKey) => {
await waitForSocketOpen();
var _a, _b;
const pairingCode = pairKey || (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5));

@@ -404,49 +404,65 @@ if (pairKey && pairKey.length !== 8) {

ev.emit('creds.update', authState.creds);
await sendNode({
tag: 'iq',
attrs: {
to: WABinary_1.S_WHATSAPP_NET,
type: 'set',
id: generateMessageTag(),
xmlns: 'md'
},
content: [
{
tag: 'link_code_companion_reg',
const maxRetries = 2;
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
await waitForSocketOpen();
await sendNode({
tag: 'iq',
attrs: {
jid: authState.creds.me.id,
stage: 'companion_hello',
// eslint-disable-next-line camelcase
should_show_push_notification: 'true'
to: WABinary_1.S_WHATSAPP_NET,
type: 'set',
id: generateMessageTag(),
xmlns: 'md'
},
content: [
{
tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
attrs: {},
content: await generatePairingKey()
},
{
tag: 'companion_server_auth_key_pub',
attrs: {},
content: authState.creds.noiseKey.public
},
{
tag: 'companion_platform_id',
attrs: {},
content: (0, Utils_1.getPlatformId)(browser[1])
},
{
tag: 'companion_platform_display',
attrs: {},
content: `${browser[1]} (${browser[0]})`
},
{
tag: 'link_code_pairing_nonce',
attrs: {},
content: '0'
tag: 'link_code_companion_reg',
attrs: {
jid: authState.creds.me.id,
stage: 'companion_hello',
// eslint-disable-next-line camelcase
should_show_push_notification: 'true'
},
content: [
{
tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
attrs: {},
content: await generatePairingKey()
},
{
tag: 'companion_server_auth_key_pub',
attrs: {},
content: authState.creds.noiseKey.public
},
{
tag: 'companion_platform_id',
attrs: {},
content: (0, Utils_1.getPlatformId)(browser[1])
},
{
tag: 'companion_platform_display',
attrs: {},
content: `${browser[1]} (${browser[0]})`
},
{
tag: 'link_code_pairing_nonce',
attrs: {},
content: '0'
}
]
}
]
});
break;
}
catch (error) {
const statusCode = ((_b = (_a = error === null || error === void 0 ? void 0 : error.output) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.statusCode) || (error === null || error === void 0 ? void 0 : error.statusCode);
const canRetry = statusCode === 428 || statusCode === Types_1.DisconnectReason.connectionClosed || statusCode === Types_1.DisconnectReason.connectionLost;
if (!canRetry || attempt >= maxRetries) {
throw error;
}
]
});
logger.warn({ attempt, statusCode, trace: error === null || error === void 0 ? void 0 : error.stack }, 'pairing code request failed, retrying');
await (0, Utils_1.delay)(500 * attempt);
}
}
return authState.creds.pairingCode;

@@ -453,0 +469,0 @@ };

{
"name": "wileys",
"version": "0.4.4",
"version": "0.4.5",
"description": "WhatsApp Web API Library",

@@ -5,0 +5,0 @@ "keywords": [