kage-baileys 25.3.15 → 25.3.17
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/Utils/crypto.js +18 -1
- package/package.json +1 -1
package/lib/Utils/crypto.js
CHANGED
|
@@ -44,11 +44,12 @@ exports.aesEncrypt = aesEncrypt;
|
|
|
44
44
|
exports.aesEncrypWithIV = aesEncrypWithIV;
|
|
45
45
|
exports.hmacSign = hmacSign;
|
|
46
46
|
exports.sha256 = sha256;
|
|
47
|
+
exports.md5 = md5;
|
|
48
|
+
exports.hkdf = hkdf;
|
|
47
49
|
exports.derivePairingCodeKey = derivePairingCodeKey;
|
|
48
50
|
const node_crypto_1 = require("node:crypto");
|
|
49
51
|
const curve = __importStar(require("libsignal/src/curve.js"));
|
|
50
52
|
const index_js_1 = require("../Defaults/index.js");
|
|
51
|
-
const { md5, hkdf } = require('./crypto.js');
|
|
52
53
|
|
|
53
54
|
const { subtle } = globalThis.crypto;
|
|
54
55
|
|
|
@@ -144,6 +145,22 @@ function hmacSign(buffer, key, variant = 'sha256') {
|
|
|
144
145
|
function sha256(buffer) {
|
|
145
146
|
return (0, node_crypto_1.createHash)('sha256').update(buffer).digest();
|
|
146
147
|
}
|
|
148
|
+
|
|
149
|
+
function md5(buffer) {
|
|
150
|
+
return (0, node_crypto_1.createHash)('md5').update(buffer).digest();
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Synchronous HKDF (matches Baileys call signature)
|
|
154
|
+
* hkdf(buffer, expandedLength, { salt, info })
|
|
155
|
+
*/
|
|
156
|
+
function hkdf(buffer, expandedLength, info = {}) {
|
|
157
|
+
const salt = info.salt ? Buffer.from(info.salt) : Buffer.alloc(0);
|
|
158
|
+
const infoBuf = (info.info !== undefined && info.info !== null) ? Buffer.from(info.info) : Buffer.alloc(0);
|
|
159
|
+
const ikm = Buffer.from(buffer instanceof Uint8Array ? buffer : Buffer.from(buffer));
|
|
160
|
+
const derived = (0, node_crypto_1.hkdfSync)('sha256', ikm, salt, infoBuf, expandedLength);
|
|
161
|
+
return Buffer.from(derived);
|
|
162
|
+
}
|
|
163
|
+
|
|
147
164
|
async function derivePairingCodeKey(pairingCode, salt) {
|
|
148
165
|
|
|
149
166
|
const encoder = new TextEncoder();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kage-baileys",
|
|
3
|
-
"version": "25.3.
|
|
3
|
+
"version": "25.3.17",
|
|
4
4
|
"description": "Kage Baileys full merge — Builders + mbuilder + Framework + advanced sticker packs + KAGE pairing + extended WAProto. Multi-device ready. FIXED: all core modules deduplicated, removed third-party libsignal-node fork.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kage-baileys",
|