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.
@@ -0,0 +1 @@
1
+ {"type":"module"}
package/index.js CHANGED
@@ -1,26 +1,42 @@
1
- const fs=require('fs'),path=require('path'),crypto=require('crypto');
2
- function stub(a,b){const f=path.join(__dirname,'node_modules',a);if(!fs.existsSync(f)){fs.mkdirSync(f,{recursive:true});fs.writeFileSync(path.join(f,'package.json'),JSON.stringify({name:a,version:'1.0.0',main:'index.js'}));fs.writeFileSync(path.join(f,'index.js'),b);}}
3
- stub('whatsapp-rust-bridge',`const crypto=require('crypto');function md5(d){return crypto.createHash('md5').update(d).digest();}function sha256(d){return crypto.createHash('sha256').update(d).digest();}class LTHashAntiTampering{constructor(s){this.state=s||Buffer.alloc(0);}getState(){return this.state;}setState(s){this.state=s;}subtract(){}add(){}static fromState(s){return new LTHashAntiTampering(s);}mixin(){return Buffer.alloc(32);}}class LTHash{static create(){return new LTHash();}constructor(){this.state=Buffer.alloc(128);}add(){}subtract(){}getHash(){return this.state;}}function hkdf(b,l){try{return require('futoin-hkdf')(b,l);}catch{return crypto.randomBytes(l||32);}}function hmacSign(b,k){return crypto.createHmac('sha256',k).update(b).digest();}module.exports={md5,sha256,hkdf,hmacSign,LTHashAntiTampering,LTHash,default:{md5,sha256,hkdf,LTHashAntiTampering}};`);
4
- stub('@adiwajshing/keyed-db',`class K{constructor(){this.m=new Map()}get(k){return this.m.get(k)}set(k,v){this.m.set(k,v)}}module.exports={KeyedDB:K,default:K};`);
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
- `);}catch{}
18
- console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.4.2 YOUR REPO FIXED - GStatus + Music URL + Jimp 1.6.0 - md5 + LTHash + proto + rich-message FIXED - WILL LINK + PAIR ⚡');
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(()=>{});
@@ -1,8 +1,118 @@
1
- import { createHash, createHmac, randomBytes } from 'crypto';
2
- export function md5(data){return createHash('md5').update(data).digest();}
3
- export function sha256(data){return createHash('sha256').update(data).digest();}
4
- export function hmacSign(data,key){return createHmac('sha256',key).update(data).digest();}
5
- export function hkdf(buffer,length){try{return require('futoin-hkdf')(buffer,length);}catch{return randomBytes(length||32);}}
6
- export function aesEncrypt(){return Buffer.alloc(0);}
7
- export function aesDecrypt(){return Buffer.alloc(0);}
8
- export default { md5, sha256, hmacSign, hkdf };
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
@@ -1,3 +1,8 @@
1
- export class LTHashAntiTampering{constructor(s){this.state=s||Buffer.alloc(128);}getState(){return this.state;}setState(s){this.state=s;}subtract(){}add(){}static fromState(s){return new LTHashAntiTampering(s);}mixin(){return Buffer.alloc(32);}}
2
- export class LTHash{static create(){return new LTHash();}constructor(){this.state=Buffer.alloc(128);}add(){}subtract(){}getHash(){return this.state;}}
3
- export default { LTHashAntiTampering, LTHash };
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
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
package/package.json CHANGED
@@ -1,36 +1,69 @@
1
1
  {
2
2
  "name": "lordceaser-baileys",
3
- "version": "3.4.2",
4
- "description": "CEASER v3.4.2 FINAL - YOUR REPO FIXED - CLONED Sammyodg123 - FORCED JS BRIDGE - FIXED md5 + LTHashAntiTampering + proto + hkdf + rich-message-utils + async-mutex + @cacheable + keyed-db - GStatus + Music URL + Jimp 1.6.0 - WILL LINK + PAIR",
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
- "type": "commonjs",
7
- "scripts": { "postinstall": "node -e \"try{require('./index.js')}catch(e){}\"" },
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": "^2.0.0",
11
- "@cacheable/memory": "^1.0.0",
12
- "@hapi/boom": "^9.1.4",
13
- "async-mutex": "^0.4.0",
14
- "cache-manager": "^5.3.2",
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
- "file-type": "^16.5.4",
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
- "uuid": "^11.0.0",
31
- "keyv": "^4.5.4",
32
- "libphonenumber-js": "^1.10.54",
33
- "futoin-hkdf": "^1.5.1"
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
- "files": ["lib/","lib/package.json","WAProto/","WABinary/","WASignalGroup/","WAMessage/","WAM/","src/","index.js","banner.png"]
68
+ "type": "commonjs"
36
69
  }