@wu529778790/open-im 1.11.4-beta.17 → 1.11.4-beta.18
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/dist/clawbot/client.js +11 -8
- package/package.json +1 -1
package/dist/clawbot/client.js
CHANGED
|
@@ -12,7 +12,8 @@ import { createLogger } from '../logger.js';
|
|
|
12
12
|
import { jitteredDelay, isFatalReconnectError, SLOW_PROBE_MS } from '../shared/reconnect.js';
|
|
13
13
|
import { cacheContextToken } from './message-sender.js';
|
|
14
14
|
import { setClawbotContextToken, clearClawbotContextToken } from '../shared/active-chats.js';
|
|
15
|
-
import {
|
|
15
|
+
import { createMediaTargetPath } from '../shared/media-storage.js';
|
|
16
|
+
import { createDecipheriv } from 'node:crypto';
|
|
16
17
|
import { CLAWBOT_POLL_INTERVAL_MS } from '../constants.js';
|
|
17
18
|
const log = createLogger('ClawBot');
|
|
18
19
|
const RECONNECT_DELAYS_MS = [3000, 5000, 10000, 20000, 30000];
|
|
@@ -261,8 +262,8 @@ async function extractImages(msg) {
|
|
|
261
262
|
log.warn('Image item missing full_url/cdn_url');
|
|
262
263
|
continue;
|
|
263
264
|
}
|
|
264
|
-
// AES key:
|
|
265
|
-
const
|
|
265
|
+
// AES key: aeskey 字段是 32 字符 hex(16 字节),需要直接用作 AES-128-CBC key
|
|
266
|
+
const aesKeyHex = imageItem?.aeskey;
|
|
266
267
|
try {
|
|
267
268
|
// Download from CDN
|
|
268
269
|
const response = await fetch(imageUrl, { signal: AbortSignal.timeout(30_000) });
|
|
@@ -271,15 +272,17 @@ async function extractImages(msg) {
|
|
|
271
272
|
continue;
|
|
272
273
|
}
|
|
273
274
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
274
|
-
//
|
|
275
|
+
// 解密:aeskey 是 hex 编码的 16 字节密钥,用 AES-128-CBC 解密
|
|
275
276
|
let decrypted;
|
|
276
|
-
if (
|
|
277
|
+
if (aesKeyHex && aesKeyHex.length === 32) {
|
|
277
278
|
try {
|
|
278
|
-
|
|
279
|
+
const keyBuf = Buffer.from(aesKeyHex, 'hex');
|
|
280
|
+
const iv = keyBuf.subarray(0, 16);
|
|
281
|
+
const decipher = createDecipheriv('aes-128-cbc', keyBuf, iv);
|
|
282
|
+
decrypted = Buffer.concat([decipher.update(buffer), decipher.final()]);
|
|
279
283
|
}
|
|
280
284
|
catch {
|
|
281
|
-
|
|
282
|
-
log.info('AES decryption failed, using raw image data');
|
|
285
|
+
log.info('AES-128 decryption failed, using raw image data');
|
|
283
286
|
decrypted = buffer;
|
|
284
287
|
}
|
|
285
288
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wu529778790/open-im",
|
|
3
|
-
"version": "1.11.4-beta.
|
|
3
|
+
"version": "1.11.4-beta.18",
|
|
4
4
|
"description": "Your AI coding assistant, in every chat app. Multi-platform IM bridge for Claude Code, Codex, and CodeBuddy.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|