lordceaser-baileys 3.4.2 → 3.4.5
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/WAProto/index.js +115856 -5
- package/WAProto/package.json +1 -0
- package/index.js +37 -21
- package/lib/Utils/crypto.js +118 -8
- package/lib/Utils/lt-hash.js +8 -3
- package/lib/package.json +3 -0
- package/package.json +61 -28
- package/WAProto/_orig.js +0 -115856
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/index.js
CHANGED
|
@@ -1,26 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
stub('@cacheable/node-cache',`class NodeCache{constructor(){this.m=new Map()}get(k){return this.m.get(k)}set(k,v){this.m.set(k,v)}has(k){return this.m.has(k)}delete(k){return this.m.delete(k)}}module.exports={NodeCache,default:NodeCache};`);
|
|
6
|
-
stub('async-mutex',`class Mutex{async acquire(){return ()=>{}} isLocked(){return false}} module.exports={Mutex};`);
|
|
7
|
-
function showBanner(){
|
|
8
|
-
try{
|
|
9
|
-
const b=fs.readFileSync(path.join(__dirname,'banner.png'));
|
|
10
|
-
console.log('\x1b[35m%s\x1b[0m',`
|
|
11
|
-
██████╗███████╗ █████╗ ███████╗███████╗██████╗
|
|
1
|
+
'use strict';
|
|
2
|
+
const version = require('./package.json').version;
|
|
3
|
+
console.log('\x1b[35m%s\x1b[0m', `
|
|
4
|
+
██████╗███████╗ █████╗ ███████╗███████╗██████╗
|
|
12
5
|
██╔════╝██╔════╝██╔══██╗██╔════╝██╔════╝██╔══██╗
|
|
13
6
|
██║ █████╗ ███████║███████╗█████╗ ██████╔╝
|
|
14
7
|
██║ ██╔══╝ ██╔══██║╚════██║██╔══╝ ██╔══██╗
|
|
15
8
|
╚██████╗███████╗██║ ██║███████║███████╗██║ ██║
|
|
16
|
-
╚═════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝
|
|
17
|
-
`);
|
|
18
|
-
|
|
9
|
+
╚═════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝`);
|
|
10
|
+
console.log('\x1b[36m%s\x1b[0m', ` ⚡ CEASER v${version} ⚡`);
|
|
11
|
+
|
|
12
|
+
function wrap(make) {
|
|
13
|
+
return function (...args) {
|
|
14
|
+
const sock = make(...args);
|
|
15
|
+
if (sock && typeof sock.requestPairingCode === 'function') {
|
|
16
|
+
const orig = sock.requestPairingCode.bind(sock);
|
|
17
|
+
sock.requestPairingCode = (phone, custom) => {
|
|
18
|
+
phone = String(phone).replace(/\D/g, '');
|
|
19
|
+
const code = String(custom || 'CEASERMD').toUpperCase()
|
|
20
|
+
.replace(/[^A-Z0-9]/g, '').slice(0, 8).padEnd(8, '4');
|
|
21
|
+
return orig(phone, code);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return sock;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let lib = null;
|
|
29
|
+
try { lib = require('./lib/index.js'); }
|
|
30
|
+
catch (e) {
|
|
31
|
+
if (!['ERR_REQUIRE_ESM', 'ERR_REQUIRE_ASYNC_MODULE'].includes(e.code)) throw e;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (lib) {
|
|
35
|
+
const mk = wrap(lib.makeWASocket || lib.default);
|
|
36
|
+
module.exports = { ...lib, makeWASocket: mk, default: mk, version };
|
|
37
|
+
} else {
|
|
38
|
+
console.warn('Node < 22.12 detected: use Node 22+ for require() support.');
|
|
39
|
+
const load = () => import('./lib/index.js');
|
|
40
|
+
const mk = async (...a) => { const l = await load(); return wrap(l.makeWASocket || l.default)(...a); };
|
|
41
|
+
module.exports = { loadLib: load, makeWASocket: mk, default: mk, version };
|
|
19
42
|
}
|
|
20
|
-
showBanner();
|
|
21
|
-
let cachedLib=null,cachedOrig=null;
|
|
22
|
-
async function loadPlomeESM(){if(cachedLib) return cachedLib; const lib=await import('./lib/index.js'); console.log('\x1b[32m%s\x1b[0m','✅ CEASER lib 3.4.2 YOUR REPO - ALL FIXES OK - PAIR READY'); cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib; return lib;}
|
|
23
|
-
function makeForcedCustomWrapper(o){return function(...a){const s=o(...a);if(s?.requestPairingCode){const r=s.requestPairingCode.bind(s);s.requestPairingCode=async(p,c)=>{p=p.replace(/\\D/g,'');let f=(c||"CEASERMD").toString().toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8).padEnd(8,'4');try{const x=await r(p,f);return f;}catch(e){try{await r(p);}catch{}return f;}};}return s;};}
|
|
24
|
-
async function makeWASocketAsync(...a){const lib=await loadPlomeESM();return makeForcedCustomWrapper(cachedOrig)(...a);}
|
|
25
|
-
module.exports={makeWASocket:makeWASocketAsync,default:makeWASocketAsync,version:'3.4.2',loadPlomeESM,useMultiFileAuthState:async(...a)=>{const l=await loadPlomeESM();return l.useMultiFileAuthState(...a);},DisconnectReason:{},fetchLatestBaileysVersion:async(...a)=>{const l=await loadPlomeESM();return l.fetchLatestBaileysVersion(...a);},makeCacheableSignalKeyStore:async(...a)=>{const l=await loadPlomeESM();return l.makeCacheableSignalKeyStore(...a);}};
|
|
26
|
-
loadPlomeESM().then(l=>{module.exports.DisconnectReason=l.DisconnectReason;module.exports.useMultiFileAuthState=l.useMultiFileAuthState;module.exports.fetchLatestBaileysVersion=l.fetchLatestBaileysVersion;module.exports.makeCacheableSignalKeyStore=l.makeCacheableSignalKeyStore;}).catch(()=>{});
|
package/lib/Utils/crypto.js
CHANGED
|
@@ -1,8 +1,118 @@
|
|
|
1
|
-
import { createHash, createHmac, randomBytes } from 'crypto';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
1
|
+
import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes } from 'crypto';
|
|
2
|
+
import * as curve from 'libsignal/src/curve.js';
|
|
3
|
+
import { KEY_BUNDLE_TYPE } from '../Defaults/index.js';
|
|
4
|
+
export { md5, hkdf } from 'whatsapp-rust-bridge';
|
|
5
|
+
// insure browser & node compatibility
|
|
6
|
+
const { subtle } = globalThis.crypto;
|
|
7
|
+
/** prefix version byte to the pub keys, required for some curve crypto functions */
|
|
8
|
+
export const generateSignalPubKey = (pubKey) => pubKey.length === 33 ? pubKey : Buffer.concat([KEY_BUNDLE_TYPE, pubKey]);
|
|
9
|
+
export const Curve = {
|
|
10
|
+
generateKeyPair: () => {
|
|
11
|
+
const { pubKey, privKey } = curve.generateKeyPair();
|
|
12
|
+
return {
|
|
13
|
+
private: Buffer.from(privKey),
|
|
14
|
+
// remove version byte
|
|
15
|
+
public: Buffer.from(pubKey.slice(1))
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
sharedKey: (privateKey, publicKey) => {
|
|
19
|
+
const shared = curve.calculateAgreement(generateSignalPubKey(publicKey), privateKey);
|
|
20
|
+
return Buffer.from(shared);
|
|
21
|
+
},
|
|
22
|
+
sign: (privateKey, buf) => curve.calculateSignature(privateKey, buf),
|
|
23
|
+
verify: (pubKey, message, signature) => {
|
|
24
|
+
try {
|
|
25
|
+
curve.verifySignature(generateSignalPubKey(pubKey), message, signature);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const signedKeyPair = (identityKeyPair, keyId) => {
|
|
34
|
+
const preKey = Curve.generateKeyPair();
|
|
35
|
+
const pubKey = generateSignalPubKey(preKey.public);
|
|
36
|
+
const signature = Curve.sign(identityKeyPair.private, pubKey);
|
|
37
|
+
return { keyPair: preKey, signature, keyId };
|
|
38
|
+
};
|
|
39
|
+
const GCM_TAG_LENGTH = 128 >> 3;
|
|
40
|
+
/**
|
|
41
|
+
* encrypt AES 256 GCM;
|
|
42
|
+
* where the tag tag is suffixed to the ciphertext
|
|
43
|
+
* */
|
|
44
|
+
export function aesEncryptGCM(plaintext, key, iv, additionalData) {
|
|
45
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
46
|
+
cipher.setAAD(additionalData);
|
|
47
|
+
return Buffer.concat([cipher.update(plaintext), cipher.final(), cipher.getAuthTag()]);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* decrypt AES 256 GCM;
|
|
51
|
+
* where the auth tag is suffixed to the ciphertext
|
|
52
|
+
* */
|
|
53
|
+
export function aesDecryptGCM(ciphertext, key, iv, additionalData) {
|
|
54
|
+
const decipher = createDecipheriv('aes-256-gcm', key, iv);
|
|
55
|
+
// decrypt additional adata
|
|
56
|
+
const enc = ciphertext.slice(0, ciphertext.length - GCM_TAG_LENGTH);
|
|
57
|
+
const tag = ciphertext.slice(ciphertext.length - GCM_TAG_LENGTH);
|
|
58
|
+
// set additional data
|
|
59
|
+
decipher.setAAD(additionalData);
|
|
60
|
+
decipher.setAuthTag(tag);
|
|
61
|
+
return Buffer.concat([decipher.update(enc), decipher.final()]);
|
|
62
|
+
}
|
|
63
|
+
export function aesEncryptCTR(plaintext, key, iv) {
|
|
64
|
+
const cipher = createCipheriv('aes-256-ctr', key, iv);
|
|
65
|
+
return Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
66
|
+
}
|
|
67
|
+
export function aesDecryptCTR(ciphertext, key, iv) {
|
|
68
|
+
const decipher = createDecipheriv('aes-256-ctr', key, iv);
|
|
69
|
+
return Buffer.concat([decipher.update(ciphertext), decipher.final()]);
|
|
70
|
+
}
|
|
71
|
+
/** decrypt AES 256 CBC; where the IV is prefixed to the buffer */
|
|
72
|
+
export function aesDecrypt(buffer, key) {
|
|
73
|
+
return aesDecryptWithIV(buffer.subarray(16), key, buffer.subarray(0, 16));
|
|
74
|
+
}
|
|
75
|
+
/** decrypt AES 256 CBC */
|
|
76
|
+
export function aesDecryptWithIV(buffer, key, IV) {
|
|
77
|
+
const aes = createDecipheriv('aes-256-cbc', key, IV);
|
|
78
|
+
return Buffer.concat([aes.update(buffer), aes.final()]);
|
|
79
|
+
}
|
|
80
|
+
// encrypt AES 256 CBC; where a random IV is prefixed to the buffer
|
|
81
|
+
export function aesEncrypt(buffer, key) {
|
|
82
|
+
const IV = randomBytes(16);
|
|
83
|
+
const aes = createCipheriv('aes-256-cbc', key, IV);
|
|
84
|
+
return Buffer.concat([IV, aes.update(buffer), aes.final()]); // prefix IV to the buffer
|
|
85
|
+
}
|
|
86
|
+
// encrypt AES 256 CBC with a given IV
|
|
87
|
+
export function aesEncrypWithIV(buffer, key, IV) {
|
|
88
|
+
const aes = createCipheriv('aes-256-cbc', key, IV);
|
|
89
|
+
return Buffer.concat([aes.update(buffer), aes.final()]); // prefix IV to the buffer
|
|
90
|
+
}
|
|
91
|
+
// sign HMAC using SHA 256
|
|
92
|
+
export function hmacSign(buffer, key, variant = 'sha256') {
|
|
93
|
+
return createHmac(variant, key).update(buffer).digest();
|
|
94
|
+
}
|
|
95
|
+
export function sha256(buffer) {
|
|
96
|
+
return createHash('sha256').update(buffer).digest();
|
|
97
|
+
}
|
|
98
|
+
export async function derivePairingCodeKey(pairingCode, salt) {
|
|
99
|
+
// Convert inputs to formats Web Crypto API can work with
|
|
100
|
+
const encoder = new TextEncoder();
|
|
101
|
+
const pairingCodeBuffer = encoder.encode(pairingCode);
|
|
102
|
+
const saltBuffer = new Uint8Array(salt instanceof Uint8Array ? salt : new Uint8Array(salt));
|
|
103
|
+
// Import the pairing code as key material
|
|
104
|
+
const keyMaterial = await subtle.importKey('raw', pairingCodeBuffer, { name: 'PBKDF2' }, false, [
|
|
105
|
+
'deriveBits'
|
|
106
|
+
]);
|
|
107
|
+
// Derive bits using PBKDF2 with the same parameters
|
|
108
|
+
// 2 << 16 = 131,072 iterations
|
|
109
|
+
const derivedBits = await subtle.deriveBits({
|
|
110
|
+
name: 'PBKDF2',
|
|
111
|
+
salt: saltBuffer,
|
|
112
|
+
iterations: 2 << 16,
|
|
113
|
+
hash: 'SHA-256'
|
|
114
|
+
}, keyMaterial, 32 * 8 // 32 bytes * 8 = 256 bits
|
|
115
|
+
);
|
|
116
|
+
return Buffer.from(derivedBits);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=crypto.js.map
|
package/lib/Utils/lt-hash.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { LTHashAntiTampering } from 'whatsapp-rust-bridge';
|
|
2
|
+
/**
|
|
3
|
+
* LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data
|
|
4
|
+
* over a series of mutations. You can add/remove mutations and it'll return a hash equal to
|
|
5
|
+
* if the same series of mutations was made sequentially.
|
|
6
|
+
*/
|
|
7
|
+
export const LT_HASH_ANTI_TAMPERING = new LTHashAntiTampering();
|
|
8
|
+
//# sourceMappingURL=lt-hash.js.map
|
package/lib/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,36 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lordceaser-baileys",
|
|
3
|
-
"version": "3.4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.4.5",
|
|
4
|
+
"description": "LordCeaser Baileys v1.0.2 - Cleanest WhatsApp API with Interactive Buttons, List Menus, GStatus Thumbnail Fix, Music/Video URL Import, Polls & More",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"author": "Lord Ceaser <lordceaser>",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/lordceaser/lordceaser-baileys#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/lordceaser/lordceaser-baileys.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/lordceaser/lordceaser-baileys/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"whatsapp",
|
|
19
|
+
"baileys",
|
|
20
|
+
"whatsapp-web",
|
|
21
|
+
"whatsapp-api",
|
|
22
|
+
"whatsapp-bot",
|
|
23
|
+
"lordceaser"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18.0.0"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"lib",
|
|
33
|
+
"WAProto",
|
|
34
|
+
"WABinary",
|
|
35
|
+
"WASignalGroup",
|
|
36
|
+
"WAMessage",
|
|
37
|
+
"WAM",
|
|
38
|
+
"src",
|
|
39
|
+
"index.js",
|
|
40
|
+
"banner.png"
|
|
41
|
+
],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc --skipLibCheck --noEmitOnError false --outDir lib & exit 0",
|
|
44
|
+
"prepublishOnly": "npm run build"
|
|
45
|
+
},
|
|
8
46
|
"dependencies": {
|
|
9
|
-
"@adiwajshing/keyed-db": "
|
|
10
|
-
"@cacheable/node-cache": "^
|
|
11
|
-
"@
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"fflate": "^0.8.2",
|
|
16
|
-
"libsignal": "*",
|
|
17
|
-
"long": "^5.2.3",
|
|
18
|
-
"lru-cache": "^7.18.3",
|
|
19
|
-
"music-metadata": "^7.14.0",
|
|
20
|
-
"p-queue": "^6.6.2",
|
|
21
|
-
"pino": "^8.17.2",
|
|
22
|
-
"protobufjs": "^7.2.5",
|
|
23
|
-
"whatsapp-rust-bridge": "^0.1.5",
|
|
24
|
-
"ws": "^8.14.2",
|
|
25
|
-
"axios": "^1.6.0",
|
|
26
|
-
"qrcode-terminal": "^0.12.0",
|
|
47
|
+
"@adiwajshing/keyed-db": "^0.2.4",
|
|
48
|
+
"@cacheable/node-cache": "^3.1.1",
|
|
49
|
+
"@hapi/boom": "^10.0.1",
|
|
50
|
+
"async-mutex": "^0.5.0",
|
|
51
|
+
"axios": "^1.6.7",
|
|
52
|
+
"fflate": "^0.8.3",
|
|
27
53
|
"jimp": "^1.6.0",
|
|
28
|
-
"
|
|
54
|
+
"libsignal": "github:WhiskeySockets/libsignal-node",
|
|
55
|
+
"link-preview-js": "^3.0.5",
|
|
56
|
+
"lru-cache": "^11.5.3",
|
|
29
57
|
"node-cache": "^5.1.2",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
58
|
+
"p-queue": "^10.0.0",
|
|
59
|
+
"pino": "^8.19.0",
|
|
60
|
+
"qrcode-terminal": "^0.12.0",
|
|
61
|
+
"whatsapp-rust-bridge": "^0.5.5",
|
|
62
|
+
"ws": "^8.14.2"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^20.8.10",
|
|
66
|
+
"typescript": "^5.3.3"
|
|
34
67
|
},
|
|
35
|
-
"
|
|
68
|
+
"type": "commonjs"
|
|
36
69
|
}
|