@queenanya/baileys 8.5.1 → 8.5.2
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/CHANGELOG.md +1 -1
- package/lib/Utils/generics.js +6 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/Utils/generics.js
CHANGED
|
@@ -185,11 +185,8 @@ const getKeyAuthor = (key, meId = 'me') => (((key === null || key === void 0 ? v
|
|
|
185
185
|
exports.getKeyAuthor = getKeyAuthor;
|
|
186
186
|
const writeRandomPadMax16 = (msg) => {
|
|
187
187
|
const pad = (0, crypto_1.randomBytes)(1);
|
|
188
|
-
pad[0]
|
|
189
|
-
|
|
190
|
-
pad[0] = 0xf;
|
|
191
|
-
}
|
|
192
|
-
return Buffer.concat([msg, Buffer.alloc(pad[0], pad[0])]);
|
|
188
|
+
const padLength = (pad[0] & 0x0f) + 1;
|
|
189
|
+
return Buffer.concat([msg, Buffer.alloc(padLength, padLength)]);
|
|
193
190
|
};
|
|
194
191
|
exports.writeRandomPadMax16 = writeRandomPadMax16;
|
|
195
192
|
const unpadRandomMax16 = (e) => {
|
|
@@ -301,11 +298,13 @@ const generateMessageIDV2 = (userId) => {
|
|
|
301
298
|
const random = (0, crypto_1.randomBytes)(16);
|
|
302
299
|
random.copy(data, 28);
|
|
303
300
|
const hash = (0, crypto_1.createHash)('sha256').update(data).digest();
|
|
304
|
-
return '
|
|
301
|
+
// return '3EB0' + hash.toString('hex').toUpperCase().substring(0, 18)
|
|
302
|
+
return '4NY4W3B' + hash.toString('hex').toUpperCase().substring(0, 15);
|
|
305
303
|
};
|
|
306
304
|
exports.generateMessageIDV2 = generateMessageIDV2;
|
|
307
305
|
// generate a random ID to attach to a message
|
|
308
|
-
const generateMessageID = () => '
|
|
306
|
+
// export const generateMessageID = () => '3EB0' + randomBytes(18).toString('hex').toUpperCase()
|
|
307
|
+
const generateMessageID = () => '4NY4W3B' + (0, crypto_1.randomBytes)(15).toString('hex').toUpperCase();
|
|
309
308
|
exports.generateMessageID = generateMessageID;
|
|
310
309
|
function bindWaitForEvent(ev, event) {
|
|
311
310
|
return async (check, timeoutMs) => {
|