lordceaser-baileys 3.0.2 → 3.0.6
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/WASignalGroup/GroupProtocol.js +1697 -0
- package/WASignalGroup/ciphertext_message.js +16 -0
- package/WASignalGroup/group_cipher.js +120 -0
- package/WASignalGroup/group_session_builder.js +46 -0
- package/WASignalGroup/index.js +5 -0
- package/WASignalGroup/keyhelper.js +21 -0
- package/WASignalGroup/protobufs.js +3 -0
- package/WASignalGroup/queue_job.js +69 -0
- package/WASignalGroup/sender_chain_key.js +50 -0
- package/WASignalGroup/sender_key_distribution_message.js +78 -0
- package/WASignalGroup/sender_key_message.js +92 -0
- package/WASignalGroup/sender_key_name.js +70 -0
- package/WASignalGroup/sender_key_record.js +56 -0
- package/WASignalGroup/sender_key_state.js +129 -0
- package/WASignalGroup/sender_message_key.js +39 -0
- package/index.js +7 -31
- package/package.json +14 -22
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
const SenderChainKey = require('./sender_chain_key');
|
|
2
|
+
const SenderMessageKey = require('./sender_message_key');
|
|
3
|
+
|
|
4
|
+
const protobufs = require('./protobufs');
|
|
5
|
+
|
|
6
|
+
class SenderKeyState {
|
|
7
|
+
MAX_MESSAGE_KEYS = 2000;
|
|
8
|
+
|
|
9
|
+
constructor(
|
|
10
|
+
id = null,
|
|
11
|
+
iteration = null,
|
|
12
|
+
chainKey = null,
|
|
13
|
+
signatureKeyPair = null,
|
|
14
|
+
signatureKeyPublic = null,
|
|
15
|
+
signatureKeyPrivate = null,
|
|
16
|
+
senderKeyStateStructure = null
|
|
17
|
+
) {
|
|
18
|
+
if (senderKeyStateStructure) {
|
|
19
|
+
this.senderKeyStateStructure = senderKeyStateStructure;
|
|
20
|
+
} else {
|
|
21
|
+
if (signatureKeyPair) {
|
|
22
|
+
signatureKeyPublic = signatureKeyPair.public;
|
|
23
|
+
signatureKeyPrivate = signatureKeyPair.private;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
chainKey = typeof chainKey === 'string' ? Buffer.from(chainKey, 'base64') : chainKey;
|
|
27
|
+
this.senderKeyStateStructure = protobufs.SenderKeyStateStructure.create();
|
|
28
|
+
const senderChainKeyStructure = protobufs.SenderChainKey.create();
|
|
29
|
+
senderChainKeyStructure.iteration = iteration;
|
|
30
|
+
senderChainKeyStructure.seed = chainKey;
|
|
31
|
+
this.senderKeyStateStructure.senderChainKey = senderChainKeyStructure;
|
|
32
|
+
|
|
33
|
+
const signingKeyStructure = protobufs.SenderSigningKey.create();
|
|
34
|
+
signingKeyStructure.public =
|
|
35
|
+
typeof signatureKeyPublic === 'string' ?
|
|
36
|
+
Buffer.from(signatureKeyPublic, 'base64') :
|
|
37
|
+
signatureKeyPublic;
|
|
38
|
+
if (signatureKeyPrivate) {
|
|
39
|
+
signingKeyStructure.private =
|
|
40
|
+
typeof signatureKeyPrivate === 'string' ?
|
|
41
|
+
Buffer.from(signatureKeyPrivate, 'base64') :
|
|
42
|
+
signatureKeyPrivate;
|
|
43
|
+
}
|
|
44
|
+
this.senderKeyStateStructure.senderKeyId = id;
|
|
45
|
+
this.senderChainKey = senderChainKeyStructure;
|
|
46
|
+
this.senderKeyStateStructure.senderSigningKey = signingKeyStructure;
|
|
47
|
+
}
|
|
48
|
+
this.senderKeyStateStructure.senderMessageKeys =
|
|
49
|
+
this.senderKeyStateStructure.senderMessageKeys || [];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
SenderKeyState(senderKeyStateStructure) {
|
|
53
|
+
this.senderKeyStateStructure = senderKeyStateStructure;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
getKeyId() {
|
|
57
|
+
return this.senderKeyStateStructure.senderKeyId;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getSenderChainKey() {
|
|
61
|
+
return new SenderChainKey(
|
|
62
|
+
this.senderKeyStateStructure.senderChainKey.iteration,
|
|
63
|
+
this.senderKeyStateStructure.senderChainKey.seed
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setSenderChainKey(chainKey) {
|
|
68
|
+
const senderChainKeyStructure = protobufs.SenderChainKey.create({
|
|
69
|
+
iteration: chainKey.getIteration(),
|
|
70
|
+
seed: chainKey.getSeed(),
|
|
71
|
+
});
|
|
72
|
+
this.senderKeyStateStructure.senderChainKey = senderChainKeyStructure;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
getSigningKeyPublic() {
|
|
76
|
+
return typeof this.senderKeyStateStructure.senderSigningKey.public === 'string' ?
|
|
77
|
+
Buffer.from(this.senderKeyStateStructure.senderSigningKey.public, 'base64') :
|
|
78
|
+
this.senderKeyStateStructure.senderSigningKey.public;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getSigningKeyPrivate() {
|
|
82
|
+
return typeof this.senderKeyStateStructure.senderSigningKey.private === 'string' ?
|
|
83
|
+
Buffer.from(this.senderKeyStateStructure.senderSigningKey.private, 'base64') :
|
|
84
|
+
this.senderKeyStateStructure.senderSigningKey.private;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
hasSenderMessageKey(iteration) {
|
|
88
|
+
const list = this.senderKeyStateStructure.senderMessageKeys;
|
|
89
|
+
for (let o = 0; o < list.length; o++) {
|
|
90
|
+
const senderMessageKey = list[o];
|
|
91
|
+
if (senderMessageKey.iteration === iteration) return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
addSenderMessageKey(senderMessageKey) {
|
|
97
|
+
const senderMessageKeyStructure = protobufs.SenderKeyStateStructure.create({
|
|
98
|
+
iteration: senderMessageKey.getIteration(),
|
|
99
|
+
seed: senderMessageKey.getSeed(),
|
|
100
|
+
});
|
|
101
|
+
this.senderKeyStateStructure.senderMessageKeys.push(senderMessageKeyStructure);
|
|
102
|
+
|
|
103
|
+
if (this.senderKeyStateStructure.senderMessageKeys.length > this.MAX_MESSAGE_KEYS) {
|
|
104
|
+
this.senderKeyStateStructure.senderMessageKeys.shift();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
removeSenderMessageKey(iteration) {
|
|
109
|
+
let result = null;
|
|
110
|
+
|
|
111
|
+
this.senderKeyStateStructure.senderMessageKeys = this.senderKeyStateStructure.senderMessageKeys.filter(
|
|
112
|
+
senderMessageKey => {
|
|
113
|
+
if (senderMessageKey.iteration === iteration) result = senderMessageKey;
|
|
114
|
+
return senderMessageKey.iteration !== iteration;
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
if (result != null) {
|
|
119
|
+
return new SenderMessageKey(result.iteration, result.seed);
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
getStructure() {
|
|
125
|
+
return this.senderKeyStateStructure;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
module.exports = SenderKeyState;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const { deriveSecrets } = require('libsignal/src/crypto');
|
|
2
|
+
class SenderMessageKey {
|
|
3
|
+
iteration = 0;
|
|
4
|
+
|
|
5
|
+
iv = Buffer.alloc(0);
|
|
6
|
+
|
|
7
|
+
cipherKey = Buffer.alloc(0);
|
|
8
|
+
|
|
9
|
+
seed = Buffer.alloc(0);
|
|
10
|
+
|
|
11
|
+
constructor(iteration, seed) {
|
|
12
|
+
const derivative = deriveSecrets(seed, Buffer.alloc(32), Buffer.from('WhisperGroup'));
|
|
13
|
+
const keys = new Uint8Array(32);
|
|
14
|
+
keys.set(new Uint8Array(derivative[0].slice(16)));
|
|
15
|
+
keys.set(new Uint8Array(derivative[1].slice(0, 16)), 16);
|
|
16
|
+
this.iv = Buffer.from(derivative[0].slice(0, 16));
|
|
17
|
+
this.cipherKey = Buffer.from(keys.buffer);
|
|
18
|
+
|
|
19
|
+
this.iteration = iteration;
|
|
20
|
+
this.seed = seed;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getIteration() {
|
|
24
|
+
return this.iteration;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getIv() {
|
|
28
|
+
return this.iv;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getCipherKey() {
|
|
32
|
+
return this.cipherKey;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getSeed() {
|
|
36
|
+
return this.seed;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
module.exports = SenderMessageKey;
|
package/index.js
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
const fs=require('fs'),path=require('path');
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class MutablePromise{constructor(){this._state='pending';this._value=undefined;this.promise=new Promise((res,rej)=>{this._resolve=(v)=>{this._state='fulfilled';this._value=v;res(v)};this._reject=(e)=>{this._state='rejected';this._value=e;rej(e)}})};resolve(v){this._resolve(v)};reject(e){this._reject(e)};then(...a){return this.promise.then(...a)};catch(...a){return this.promise.catch(...a)};finally(...a){return this.promise.finally(...a)}}
|
|
9
|
-
module.exports={MutablePromise,default:MutablePromise};
|
|
10
|
-
`);
|
|
11
|
-
// Stub @adiwajshing/keyed-db (can also 404)
|
|
12
|
-
ensureStub('@adiwajshing/keyed-db', {name:'@adiwajshing/keyed-db',version:'0.2.4',main:'index.js'}, `
|
|
13
|
-
class KeyedDB{constructor(){this.map=new Map()}get(k){return this.map.get(k)}set(k,v){this.map.set(k,v)}delete(k){this.map.delete(k)}clear(){this.map.clear()}values(){return [...this.map.values()]}keys(){return [...this.map.keys()]}}
|
|
14
|
-
module.exports={KeyedDB,default:KeyedDB};
|
|
15
|
-
`);
|
|
16
|
-
function showBanner(){
|
|
17
|
-
console.log('\x1b[35m%s\x1b[0m', `
|
|
18
|
-
██████╗███████╗ █████╗ ███████╗███████╗██████╗
|
|
19
|
-
██╔════╝██╔════╝██╔══██╗██╔════╝██╔════╝██╔══██╗
|
|
20
|
-
██║ █████╗ ███████║███████╗█████╗ ██████╔╝
|
|
21
|
-
██║ ██╔══╝ ██╔══██║╚════██║██╔══╝ ██╔══██╗
|
|
22
|
-
╚██████╗███████╗██║ ██║███████║███████╗██║ ██║
|
|
23
|
-
╚═════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝
|
|
24
|
-
`);
|
|
25
|
-
console.log('\x1b[32m CEASER v3.0.2 - BIG LOGO - 169 FILES - cache-manager FIXED - PTERODACTYL FIXED \x1b[0m');
|
|
26
|
-
console.log('\x1b[33m 🔑 Custom: CEASERMD -> CEAS-ERMD WORKS! \x1b[0m');
|
|
27
|
-
}
|
|
28
|
-
showBanner();
|
|
29
|
-
let lib; try{ lib=require('./lib'); }catch(e){ console.error('lib/ missing', e.message); throw e; }
|
|
30
|
-
let makeWASocketLib = lib.default?.makeWASocket || lib.makeWASocket || lib.default || lib;
|
|
31
|
-
function makeFixed(...a){ const s=makeWASocketLib(...a); if(s?.requestPairingCode){ const orig=s.requestPairingCode.bind(s); s.requestPairingCode=async(p,c)=>{ p=p.replace(/\\D/g,''); if(c){ c=c.toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8); if(c.length===8){ try{ return await orig(p,c); }catch{} } } return await orig(p); }; } return s; }
|
|
2
|
+
function stub(p,c){const f=path.join(__dirname,'node_modules',p);if(!fs.existsSync(f)){fs.mkdirSync(f,{recursive:true});fs.writeFileSync(path.join(f,'package.json'),JSON.stringify({name:p,version:'1.0.0',main:'index.js'}));fs.writeFileSync(path.join(f,'index.js'),c);}}
|
|
3
|
+
stub('@blackglory/mutable-promise',`class M{constructor(){this.p=new Promise((r,j)=>{this._r=r;this._j=j})}resolve(v){this._r(v)}reject(e){this._j(e)}then(...a){return this.p.then(...a)}catch(...a){return this.p.catch(...a)}}module.exports={MutablePromise:M,default:M};`);
|
|
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
|
+
console.log('\x1b[35m CEASER v3.0.6 - 169 FILES - FULL \x1b[0m');
|
|
6
|
+
let lib=require('./lib'); let mk=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib;
|
|
7
|
+
function makeFixed(...a){const s=mk(...a);if(s?.requestPairingCode){const o=s.requestPairingCode.bind(s);s.requestPairingCode=async(p,c)=>{p=p.replace(/\\D/g,'');if(c){c=c.toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8);if(c.length===8){try{return await o(p,c)}catch{}}}return await o(p)}; }return s;}
|
|
32
8
|
if(lib.default) lib.default=makeFixed; if(lib.makeWASocket) lib.makeWASocket=makeFixed;
|
|
33
|
-
module.exports={...lib, makeWASocket:makeFixed, default:makeFixed, version:'3.0.
|
|
9
|
+
module.exports={...lib, makeWASocket:makeFixed, default:makeFixed, version:'3.0.6'};
|
package/package.json
CHANGED
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lordceaser-baileys",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "CEASER v3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
|
+
"description": "CEASER v3.0.6 - BIG LOGO - 169 files - FULL deps - Pterodactyl FIXED",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
|
-
"files": [
|
|
7
|
+
"files": [
|
|
8
|
+
"lib/",
|
|
9
|
+
"WAProto/",
|
|
10
|
+
"WASignalGroup/",
|
|
11
|
+
"WABinary/",
|
|
12
|
+
"WAMessage/",
|
|
13
|
+
"WAM/",
|
|
14
|
+
"src/",
|
|
15
|
+
"index.js"
|
|
16
|
+
],
|
|
8
17
|
"dependencies": {
|
|
9
|
-
"axios": "^1.6.0",
|
|
10
|
-
"ws": "^8.14.2",
|
|
11
|
-
"pino": "^8.17.2",
|
|
12
|
-
"protobufjs": "^7.2.5",
|
|
13
|
-
"qrcode-terminal": "^0.12.0",
|
|
14
|
-
"jimp": "^0.22.10",
|
|
15
|
-
"file-type": "^16.5.4",
|
|
16
|
-
"node-cache": "^5.1.2",
|
|
17
|
-
"uuid": "^9.0.0",
|
|
18
|
-
"long": "^5.2.3",
|
|
19
|
-
"lodash": "^4.17.21",
|
|
20
|
-
"fflate": "^0.8.2",
|
|
21
18
|
"cache-manager": "^5.3.2",
|
|
22
|
-
"keyv": "^4.5.4"
|
|
23
|
-
"libphonenumber-js": "^1.10.54",
|
|
24
|
-
"libsignal": "^2.0.1",
|
|
25
|
-
"futoin-hkdf": "^1.5.1",
|
|
26
|
-
"lru-cache": "^7.18.3",
|
|
27
|
-
"music-metadata": "^7.14.0"
|
|
19
|
+
"keyv": "^4.5.4"
|
|
28
20
|
}
|
|
29
|
-
}
|
|
21
|
+
}
|