liangzimixin 0.2.11 → 0.2.14
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/index.cjs +10 -22
- package/dist/index.d.cts +0 -3
- package/dist/setup-entry.cjs +9 -21
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17462,12 +17462,6 @@ var AccountConfigSchema = external_exports.object({
|
|
|
17462
17462
|
* 生产环境: https://cmsp.zdxlz.com:8552
|
|
17463
17463
|
*/
|
|
17464
17464
|
"quantum-url": external_exports.string().url().optional().default("https://cmsp.zdxlz.com:8552"),
|
|
17465
|
-
/**
|
|
17466
|
-
* 🟡 API 基础地址 — 认证/消息/文件等 API 的基础 URL
|
|
17467
|
-
* 联调环境: https://mxpre.zdxlz.com:1443/open-apis/v1
|
|
17468
|
-
* 线上环境: https://imtwo.zdxlz.com/open-apis/v1
|
|
17469
|
-
*/
|
|
17470
|
-
"server-url": external_exports.string().url().optional().default("https://mxpre.zdxlz.com:1443/open-apis/v1"),
|
|
17471
17465
|
/**
|
|
17472
17466
|
* 🟡 Bot 自己的用户 ID — 用于 anti-loop 检查
|
|
17473
17467
|
* 如果不填,需要通过其他 API 在运行时获取。
|
|
@@ -17481,7 +17475,6 @@ var AccountConfigSchema = external_exports.object({
|
|
|
17481
17475
|
quantumAppSecret: raw["quantum-appSecret"],
|
|
17482
17476
|
pin: raw.pin,
|
|
17483
17477
|
quantumUrl: raw["quantum-url"],
|
|
17484
|
-
serverUrl: raw["server-url"],
|
|
17485
17478
|
botUserId: raw.botUserId
|
|
17486
17479
|
}));
|
|
17487
17480
|
var DEFAULT_INTERNAL_CONFIG = {
|
|
@@ -17500,11 +17493,11 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
17500
17493
|
}
|
|
17501
17494
|
},
|
|
17502
17495
|
auth: {
|
|
17503
|
-
serverUrl: process.env.LZMX_AUTH_URL || "https://
|
|
17496
|
+
serverUrl: process.env.LZMX_AUTH_URL || "https://imtwo.zdxlz.com/open-apis/v1",
|
|
17504
17497
|
refreshAheadMs: 3e5
|
|
17505
17498
|
},
|
|
17506
17499
|
crypto: {
|
|
17507
|
-
enabled:
|
|
17500
|
+
enabled: true,
|
|
17508
17501
|
keySource: "env",
|
|
17509
17502
|
envKey: "QUANTUM_ENCRYPTION_KEY"
|
|
17510
17503
|
},
|
|
@@ -17522,9 +17515,6 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
17522
17515
|
};
|
|
17523
17516
|
function buildPluginConfig(accountConfig, internalOverrides) {
|
|
17524
17517
|
const internal = { ...DEFAULT_INTERNAL_CONFIG, ...internalOverrides };
|
|
17525
|
-
if (!process.env.LZMX_AUTH_URL && accountConfig.serverUrl) {
|
|
17526
|
-
internal.auth = { ...internal.auth, serverUrl: accountConfig.serverUrl };
|
|
17527
|
-
}
|
|
17528
17518
|
return {
|
|
17529
17519
|
...internal,
|
|
17530
17520
|
credentials: accountConfig
|
|
@@ -18886,9 +18876,7 @@ var SM4_MODE = {
|
|
|
18886
18876
|
CBC_PKCS7PADDING: 4
|
|
18887
18877
|
};
|
|
18888
18878
|
var DEFAULT_ENCRYPT_MODE = SM4_MODE.CBC_PKCS7PADDING;
|
|
18889
|
-
var require2 = (0, import_node_module.createRequire)(
|
|
18890
|
-
typeof __filename !== "undefined" ? __filename : import_meta.url
|
|
18891
|
-
);
|
|
18879
|
+
var require2 = (0, import_node_module.createRequire)(import_meta.url);
|
|
18892
18880
|
var quantunPlug = null;
|
|
18893
18881
|
try {
|
|
18894
18882
|
quantunPlug = require2("./sdk/index.min.cjs");
|
|
@@ -18905,8 +18893,11 @@ var import_node_path = require("path");
|
|
|
18905
18893
|
var import_node_url = require("url");
|
|
18906
18894
|
var import_meta2 = {};
|
|
18907
18895
|
var log15 = createLogger("crypto/quantum-config-writer");
|
|
18908
|
-
var
|
|
18909
|
-
|
|
18896
|
+
var QUANTUM_JSON_PATH = (0, import_node_path.join)(
|
|
18897
|
+
(0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url)),
|
|
18898
|
+
"sdk",
|
|
18899
|
+
"quantum.json"
|
|
18900
|
+
);
|
|
18910
18901
|
function writeQuantumConfig(credentials) {
|
|
18911
18902
|
const sdkConfig = {
|
|
18912
18903
|
account: credentials.quantumAccount,
|
|
@@ -18980,10 +18971,7 @@ var CryptoEngine = class _CryptoEngine {
|
|
|
18980
18971
|
return;
|
|
18981
18972
|
}
|
|
18982
18973
|
if (!this.plug) {
|
|
18983
|
-
|
|
18984
|
-
this.passthrough = true;
|
|
18985
|
-
this.initialized = true;
|
|
18986
|
-
return;
|
|
18974
|
+
throw new Error("Quantum encryption SDK is missing. Cannot initialize in encryption mode (check dist/index.min.cjs).");
|
|
18987
18975
|
}
|
|
18988
18976
|
if (this.credentials) {
|
|
18989
18977
|
writeQuantumConfig(this.credentials);
|
|
@@ -20517,7 +20505,7 @@ async function startPlugin(accountConfig, internalOverrides) {
|
|
|
20517
20505
|
};
|
|
20518
20506
|
}
|
|
20519
20507
|
var plugin = {
|
|
20520
|
-
id:
|
|
20508
|
+
id: PLUGIN_ID,
|
|
20521
20509
|
name: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
20522
20510
|
description: "Quantum-encrypted IM channel plugin",
|
|
20523
20511
|
register(api) {
|
package/dist/index.d.cts
CHANGED
|
@@ -23,7 +23,6 @@ declare const AccountConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
23
23
|
'quantum-appSecret': z.ZodString;
|
|
24
24
|
pin: z.ZodString;
|
|
25
25
|
'quantum-url': z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
26
|
-
'server-url': z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
27
26
|
botUserId: z.ZodOptional<z.ZodString>;
|
|
28
27
|
}, z.core.$strip>, z.ZodTransform<{
|
|
29
28
|
appId: string;
|
|
@@ -33,7 +32,6 @@ declare const AccountConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
33
32
|
quantumAppSecret: string;
|
|
34
33
|
pin: string;
|
|
35
34
|
quantumUrl: string;
|
|
36
|
-
serverUrl: string;
|
|
37
35
|
botUserId: string | undefined;
|
|
38
36
|
}, {
|
|
39
37
|
appId: string;
|
|
@@ -43,7 +41,6 @@ declare const AccountConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
43
41
|
'quantum-appSecret': string;
|
|
44
42
|
pin: string;
|
|
45
43
|
'quantum-url': string;
|
|
46
|
-
'server-url': string;
|
|
47
44
|
botUserId?: string | undefined;
|
|
48
45
|
}>>;
|
|
49
46
|
type AccountConfig = z.output<typeof AccountConfigSchema>;
|
package/dist/setup-entry.cjs
CHANGED
|
@@ -18018,12 +18018,6 @@ var AccountConfigSchema = external_exports.object({
|
|
|
18018
18018
|
* 生产环境: https://cmsp.zdxlz.com:8552
|
|
18019
18019
|
*/
|
|
18020
18020
|
"quantum-url": external_exports.string().url().optional().default("https://cmsp.zdxlz.com:8552"),
|
|
18021
|
-
/**
|
|
18022
|
-
* 🟡 API 基础地址 — 认证/消息/文件等 API 的基础 URL
|
|
18023
|
-
* 联调环境: https://mxpre.zdxlz.com:1443/open-apis/v1
|
|
18024
|
-
* 线上环境: https://imtwo.zdxlz.com/open-apis/v1
|
|
18025
|
-
*/
|
|
18026
|
-
"server-url": external_exports.string().url().optional().default("https://mxpre.zdxlz.com:1443/open-apis/v1"),
|
|
18027
18021
|
/**
|
|
18028
18022
|
* 🟡 Bot 自己的用户 ID — 用于 anti-loop 检查
|
|
18029
18023
|
* 如果不填,需要通过其他 API 在运行时获取。
|
|
@@ -18037,7 +18031,6 @@ var AccountConfigSchema = external_exports.object({
|
|
|
18037
18031
|
quantumAppSecret: raw["quantum-appSecret"],
|
|
18038
18032
|
pin: raw.pin,
|
|
18039
18033
|
quantumUrl: raw["quantum-url"],
|
|
18040
|
-
serverUrl: raw["server-url"],
|
|
18041
18034
|
botUserId: raw.botUserId
|
|
18042
18035
|
}));
|
|
18043
18036
|
var DEFAULT_INTERNAL_CONFIG = {
|
|
@@ -18056,11 +18049,11 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
18056
18049
|
}
|
|
18057
18050
|
},
|
|
18058
18051
|
auth: {
|
|
18059
|
-
serverUrl: process.env.LZMX_AUTH_URL || "https://
|
|
18052
|
+
serverUrl: process.env.LZMX_AUTH_URL || "https://imtwo.zdxlz.com/open-apis/v1",
|
|
18060
18053
|
refreshAheadMs: 3e5
|
|
18061
18054
|
},
|
|
18062
18055
|
crypto: {
|
|
18063
|
-
enabled:
|
|
18056
|
+
enabled: true,
|
|
18064
18057
|
keySource: "env",
|
|
18065
18058
|
envKey: "QUANTUM_ENCRYPTION_KEY"
|
|
18066
18059
|
},
|
|
@@ -18078,9 +18071,6 @@ var DEFAULT_INTERNAL_CONFIG = {
|
|
|
18078
18071
|
};
|
|
18079
18072
|
function buildPluginConfig(accountConfig, internalOverrides) {
|
|
18080
18073
|
const internal = { ...DEFAULT_INTERNAL_CONFIG, ...internalOverrides };
|
|
18081
|
-
if (!process.env.LZMX_AUTH_URL && accountConfig.serverUrl) {
|
|
18082
|
-
internal.auth = { ...internal.auth, serverUrl: accountConfig.serverUrl };
|
|
18083
|
-
}
|
|
18084
18074
|
return {
|
|
18085
18075
|
...internal,
|
|
18086
18076
|
credentials: accountConfig
|
|
@@ -18098,9 +18088,7 @@ var SM4_MODE = {
|
|
|
18098
18088
|
CBC_PKCS7PADDING: 4
|
|
18099
18089
|
};
|
|
18100
18090
|
var DEFAULT_ENCRYPT_MODE = SM4_MODE.CBC_PKCS7PADDING;
|
|
18101
|
-
var require2 = (0, import_node_module.createRequire)(
|
|
18102
|
-
typeof __filename !== "undefined" ? __filename : import_meta.url
|
|
18103
|
-
);
|
|
18091
|
+
var require2 = (0, import_node_module.createRequire)(import_meta.url);
|
|
18104
18092
|
var quantunPlug = null;
|
|
18105
18093
|
try {
|
|
18106
18094
|
quantunPlug = require2("./sdk/index.min.cjs");
|
|
@@ -18117,8 +18105,11 @@ var import_node_path = require("path");
|
|
|
18117
18105
|
var import_node_url = require("url");
|
|
18118
18106
|
var import_meta2 = {};
|
|
18119
18107
|
var log6 = createLogger("crypto/quantum-config-writer");
|
|
18120
|
-
var
|
|
18121
|
-
|
|
18108
|
+
var QUANTUM_JSON_PATH = (0, import_node_path.join)(
|
|
18109
|
+
(0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url)),
|
|
18110
|
+
"sdk",
|
|
18111
|
+
"quantum.json"
|
|
18112
|
+
);
|
|
18122
18113
|
function writeQuantumConfig(credentials) {
|
|
18123
18114
|
const sdkConfig = {
|
|
18124
18115
|
account: credentials.quantumAccount,
|
|
@@ -18192,10 +18183,7 @@ var CryptoEngine = class _CryptoEngine {
|
|
|
18192
18183
|
return;
|
|
18193
18184
|
}
|
|
18194
18185
|
if (!this.plug) {
|
|
18195
|
-
|
|
18196
|
-
this.passthrough = true;
|
|
18197
|
-
this.initialized = true;
|
|
18198
|
-
return;
|
|
18186
|
+
throw new Error("Quantum encryption SDK is missing. Cannot initialize in encryption mode (check dist/index.min.cjs).");
|
|
18199
18187
|
}
|
|
18200
18188
|
if (this.credentials) {
|
|
18201
18189
|
writeQuantumConfig(this.credentials);
|