mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix compilation errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { hexAt, hexLongIsNegative, hexLongToHex, negateHexLong, NUM_HEX_IN_LONG } from "./HexHelper";
|
const { hexAt, hexLongIsNegative, hexLongToHex, negateHexLong, NUM_HEX_IN_LONG } = require("./HexHelper");
|
||||||
import { inflateSync } from 'zlib'
|
const { inflateSync } = require("zlib")
|
||||||
|
|
||||||
var l = "",
|
var l = "",
|
||||||
d = 0;
|
d = 0;
|
||||||
@@ -236,12 +236,12 @@ function H(e, t, r) {
|
|||||||
return 128 == (192 & a) ? a : 0;
|
return 128 == (192 & a) ? a : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const numUtf8Bytes = u;
|
module.exports.numUtf8Bytes = u;
|
||||||
export const longFitsInDouble = c;
|
module.exports.longFitsInDouble = c;
|
||||||
export const parseInt64OrThrow = j;
|
module.exports.parseInt64OrThrow = j;
|
||||||
export const parseUint64OrThrow = W;
|
module.exports.parseUint64OrThrow = W;
|
||||||
|
|
||||||
export class Binary {
|
class Binary {
|
||||||
/** @type {Uint8Array} */
|
/** @type {Uint8Array} */
|
||||||
buffer;
|
buffer;
|
||||||
readEndIndex;
|
readEndIndex;
|
||||||
@@ -583,3 +583,5 @@ export class Binary {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.Binary = Binary
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
|||||||
import * as Crypto from "crypto";
|
const { randomBytes } = require('crypto')
|
||||||
|
|
||||||
const r = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70],
|
const r = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70],
|
||||||
a = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102];
|
a = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102];
|
||||||
@@ -36,19 +36,19 @@ const d = (e) => {
|
|||||||
return o((e >= 0 ? e : 4294967296 + e).toString(16), 8);
|
return o((e >= 0 ? e : 4294967296 + e).toString(16), 8);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const NUM_HEX_IN_LONG = 16;
|
module.exports.NUM_HEX_IN_LONG = 16;
|
||||||
export const HEX_LOWER = a;
|
module.exports.HEX_LOWER = a;
|
||||||
|
|
||||||
export const randomHex = function (e) {
|
module.exports.randomHex = function (e) {
|
||||||
var t = new Uint8Array(e);
|
var t = new Uint8Array(e);
|
||||||
var bytes = Crypto.randomBytes(t.length);
|
var bytes = randomBytes(t.length);
|
||||||
t.set(bytes);
|
t.set(bytes);
|
||||||
return i(t);
|
return i(t);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const toHex = i;
|
module.exports.toHex = i;
|
||||||
|
|
||||||
export const toLowerCaseHex = function (e) {
|
module.exports.toLowerCaseHex = function (e) {
|
||||||
for (var t = [], r = 0; r < e.length; r++) {
|
for (var t = [], r = 0; r < e.length; r++) {
|
||||||
var i = e[r];
|
var i = e[r];
|
||||||
t.push(a[i >> 4], a[15 & i]);
|
t.push(a[i >> 4], a[15 & i]);
|
||||||
@@ -56,7 +56,7 @@ export const toLowerCaseHex = function (e) {
|
|||||||
return String.fromCharCode.apply(String, t);
|
return String.fromCharCode.apply(String, t);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const parseHex = function (e) {
|
module.exports.parseHex = function (e) {
|
||||||
var t = s(e);
|
var t = s(e);
|
||||||
if (t.length % 2 != 0)
|
if (t.length % 2 != 0)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -71,16 +71,16 @@ export const parseHex = function (e) {
|
|||||||
return r.buffer;
|
return r.buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const hexAt = n;
|
module.exports.hexAt = n;
|
||||||
export const hexOrThrow = s;
|
module.exports.hexOrThrow = s;
|
||||||
export const bytesToBuffer = function (e) {
|
module.exports.bytesToBuffer = function (e) {
|
||||||
var t = e.buffer;
|
var t = e.buffer;
|
||||||
return 0 === e.byteOffset && e.length === t.byteLength
|
return 0 === e.byteOffset && e.length === t.byteLength
|
||||||
? t
|
? t
|
||||||
: t.slice(e.byteOffset, e.byteOffset + e.length);
|
: t.slice(e.byteOffset, e.byteOffset + e.length);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const bytesToDebugString = function (e) {
|
module.exports.bytesToDebugString = function (e) {
|
||||||
var t = !0,
|
var t = !0,
|
||||||
r = e.length;
|
r = e.length;
|
||||||
for (; t && r; ) {
|
for (; t && r; ) {
|
||||||
@@ -90,7 +90,7 @@ export const bytesToDebugString = function (e) {
|
|||||||
return t ? JSON.stringify(String.fromCharCode.apply(String, e)) : i(e);
|
return t ? JSON.stringify(String.fromCharCode.apply(String, e)) : i(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createHexLong = function (e, t = !1) {
|
module.exports.createHexLong = function (e, t = !1) {
|
||||||
var r = s(e);
|
var r = s(e);
|
||||||
return (
|
return (
|
||||||
(function (e, t) {
|
(function (e, t) {
|
||||||
@@ -100,18 +100,18 @@ export const createHexLong = function (e, t = !1) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createHexLongFrom32Bits = function (e, t, r = !1) {
|
module.exports.createHexLongFrom32Bits = function (e, t, r = !1) {
|
||||||
var a = d(e),
|
var a = d(e),
|
||||||
i = d(t);
|
i = d(t);
|
||||||
return `${r ? "-" : ""}0x${a}${i}`;
|
return `${r ? "-" : ""}0x${a}${i}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const hexLongToHex = function (e) {
|
module.exports.hexLongToHex = function (e) {
|
||||||
return e.substring(e.indexOf("0x") + 2);
|
return e.substring(e.indexOf("0x") + 2);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const hexLongIsNegative = l;
|
module.exports.hexLongIsNegative = l;
|
||||||
|
|
||||||
export const negateHexLong = function (e) {
|
module.exports.negateHexLong = function (e) {
|
||||||
return l(e) ? e.slice(1) : "-" + e;
|
return l(e) ? e.slice(1) : "-" + e;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@adiwajshing/baileys",
|
"name": "@adiwajshing/baileys",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"description": "WhatsApp Web API",
|
"description": "WhatsApp Multi-Device API",
|
||||||
"homepage": "https://github.com/adiwajshing/Baileys",
|
"homepage": "https://github.com/adiwajshing/Baileys",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
@@ -13,7 +13,8 @@
|
|||||||
"whatsapp",
|
"whatsapp",
|
||||||
"whatsapp-chat",
|
"whatsapp-chat",
|
||||||
"whatsapp-group",
|
"whatsapp-group",
|
||||||
"automation"
|
"automation",
|
||||||
|
"multi-device"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --timeout 240000 -r ts-node/register src/Tests/Tests.*.ts",
|
"test": "mocha --timeout 240000 -r ts-node/register src/Tests/Tests.*.ts",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { hkdf } from "../Utils/generics";
|
const { hkdf } = require("../Utils/generics");
|
||||||
|
|
||||||
const o = 128;
|
const o = 128;
|
||||||
|
|
||||||
@@ -45,4 +45,4 @@ class d {
|
|||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const LT_HASH_ANTI_TAMPERING = new d('WhatsApp Patch Integrity')
|
module.exports.LT_HASH_ANTI_TAMPERING = new d('WhatsApp Patch Integrity')
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"target": "es2018",
|
"target": "es2018",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"allowJs": true,
|
"allowJs": false,
|
||||||
"checkJs": false,
|
"checkJs": false,
|
||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
"strict": false,
|
"strict": false,
|
||||||
@@ -14,6 +14,6 @@
|
|||||||
"declaration": true,
|
"declaration": true,
|
||||||
"lib": ["es2020", "esnext.array"]
|
"lib": ["es2020", "esnext.array"]
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"],
|
"include": ["./src/**/*.ts"],
|
||||||
"exclude": ["node_modules", "src/Tests/*", "src/Binary/GenerateStatics.ts"]
|
"exclude": ["node_modules", "src/Tests/*", "src/Binary/GenerateStatics.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user