xmd-baileys 1.0.7 → 1.0.9
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/Signal/libsignal.js +16 -9
- package/lib/index.js +5 -11
- package/package.json +1 -1
package/lib/Signal/libsignal.js
CHANGED
|
@@ -66,15 +66,22 @@ function makeLibSignalRepository(auth) {
|
|
|
66
66
|
const addr = jidToSignalProtocolAddress(jid);
|
|
67
67
|
const session = new libsignal.SessionCipher(storage, addr);
|
|
68
68
|
let result;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
try {
|
|
70
|
+
switch (type) {
|
|
71
|
+
case 'pkmsg':
|
|
72
|
+
result = await session.decryptPreKeyWhisperMessage(ciphertext);
|
|
73
|
+
break;
|
|
74
|
+
case 'msg':
|
|
75
|
+
result = await session.decryptWhisperMessage(ciphertext);
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
throw new Error(`Unknown message type: ${type}`);
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
81
|
+
if (err.message?.includes('Bad MAC')) {
|
|
82
|
+
throw new Error('SESSION_CIPHER_FAIL');
|
|
83
|
+
}
|
|
84
|
+
throw err;
|
|
78
85
|
}
|
|
79
86
|
return result;
|
|
80
87
|
},
|
package/lib/index.js
CHANGED
|
@@ -2,17 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
const chalk = require("chalk");
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
msg.includes('Closing session:') ||
|
|
11
|
-
msg.includes('SessionEntry')
|
|
12
|
-
)) return;
|
|
13
|
-
if (typeof msg === 'object' && msg?._chains) return;
|
|
14
|
-
originalLog.apply(console, args);
|
|
15
|
-
};
|
|
5
|
+
const _ol = console.log, _ow = console.warn, _oi = console.info;
|
|
6
|
+
const _sf = (m) => typeof m === 'string' && (m.includes('Closing') || m.includes('Session') || m.includes('Bad MAC') || m.includes('decrypt')) || (typeof m === 'object' && m?._chains);
|
|
7
|
+
console.log = (...a) => { if (!_sf(a[0])) _ol.apply(console, a); };
|
|
8
|
+
console.warn = (...a) => { if (!_sf(a[0])) _ow.apply(console, a); };
|
|
9
|
+
console.info = (...a) => { if (!_sf(a[0])) _oi.apply(console, a); };
|
|
16
10
|
|
|
17
11
|
console.log(chalk.whiteBright("\n• WELCOME TO BWM XMD WORLD"));
|
|
18
12
|
console.log(chalk.cyan("• Creator : ") + chalk.greenBright(" Mr Ibrahim Adams"));
|