@gqb333/based 2.7.72 → 2.7.73
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 +21 -9
- package/package.json +1 -1
package/lib/Signal/libsignal.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
By Gab
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
"use strict";
|
|
2
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
7
|
if (k2 === undefined) k2 = k;
|
|
@@ -66,15 +70,23 @@ function makeLibSignalRepository(auth) {
|
|
|
66
70
|
const addr = jidToSignalProtocolAddress(jid);
|
|
67
71
|
const session = new libsignal.SessionCipher(storage, addr);
|
|
68
72
|
let result;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
try {
|
|
74
|
+
switch (type) {
|
|
75
|
+
case 'pkmsg':
|
|
76
|
+
result = await session.decryptPreKeyWhisperMessage(ciphertext);
|
|
77
|
+
break;
|
|
78
|
+
case 'msg':
|
|
79
|
+
result = await session.decryptWhisperMessage(ciphertext);
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
throw new Error(`Unknown message type: ${type}`);
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
if (error.message === 'Bad MAC') {
|
|
86
|
+
console.log('⚠️ Bad MAC - chiavi corrotte, WhatsApp rinegozia automaticamente');
|
|
87
|
+
return Buffer.alloc(0);
|
|
88
|
+
}
|
|
89
|
+
throw error;
|
|
78
90
|
}
|
|
79
91
|
return result;
|
|
80
92
|
},
|