module-develop-kit 0.5.14 → 1.0.0
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/commonjs-virtual-dir/_commonjsHelpers.js +4 -6
- package/dist/commonjs-virtual-dir/index.js +3 -3
- package/dist/commonjs-virtual-dir/index2.js +5 -3
- package/dist/commonjs-virtual-dir/index3.js +3 -5
- package/dist/commonjs-virtual-dir/index4.js +2 -5
- package/dist/commonjs-virtual-dir/index5.js +2 -2
- package/dist/commonjs-virtual-dir/index6.js +2 -2
- package/dist/main.d.ts +74 -104
- package/dist/main.js +16 -20
- package/dist/src/outside-call/utils.js +1 -1
- package/dist/src/shield/crypto/const.js +4 -0
- package/dist/src/shield/crypto/index.js +53 -0
- package/dist/src/shield/crypto/sm2.js +7 -0
- package/dist/src/shield/crypto/sm4.js +15 -0
- package/dist/src/shield/crypto/util.js +29 -0
- package/dist/src/shield/html-sanitize.js +21 -0
- package/dist/vendor/base64-js/index.js +1 -1
- package/dist/vendor/jsbn/index.js +1 -1
- package/dist/vendor/sdp-transform/lib/index.js +1 -1
- package/package.json +3 -3
- package/dist/commonjs-virtual-dir/_commonjs-dynamic-modules.js +0 -6
- package/dist/commonjs-virtual-dir/aes.js +0 -4
- package/dist/commonjs-virtual-dir/blowfish.js +0 -4
- package/dist/commonjs-virtual-dir/cipher-core.js +0 -4
- package/dist/commonjs-virtual-dir/core.js +0 -4
- package/dist/commonjs-virtual-dir/enc-base64.js +0 -4
- package/dist/commonjs-virtual-dir/enc-base64url.js +0 -4
- package/dist/commonjs-virtual-dir/enc-utf16.js +0 -4
- package/dist/commonjs-virtual-dir/evpkdf.js +0 -4
- package/dist/commonjs-virtual-dir/format-hex.js +0 -4
- package/dist/commonjs-virtual-dir/hmac.js +0 -4
- package/dist/commonjs-virtual-dir/index7.js +0 -4
- package/dist/commonjs-virtual-dir/index8.js +0 -4
- package/dist/commonjs-virtual-dir/lib-typedarrays.js +0 -4
- package/dist/commonjs-virtual-dir/md5.js +0 -4
- package/dist/commonjs-virtual-dir/mode-cfb.js +0 -4
- package/dist/commonjs-virtual-dir/mode-ctr-gladman.js +0 -4
- package/dist/commonjs-virtual-dir/mode-ctr.js +0 -4
- package/dist/commonjs-virtual-dir/mode-ecb.js +0 -4
- package/dist/commonjs-virtual-dir/mode-ofb.js +0 -4
- package/dist/commonjs-virtual-dir/pad-ansix923.js +0 -4
- package/dist/commonjs-virtual-dir/pad-iso10126.js +0 -4
- package/dist/commonjs-virtual-dir/pad-iso97971.js +0 -4
- package/dist/commonjs-virtual-dir/pad-nopadding.js +0 -4
- package/dist/commonjs-virtual-dir/pad-zeropadding.js +0 -4
- package/dist/commonjs-virtual-dir/pbkdf2.js +0 -4
- package/dist/commonjs-virtual-dir/rabbit-legacy.js +0 -4
- package/dist/commonjs-virtual-dir/rabbit.js +0 -4
- package/dist/commonjs-virtual-dir/rc4.js +0 -4
- package/dist/commonjs-virtual-dir/ripemd160.js +0 -4
- package/dist/commonjs-virtual-dir/sha1.js +0 -4
- package/dist/commonjs-virtual-dir/sha224.js +0 -4
- package/dist/commonjs-virtual-dir/sha256.js +0 -4
- package/dist/commonjs-virtual-dir/sha3.js +0 -4
- package/dist/commonjs-virtual-dir/sha384.js +0 -4
- package/dist/commonjs-virtual-dir/sha512.js +0 -4
- package/dist/commonjs-virtual-dir/tripledes.js +0 -4
- package/dist/commonjs-virtual-dir/x64-core.js +0 -4
- package/dist/src/shield/crypto.js +0 -28
- package/dist/src/shield/index.js +0 -59
- package/dist/vendor/crypto-js/aes.js +0 -69
- package/dist/vendor/crypto-js/blowfish.js +0 -1131
- package/dist/vendor/crypto-js/cipher-core.js +0 -544
- package/dist/vendor/crypto-js/core.js +0 -508
- package/dist/vendor/crypto-js/enc-base64.js +0 -80
- package/dist/vendor/crypto-js/enc-base64url.js +0 -87
- package/dist/vendor/crypto-js/enc-utf16.js +0 -99
- package/dist/vendor/crypto-js/evpkdf.js +0 -70
- package/dist/vendor/crypto-js/format-hex.js +0 -53
- package/dist/vendor/crypto-js/hmac.js +0 -83
- package/dist/vendor/crypto-js/index.js +0 -49
- package/dist/vendor/crypto-js/lib-typedarrays.js +0 -27
- package/dist/vendor/crypto-js/md5.js +0 -71
- package/dist/vendor/crypto-js/mode-cfb.js +0 -36
- package/dist/vendor/crypto-js/mode-ctr-gladman.js +0 -45
- package/dist/vendor/crypto-js/mode-ctr.js +0 -28
- package/dist/vendor/crypto-js/mode-ecb.js +0 -27
- package/dist/vendor/crypto-js/mode-ofb.js +0 -26
- package/dist/vendor/crypto-js/pad-ansix923.js +0 -25
- package/dist/vendor/crypto-js/pad-iso10126.js +0 -25
- package/dist/vendor/crypto-js/pad-iso97971.js +0 -23
- package/dist/vendor/crypto-js/pad-nopadding.js +0 -21
- package/dist/vendor/crypto-js/pad-zeropadding.js +0 -28
- package/dist/vendor/crypto-js/pbkdf2.js +0 -74
- package/dist/vendor/crypto-js/rabbit-legacy.js +0 -73
- package/dist/vendor/crypto-js/rabbit.js +0 -75
- package/dist/vendor/crypto-js/rc4.js +0 -63
- package/dist/vendor/crypto-js/ripemd160.js +0 -398
- package/dist/vendor/crypto-js/sha1.js +0 -49
- package/dist/vendor/crypto-js/sha224.js +0 -36
- package/dist/vendor/crypto-js/sha256.js +0 -57
- package/dist/vendor/crypto-js/sha3.js +0 -116
- package/dist/vendor/crypto-js/sha384.js +0 -37
- package/dist/vendor/crypto-js/sha512.js +0 -147
- package/dist/vendor/crypto-js/tripledes.js +0 -729
- package/dist/vendor/crypto-js/x64-core.js +0 -235
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
function f(e) {
|
|
1
|
+
function u(e) {
|
|
3
2
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
3
|
}
|
|
5
|
-
function
|
|
4
|
+
function c(e) {
|
|
6
5
|
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
|
|
7
6
|
var n = e.default;
|
|
8
7
|
if (typeof n == "function") {
|
|
@@ -27,7 +26,6 @@ function l(e) {
|
|
|
27
26
|
}), t;
|
|
28
27
|
}
|
|
29
28
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
f as getDefaultExportFromCjs
|
|
29
|
+
c as getAugmentedNamespace,
|
|
30
|
+
u as getDefaultExportFromCjs
|
|
33
31
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as o } from "../vendor/sdp-transform/lib/index.js";
|
|
3
|
+
var t = o();
|
|
4
|
+
const a = /* @__PURE__ */ r(t);
|
|
3
5
|
export {
|
|
4
|
-
|
|
6
|
+
a as default
|
|
5
7
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
var t = o();
|
|
4
|
-
const s = /* @__PURE__ */ r(t);
|
|
1
|
+
import { __require as r } from "../vendor/gm-crypt/index.js";
|
|
2
|
+
var p = r();
|
|
5
3
|
export {
|
|
6
|
-
|
|
4
|
+
p as g
|
|
7
5
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -1,31 +1,18 @@
|
|
|
1
|
-
import { default as default_2 } from 'crypto-js';
|
|
2
1
|
import { Ref } from 'vue';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} key - AES解密所需的密钥,作为字符串提供。
|
|
12
|
-
* @param {string | CryptoJS.lib.CipherParams} str - 待解密的字符串或CipherParams对象。
|
|
13
|
-
* @param {string} iv - 初始化向量,用于AES解密,作为字符串提供。
|
|
14
|
-
* @returns {string} 返回解密后的字符串,结果将以UTF-8编码格式呈现。
|
|
4
|
+
* 防重放攻击策略
|
|
5
|
+
* @param uid
|
|
6
|
+
* @param salt
|
|
7
|
+
* @param ts
|
|
8
|
+
* @param data
|
|
9
|
+
* @param headers
|
|
15
10
|
*/
|
|
16
|
-
export declare
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* 加密时需要提供密钥、待加密的数据以及初始化向量(IV)。
|
|
22
|
-
*
|
|
23
|
-
* @param {string} key - 用于加密的密钥,必须为字符串类型。
|
|
24
|
-
* @param {string | CryptoJS.lib.WordArray} str - 待加密的字符串或WordArray对象。
|
|
25
|
-
* @param {string} iv - 初始化向量,必须为字符串类型,用于增强加密的安全性。
|
|
26
|
-
* @returns {string} 返回加密后的字符串,结果为Base64编码格式。
|
|
27
|
-
*/
|
|
28
|
-
export declare const aesEncryptString: (key: string, str: string | default_2.lib.WordArray, iv: string) => string;
|
|
11
|
+
export declare function antiReplyAttackStrategy({ uid, salt, ts, data, ...headers }: IAntiReplyAttackStrategy): {
|
|
12
|
+
"X-Sign-Timestamp": string;
|
|
13
|
+
"X-Sign-Nonce": string;
|
|
14
|
+
"X-Sign-Client": string;
|
|
15
|
+
};
|
|
29
16
|
|
|
30
17
|
/**
|
|
31
18
|
* 用于格式化输出会话过程中的日志信息
|
|
@@ -36,18 +23,6 @@ export declare const CallLogger: {
|
|
|
36
23
|
error(message: unknown, ...args: unknown[]): void;
|
|
37
24
|
};
|
|
38
25
|
|
|
39
|
-
/**
|
|
40
|
-
* 创建带有签名信息的请求头对象。
|
|
41
|
-
* 该方法根据传入的参数生成时间戳、随机数和签名,并将它们添加到自定义请求头中。
|
|
42
|
-
*
|
|
43
|
-
* @return 包含签名信息和自定义请求头的完整请求头对象。
|
|
44
|
-
*/
|
|
45
|
-
export declare function createHeaders({ uid, salt, ts, data, ...headers }: ICreateHeaders): {
|
|
46
|
-
"X-Sign-Timestamp": string;
|
|
47
|
-
"X-Sign-Nonce": string;
|
|
48
|
-
"X-Sign-Client": string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
26
|
export declare enum ECallStatus {
|
|
52
27
|
/**
|
|
53
28
|
* 正在接听中
|
|
@@ -79,6 +54,14 @@ export declare enum ECallStatus {
|
|
|
79
54
|
RECONNECT = "reconnect"
|
|
80
55
|
}
|
|
81
56
|
|
|
57
|
+
declare enum EHeaderKey {
|
|
58
|
+
publicKey = "X-Public-Key",
|
|
59
|
+
encryptIv = "X-Encrypted-Iv",
|
|
60
|
+
encryptKey = "X-Encrypted-Key",
|
|
61
|
+
encryptIvLow = "x-encrypted-iv",
|
|
62
|
+
encryptKeyLow = "x-encrypted-key"
|
|
63
|
+
}
|
|
64
|
+
|
|
82
65
|
export declare const EMIT_EVENT_NAME: {
|
|
83
66
|
UPDATE_STATUS: string;
|
|
84
67
|
};
|
|
@@ -123,21 +106,35 @@ export declare interface EventBusProps {
|
|
|
123
106
|
|
|
124
107
|
declare type EventFnc = (...args: any) => void;
|
|
125
108
|
|
|
126
|
-
/**
|
|
127
|
-
* 生成指定长度的随机字符串。
|
|
128
|
-
* 该函数通过从包含大小写字母和数字的字符集合中随机选取字符,拼接成所需长度的字符串。
|
|
129
|
-
* 参数 length 必须为正整数,表示生成的随机字符串的长度。
|
|
130
|
-
* 返回值是一个由大小写字母和数字组成的随机字符串。
|
|
131
|
-
* 如果传入的 length 小于等于 0,则返回的字符串可能为空。
|
|
132
|
-
*/
|
|
133
|
-
export declare const generateRandomString: (length: number) => string;
|
|
134
|
-
|
|
135
109
|
/**
|
|
136
110
|
* 安全的解析html内容 防止xss攻击
|
|
137
111
|
* @param input 输入的html内容
|
|
138
112
|
*/
|
|
139
113
|
export declare function htmlSanitize(input: string): string;
|
|
140
114
|
|
|
115
|
+
export declare interface IAntiReplyAttackStrategy {
|
|
116
|
+
/**
|
|
117
|
+
* 用户唯一标识符,用于参与签名的生成
|
|
118
|
+
*/
|
|
119
|
+
uid: string;
|
|
120
|
+
/**
|
|
121
|
+
* 加密盐值,用于增强签名的安全性
|
|
122
|
+
*/
|
|
123
|
+
salt: string;
|
|
124
|
+
/**
|
|
125
|
+
* 时间戳偏移量,用于调整当前时间戳的值
|
|
126
|
+
*/
|
|
127
|
+
ts: number;
|
|
128
|
+
/**
|
|
129
|
+
* 待传输的数据对象,非必填
|
|
130
|
+
*/
|
|
131
|
+
data?: TData;
|
|
132
|
+
/**
|
|
133
|
+
* 其他header的内容
|
|
134
|
+
*/
|
|
135
|
+
[key: string]: TData;
|
|
136
|
+
}
|
|
137
|
+
|
|
141
138
|
/**
|
|
142
139
|
* jssip、音频播放相关配置信息
|
|
143
140
|
*/
|
|
@@ -205,30 +202,12 @@ export declare interface ICallOptions {
|
|
|
205
202
|
call: string;
|
|
206
203
|
}
|
|
207
204
|
|
|
208
|
-
declare interface
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
*/
|
|
212
|
-
uid: string;
|
|
213
|
-
/**
|
|
214
|
-
* 加密盐值,用于增强签名的安全性
|
|
215
|
-
*/
|
|
216
|
-
salt: string;
|
|
217
|
-
/**
|
|
218
|
-
* 时间戳偏移量,用于调整当前时间戳的值
|
|
219
|
-
*/
|
|
220
|
-
ts: number;
|
|
221
|
-
/**
|
|
222
|
-
* 待传输的数据对象,非必填
|
|
223
|
-
*/
|
|
224
|
-
data?: TData;
|
|
225
|
-
/**
|
|
226
|
-
* 其他header的内容
|
|
227
|
-
*/
|
|
228
|
-
[key: string]: TData;
|
|
205
|
+
export declare interface IResponseDataEncryptionStep {
|
|
206
|
+
data: string;
|
|
207
|
+
headers: Record<EHeaderKey, string>;
|
|
229
208
|
}
|
|
230
209
|
|
|
231
|
-
declare interface ISm4Params {
|
|
210
|
+
export declare interface ISm4Params {
|
|
232
211
|
/**
|
|
233
212
|
* 解密向量
|
|
234
213
|
*/
|
|
@@ -237,13 +216,31 @@ declare interface ISm4Params {
|
|
|
237
216
|
* 解密密钥
|
|
238
217
|
*/
|
|
239
218
|
key: string;
|
|
240
|
-
/**
|
|
241
|
-
* 解密模式
|
|
242
|
-
* @default cbc
|
|
243
|
-
*/
|
|
244
|
-
mode?: "cbc" | "ecb";
|
|
245
219
|
}
|
|
246
220
|
|
|
221
|
+
/**
|
|
222
|
+
* 请求数据加密
|
|
223
|
+
* @param publicKey 公钥
|
|
224
|
+
* @param _data 数据
|
|
225
|
+
*/
|
|
226
|
+
export declare function requestDataEncryption(publicKey: string, _data?: TData): {
|
|
227
|
+
headers: {
|
|
228
|
+
"X-Encrypted-Iv": string;
|
|
229
|
+
"X-Encrypted-Key": string;
|
|
230
|
+
};
|
|
231
|
+
data: {
|
|
232
|
+
body: string;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 响应数据解密
|
|
238
|
+
* @param stepCb
|
|
239
|
+
*/
|
|
240
|
+
export declare function responseDataEncryption<T>(stepCb: (_headers: {
|
|
241
|
+
[EHeaderKey.publicKey]: string;
|
|
242
|
+
}) => Promise<IResponseDataEncryptionStep>): Promise<T>;
|
|
243
|
+
|
|
247
244
|
/**
|
|
248
245
|
* sip code对应的的状态,优先处理 code 对应的提示文案,如果不存在则按照 causes 状态去处理
|
|
249
246
|
*/
|
|
@@ -299,47 +296,20 @@ declare interface SipAccount {
|
|
|
299
296
|
password: string;
|
|
300
297
|
}
|
|
301
298
|
|
|
302
|
-
/**
|
|
303
|
-
* SM4解密
|
|
304
|
-
* @param data 解密数据
|
|
305
|
-
* @param params 解密参数
|
|
306
|
-
*/
|
|
307
|
-
export declare const sm4Decrypt: (data: string, params: ISm4Params) => string;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* SM4加密
|
|
311
|
-
* @param data 加密数据
|
|
312
|
-
* @param params 加密参数
|
|
313
|
-
*/
|
|
314
|
-
export declare const sm4Encrypt: (data: string, params: ISm4Params) => string;
|
|
315
|
-
|
|
316
299
|
/**
|
|
317
300
|
* 禁用用户debugger
|
|
318
301
|
*/
|
|
319
302
|
export declare const startNoDebugger: () => void;
|
|
320
303
|
|
|
321
|
-
declare type TData = _TData | _TData[];
|
|
304
|
+
export declare type TData = _TData | _TData[];
|
|
322
305
|
|
|
323
306
|
declare type _TData = null | undefined | number | string | Record<string, any>;
|
|
324
307
|
|
|
325
|
-
declare type
|
|
308
|
+
export declare type TNullable<T> = T | null;
|
|
326
309
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
* @param _data - 待加密的数据对象,默认为undefined。
|
|
331
|
-
* @param type - 加密算法类型,可选值包括"sm4"和"ase",默认使用"ase"。
|
|
332
|
-
* @returns 返回一个对象,包含headers(含有初始化向量iv及Content-Type)和data(含有加密后的body),适用于HTTP请求的格式。
|
|
333
|
-
*/
|
|
334
|
-
export declare function transmissionDataEncryption(key: string, _data?: TData, type?: TEncryptionType): {
|
|
335
|
-
headers: {
|
|
336
|
-
iv: string;
|
|
337
|
-
"Content-Type": string;
|
|
338
|
-
};
|
|
339
|
-
data: {
|
|
340
|
-
body: string;
|
|
341
|
-
};
|
|
342
|
-
};
|
|
310
|
+
export declare type TObj<K extends keyof any = string, T = any> = Record<K, T>;
|
|
311
|
+
|
|
312
|
+
export declare type TUndefinable<T> = T | undefined;
|
|
343
313
|
|
|
344
314
|
/**
|
|
345
315
|
* 打电话
|
package/dist/main.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { useCall as e } from "./src/outside-call/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { startNoDebugger as
|
|
5
|
-
import { EventBus as
|
|
6
|
-
import { CallLogger as
|
|
7
|
-
import { ECallStatus as
|
|
2
|
+
import { antiReplyAttackStrategy as a, requestDataEncryption as E, responseDataEncryption as p } from "./src/shield/crypto/index.js";
|
|
3
|
+
import { htmlSanitize as l } from "./src/shield/html-sanitize.js";
|
|
4
|
+
import { startNoDebugger as n } from "./src/shield/no-debugger.js";
|
|
5
|
+
import { EventBus as s } from "./src/utils/eventBus.js";
|
|
6
|
+
import { CallLogger as _ } from "./src/outside-call/utils.js";
|
|
7
|
+
import { ECallStatus as i, EMIT_EVENT_NAME as u, SIP_CODE_MESSAGE as C, SIP_ERROR_CAUSES as y } from "./src/outside-call/constants.js";
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
_ as CallLogger,
|
|
10
|
+
i as ECallStatus,
|
|
11
11
|
u as EMIT_EVENT_NAME,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
g as sm4Decrypt,
|
|
21
|
-
i as sm4Encrypt,
|
|
22
|
-
l as startNoDebugger,
|
|
23
|
-
n as transmissionDataEncryption,
|
|
12
|
+
s as EventBus,
|
|
13
|
+
C as SIP_CODE_MESSAGE,
|
|
14
|
+
y as SIP_ERROR_CAUSES,
|
|
15
|
+
a as antiReplyAttackStrategy,
|
|
16
|
+
l as htmlSanitize,
|
|
17
|
+
E as requestDataEncryption,
|
|
18
|
+
p as responseDataEncryption,
|
|
19
|
+
n as startNoDebugger,
|
|
24
20
|
e as useCall
|
|
25
21
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { s as m } from "../../../commonjs-virtual-dir/index.js";
|
|
2
|
+
import { EHeaderKey as a } from "./const.js";
|
|
3
|
+
import { sm2Encrypt as d, generateKeyPairHex as g, sm2Decrypt as u } from "./sm2.js";
|
|
4
|
+
import { sm4Encrypt as K, sm4Decrypt as S } from "./sm4.js";
|
|
5
|
+
import { hexToBase64 as f, generateRandomString as p, base64ToHex as E, dataToStr as v } from "./util.js";
|
|
6
|
+
function $(o, c) {
|
|
7
|
+
const e = p(), n = p(), t = {
|
|
8
|
+
body: K(
|
|
9
|
+
{
|
|
10
|
+
key: e,
|
|
11
|
+
iv: n
|
|
12
|
+
},
|
|
13
|
+
c
|
|
14
|
+
)
|
|
15
|
+
}, r = f(d(o, e));
|
|
16
|
+
return {
|
|
17
|
+
headers: {
|
|
18
|
+
"X-Encrypted-Iv": n,
|
|
19
|
+
"X-Encrypted-Key": r
|
|
20
|
+
},
|
|
21
|
+
data: t
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async function h(o) {
|
|
25
|
+
const { publicKey: c, privateKey: e } = g(), { data: n, headers: t } = await o({ "X-Public-Key": c }), r = t[a.encryptIv] || t[a.encryptIvLow], s = t[a.encryptKey] || t[a.encryptKeyLow], y = u(e, E(s)), i = S(
|
|
26
|
+
{
|
|
27
|
+
iv: r,
|
|
28
|
+
key: y
|
|
29
|
+
},
|
|
30
|
+
n
|
|
31
|
+
);
|
|
32
|
+
return JSON.parse(i);
|
|
33
|
+
}
|
|
34
|
+
function k({
|
|
35
|
+
uid: o = "",
|
|
36
|
+
salt: c = "",
|
|
37
|
+
ts: e = 0,
|
|
38
|
+
data: n = "",
|
|
39
|
+
...t
|
|
40
|
+
}) {
|
|
41
|
+
const r = Date.now() + e, s = Math.random().toString(36).substring(2, 15), y = `${r}${o}${s}${v(n)}${c}`, i = m.sm3(y);
|
|
42
|
+
return {
|
|
43
|
+
...t,
|
|
44
|
+
"X-Sign-Timestamp": String(r),
|
|
45
|
+
"X-Sign-Nonce": s,
|
|
46
|
+
"X-Sign-Client": i
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
k as antiReplyAttackStrategy,
|
|
51
|
+
$ as requestDataEncryption,
|
|
52
|
+
h as responseDataEncryption
|
|
53
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { s as o } from "../../../commonjs-virtual-dir/index.js";
|
|
2
|
+
const c = o.sm2.generateKeyPairHex, s = 1, a = (e, r) => `04${o.sm2.doEncrypt(r, e.toLowerCase(), s)}`, p = (e, r) => o.sm2.doDecrypt(r.toLowerCase().replace(/^04/, ""), e.toLowerCase(), s);
|
|
3
|
+
export {
|
|
4
|
+
c as generateKeyPairHex,
|
|
5
|
+
p as sm2Decrypt,
|
|
6
|
+
a as sm2Encrypt
|
|
7
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { g as o } from "../../../commonjs-virtual-dir/index3.js";
|
|
2
|
+
import { dataToStr as r } from "./util.js";
|
|
3
|
+
const c = "cbc", n = (t, e) => new o.sm4({
|
|
4
|
+
key: t.key,
|
|
5
|
+
iv: t.iv,
|
|
6
|
+
mode: c
|
|
7
|
+
}).decrypt(r(e)), p = (t, e) => new o.sm4({
|
|
8
|
+
key: t.key,
|
|
9
|
+
iv: t.iv,
|
|
10
|
+
mode: c
|
|
11
|
+
}).encrypt(r(e));
|
|
12
|
+
export {
|
|
13
|
+
n as sm4Decrypt,
|
|
14
|
+
p as sm4Encrypt
|
|
15
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function o(n) {
|
|
2
|
+
return typeof n == "object" ? JSON.stringify(n ?? {}) : typeof n == "number" ? String(n) : n ?? "";
|
|
3
|
+
}
|
|
4
|
+
const i = (n = 16) => {
|
|
5
|
+
const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
6
|
+
let e = "";
|
|
7
|
+
for (let t = 0; t < n; t++)
|
|
8
|
+
e += r.charAt(Math.floor(Math.random() * r.length));
|
|
9
|
+
return e;
|
|
10
|
+
};
|
|
11
|
+
function a(n) {
|
|
12
|
+
const r = new Uint8Array(n.length / 2);
|
|
13
|
+
for (let t = 0; t < n.length; t += 2)
|
|
14
|
+
r[t / 2] = parseInt(n.slice(t, t + 2), 16);
|
|
15
|
+
const e = String.fromCharCode(...r);
|
|
16
|
+
return btoa(e);
|
|
17
|
+
}
|
|
18
|
+
function g(n) {
|
|
19
|
+
const r = atob(n), e = new Uint8Array(r.length);
|
|
20
|
+
for (let t = 0; t < r.length; t++)
|
|
21
|
+
e[t] = r.charCodeAt(t);
|
|
22
|
+
return Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
g as base64ToHex,
|
|
26
|
+
o as dataToStr,
|
|
27
|
+
i as generateRandomString,
|
|
28
|
+
a as hexToBase64
|
|
29
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function h(c) {
|
|
2
|
+
const i = ["script", "iframe", "object", "embed", "link", "meta", "style"], d = ["onerror", "onload", "onclick", "onmouseover", "onfocus", "onmouseenter", "onmouseleave"], l = (t) => /^javascript:/i.test(t) || /^data:text\/html/i.test(t), r = new DOMParser().parseFromString(`<div>${c}</div>`, "text/html"), s = r.body.firstChild;
|
|
3
|
+
function a(t) {
|
|
4
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
5
|
+
const e = t, u = e.tagName.toLowerCase();
|
|
6
|
+
if (i.includes(u)) {
|
|
7
|
+
const o = e.outerHTML, n = r.createTextNode(o);
|
|
8
|
+
e.replaceWith(n);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
[...e.attributes].forEach((o) => {
|
|
12
|
+
const n = o.name.toLowerCase(), m = o.value;
|
|
13
|
+
(d.includes(n) || l(m)) && e.removeAttribute(o.name);
|
|
14
|
+
}), [...e.childNodes].forEach(a);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return [...s.childNodes].forEach(a), s.innerHTML;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
h as htmlSanitize
|
|
21
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as r } from "../../../commonjs-virtual-dir/
|
|
1
|
+
import { __exports as r } from "../../../commonjs-virtual-dir/index4.js";
|
|
2
2
|
import { __require as t } from "./parser.js";
|
|
3
3
|
import { __require as m } from "./writer.js";
|
|
4
4
|
import { __require as p } from "./grammar.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "module-develop-kit",
|
|
3
3
|
"author": "Front-End team",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "前端项目通用工具包",
|
|
7
7
|
"module": "dist/main.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build:dev": "cross-env NODE_ENV=production APP_ENV=production vite build --mode dev",
|
|
30
|
-
"dev": "npm run build:dev && cross-env NODE_ENV=development APP_ENV=dev vite --mode dev --config test/vite.config.ts
|
|
30
|
+
"dev": "npm run build:dev && cross-env NODE_ENV=development APP_ENV=dev vite --mode dev --config test/vite.config.ts",
|
|
31
31
|
"build": "cross-env NODE_ENV=production APP_ENV=production vite build --mode production",
|
|
32
32
|
"build:watch": "cross-env NODE_ENV=production APP_ENV=production vite build --mode production --watch",
|
|
33
33
|
"prepare": "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@types/sdp-transform": "^2.15.0",
|
|
45
45
|
"@types/sm-crypto": "^0.3.4",
|
|
46
46
|
"@vitejs/plugin-legacy": "^7.2.1",
|
|
47
|
+
"axios": "^1.12.2",
|
|
47
48
|
"cross-env": "^10.0.0",
|
|
48
49
|
"eslint": "^9.35.0",
|
|
49
50
|
"jsdom": "^27.0.0",
|
|
@@ -58,7 +59,6 @@
|
|
|
58
59
|
"vue-tsc": "^3.0.7"
|
|
59
60
|
},
|
|
60
61
|
"dependencies": {
|
|
61
|
-
"crypto-js": "^4.2.0",
|
|
62
62
|
"gm-crypt": "^0.0.2",
|
|
63
63
|
"jssip": "^3.10.1",
|
|
64
64
|
"sm-crypto": "^0.3.13"
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
function r(o) {
|
|
2
|
-
throw new Error('Could not dynamically require "' + o + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
3
|
-
}
|
|
4
|
-
export {
|
|
5
|
-
r as commonjsRequire
|
|
6
|
-
};
|