module-develop-kit 0.5.14 → 1.0.1

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.
Files changed (97) hide show
  1. package/dist/commonjs-virtual-dir/_commonjsHelpers.js +4 -6
  2. package/dist/commonjs-virtual-dir/index.js +3 -3
  3. package/dist/commonjs-virtual-dir/index2.js +3 -3
  4. package/dist/commonjs-virtual-dir/index3.js +3 -3
  5. package/dist/commonjs-virtual-dir/index4.js +2 -5
  6. package/dist/commonjs-virtual-dir/index5.js +2 -2
  7. package/dist/commonjs-virtual-dir/index6.js +2 -2
  8. package/dist/main.d.ts +77 -104
  9. package/dist/main.js +16 -20
  10. package/dist/src/outside-call/utils.js +1 -1
  11. package/dist/src/shield/crypto/const.js +4 -0
  12. package/dist/src/shield/crypto/index.js +53 -0
  13. package/dist/src/shield/crypto/sm2.js +7 -0
  14. package/dist/src/shield/crypto/sm4.js +15 -0
  15. package/dist/src/shield/crypto/util.js +29 -0
  16. package/dist/src/shield/html-sanitize.js +21 -0
  17. package/dist/src/vite-plugins/getCompatibilityPlugins.js +7 -7
  18. package/dist/vendor/base64-js/index.js +1 -1
  19. package/dist/vendor/jsbn/index.js +1 -1
  20. package/dist/vendor/sdp-transform/lib/index.js +1 -1
  21. package/package.json +3 -3
  22. package/dist/commonjs-virtual-dir/_commonjs-dynamic-modules.js +0 -6
  23. package/dist/commonjs-virtual-dir/aes.js +0 -4
  24. package/dist/commonjs-virtual-dir/blowfish.js +0 -4
  25. package/dist/commonjs-virtual-dir/cipher-core.js +0 -4
  26. package/dist/commonjs-virtual-dir/core.js +0 -4
  27. package/dist/commonjs-virtual-dir/enc-base64.js +0 -4
  28. package/dist/commonjs-virtual-dir/enc-base64url.js +0 -4
  29. package/dist/commonjs-virtual-dir/enc-utf16.js +0 -4
  30. package/dist/commonjs-virtual-dir/evpkdf.js +0 -4
  31. package/dist/commonjs-virtual-dir/format-hex.js +0 -4
  32. package/dist/commonjs-virtual-dir/hmac.js +0 -4
  33. package/dist/commonjs-virtual-dir/index7.js +0 -4
  34. package/dist/commonjs-virtual-dir/index8.js +0 -4
  35. package/dist/commonjs-virtual-dir/lib-typedarrays.js +0 -4
  36. package/dist/commonjs-virtual-dir/md5.js +0 -4
  37. package/dist/commonjs-virtual-dir/mode-cfb.js +0 -4
  38. package/dist/commonjs-virtual-dir/mode-ctr-gladman.js +0 -4
  39. package/dist/commonjs-virtual-dir/mode-ctr.js +0 -4
  40. package/dist/commonjs-virtual-dir/mode-ecb.js +0 -4
  41. package/dist/commonjs-virtual-dir/mode-ofb.js +0 -4
  42. package/dist/commonjs-virtual-dir/pad-ansix923.js +0 -4
  43. package/dist/commonjs-virtual-dir/pad-iso10126.js +0 -4
  44. package/dist/commonjs-virtual-dir/pad-iso97971.js +0 -4
  45. package/dist/commonjs-virtual-dir/pad-nopadding.js +0 -4
  46. package/dist/commonjs-virtual-dir/pad-zeropadding.js +0 -4
  47. package/dist/commonjs-virtual-dir/pbkdf2.js +0 -4
  48. package/dist/commonjs-virtual-dir/rabbit-legacy.js +0 -4
  49. package/dist/commonjs-virtual-dir/rabbit.js +0 -4
  50. package/dist/commonjs-virtual-dir/rc4.js +0 -4
  51. package/dist/commonjs-virtual-dir/ripemd160.js +0 -4
  52. package/dist/commonjs-virtual-dir/sha1.js +0 -4
  53. package/dist/commonjs-virtual-dir/sha224.js +0 -4
  54. package/dist/commonjs-virtual-dir/sha256.js +0 -4
  55. package/dist/commonjs-virtual-dir/sha3.js +0 -4
  56. package/dist/commonjs-virtual-dir/sha384.js +0 -4
  57. package/dist/commonjs-virtual-dir/sha512.js +0 -4
  58. package/dist/commonjs-virtual-dir/tripledes.js +0 -4
  59. package/dist/commonjs-virtual-dir/x64-core.js +0 -4
  60. package/dist/src/shield/crypto.js +0 -28
  61. package/dist/src/shield/index.js +0 -59
  62. package/dist/vendor/crypto-js/aes.js +0 -69
  63. package/dist/vendor/crypto-js/blowfish.js +0 -1131
  64. package/dist/vendor/crypto-js/cipher-core.js +0 -544
  65. package/dist/vendor/crypto-js/core.js +0 -508
  66. package/dist/vendor/crypto-js/enc-base64.js +0 -80
  67. package/dist/vendor/crypto-js/enc-base64url.js +0 -87
  68. package/dist/vendor/crypto-js/enc-utf16.js +0 -99
  69. package/dist/vendor/crypto-js/evpkdf.js +0 -70
  70. package/dist/vendor/crypto-js/format-hex.js +0 -53
  71. package/dist/vendor/crypto-js/hmac.js +0 -83
  72. package/dist/vendor/crypto-js/index.js +0 -49
  73. package/dist/vendor/crypto-js/lib-typedarrays.js +0 -27
  74. package/dist/vendor/crypto-js/md5.js +0 -71
  75. package/dist/vendor/crypto-js/mode-cfb.js +0 -36
  76. package/dist/vendor/crypto-js/mode-ctr-gladman.js +0 -45
  77. package/dist/vendor/crypto-js/mode-ctr.js +0 -28
  78. package/dist/vendor/crypto-js/mode-ecb.js +0 -27
  79. package/dist/vendor/crypto-js/mode-ofb.js +0 -26
  80. package/dist/vendor/crypto-js/pad-ansix923.js +0 -25
  81. package/dist/vendor/crypto-js/pad-iso10126.js +0 -25
  82. package/dist/vendor/crypto-js/pad-iso97971.js +0 -23
  83. package/dist/vendor/crypto-js/pad-nopadding.js +0 -21
  84. package/dist/vendor/crypto-js/pad-zeropadding.js +0 -28
  85. package/dist/vendor/crypto-js/pbkdf2.js +0 -74
  86. package/dist/vendor/crypto-js/rabbit-legacy.js +0 -73
  87. package/dist/vendor/crypto-js/rabbit.js +0 -75
  88. package/dist/vendor/crypto-js/rc4.js +0 -63
  89. package/dist/vendor/crypto-js/ripemd160.js +0 -398
  90. package/dist/vendor/crypto-js/sha1.js +0 -49
  91. package/dist/vendor/crypto-js/sha224.js +0 -36
  92. package/dist/vendor/crypto-js/sha256.js +0 -57
  93. package/dist/vendor/crypto-js/sha3.js +0 -116
  94. package/dist/vendor/crypto-js/sha384.js +0 -37
  95. package/dist/vendor/crypto-js/sha512.js +0 -147
  96. package/dist/vendor/crypto-js/tripledes.js +0 -729
  97. package/dist/vendor/crypto-js/x64-core.js +0 -235
@@ -1,8 +1,7 @@
1
- var u = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
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 l(e) {
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
- u as commonjsGlobal,
31
- l as getAugmentedNamespace,
32
- f as getDefaultExportFromCjs
29
+ c as getAugmentedNamespace,
30
+ u as getDefaultExportFromCjs
33
31
  };
@@ -1,5 +1,5 @@
1
- import { __require as r } from "../vendor/gm-crypt/index.js";
2
- var p = r();
1
+ import { __require as r } from "../vendor/sm-crypto/src/index.js";
2
+ var s = r();
3
3
  export {
4
- p as g
4
+ s
5
5
  };
@@ -1,5 +1,5 @@
1
- import { __require as r } from "../vendor/sm-crypto/src/index.js";
2
- var s = r();
1
+ import { __require as r } from "../vendor/gm-crypt/index.js";
2
+ var p = r();
3
3
  export {
4
- s
4
+ p as g
5
5
  };
@@ -1,7 +1,7 @@
1
1
  import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as o } from "../vendor/crypto-js/index.js";
2
+ import { __require as o } from "../vendor/sdp-transform/lib/index.js";
3
3
  var t = o();
4
- const s = /* @__PURE__ */ r(t);
4
+ const a = /* @__PURE__ */ r(t);
5
5
  export {
6
- s as default
6
+ a as default
7
7
  };
@@ -1,7 +1,4 @@
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);
1
+ var e = { exports: {} };
5
2
  export {
6
- a as default
3
+ e as __module
7
4
  };
@@ -1,4 +1,4 @@
1
- var o = { exports: {} };
1
+ var r = {};
2
2
  export {
3
- o as __module
3
+ r as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var r = {};
1
+ var s = {};
2
2
  export {
3
- r as __exports
3
+ s as __exports
4
4
  };
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
- * 使用AES算法对字符串进行解密。
6
- * 该函数接收一个密钥、待解密的字符串或CipherParams对象以及初始化向量(IV),并返回解密后的字符串。
7
- * 解密过程使用CBC模式和Pkcs7填充方式。
8
- * 待解密的字符串或CipherParams对象将通过CryptoJS库处理。
9
- * 初始化向量会被解析为UTF-8格式以确保正确解密。
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 const aesDecryptString: (key: string, str: string | default_2.lib.CipherParams, iv: string) => string;
17
-
18
- /**
19
- * 使用AES加密算法对字符串或WordArray进行加密。
20
- * 该函数基于CryptoJS库实现,采用CBC模式和Pkcs7填充方式。
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
  */
@@ -202,33 +199,18 @@ export declare interface ICallConfig extends SipAccount {
202
199
  * 用于拨打电话的相关信息
203
200
  */
204
201
  export declare interface ICallOptions {
202
+ /**
203
+ * 外呼需要拨打的号码
204
+ */
205
205
  call: string;
206
206
  }
207
207
 
208
- declare interface ICreateHeaders {
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;
208
+ export declare interface IResponseDataEncryptionStep {
209
+ data: string;
210
+ headers: Record<EHeaderKey, string>;
229
211
  }
230
212
 
231
- declare interface ISm4Params {
213
+ export declare interface ISm4Params {
232
214
  /**
233
215
  * 解密向量
234
216
  */
@@ -237,13 +219,31 @@ declare interface ISm4Params {
237
219
  * 解密密钥
238
220
  */
239
221
  key: string;
240
- /**
241
- * 解密模式
242
- * @default cbc
243
- */
244
- mode?: "cbc" | "ecb";
245
222
  }
246
223
 
224
+ /**
225
+ * 请求数据加密
226
+ * @param publicKey 公钥
227
+ * @param _data 数据
228
+ */
229
+ export declare function requestDataEncryption(publicKey: string, _data?: TData): {
230
+ headers: {
231
+ "X-Encrypted-Iv": string;
232
+ "X-Encrypted-Key": string;
233
+ };
234
+ data: {
235
+ body: string;
236
+ };
237
+ };
238
+
239
+ /**
240
+ * 响应数据解密
241
+ * @param stepCb
242
+ */
243
+ export declare function responseDataEncryption<T>(stepCb: (_headers: {
244
+ [EHeaderKey.publicKey]: string;
245
+ }) => Promise<IResponseDataEncryptionStep>): Promise<T>;
246
+
247
247
  /**
248
248
  * sip code对应的的状态,优先处理 code 对应的提示文案,如果不存在则按照 causes 状态去处理
249
249
  */
@@ -299,47 +299,20 @@ declare interface SipAccount {
299
299
  password: string;
300
300
  }
301
301
 
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
302
  /**
317
303
  * 禁用用户debugger
318
304
  */
319
305
  export declare const startNoDebugger: () => void;
320
306
 
321
- declare type TData = _TData | _TData[];
307
+ export declare type TData = _TData | _TData[];
322
308
 
323
309
  declare type _TData = null | undefined | number | string | Record<string, any>;
324
310
 
325
- declare type TEncryptionType = "sm4" | "ase";
311
+ export declare type TNullable<T> = T | null;
326
312
 
327
- /**
328
- * 传输数据加密方法,用于在发送数据前对其进行加密。
329
- * @param key - 加密使用的密钥字符串。
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
- };
313
+ export declare type TObj<K extends keyof any = string, T = any> = Record<K, T>;
314
+
315
+ export declare type TUndefinable<T> = T | undefined;
343
316
 
344
317
  /**
345
318
  * 打电话
package/dist/main.js CHANGED
@@ -1,25 +1,21 @@
1
1
  import { useCall as e } from "./src/outside-call/index.js";
2
- import { createHeaders as a, htmlSanitize as E, transmissionDataEncryption as n } from "./src/shield/index.js";
3
- import { aesDecryptString as p, aesEncryptString as s, generateRandomString as S, sm4Decrypt as g, sm4Encrypt as i } from "./src/shield/crypto.js";
4
- import { startNoDebugger as l } from "./src/shield/no-debugger.js";
5
- import { EventBus as c } from "./src/utils/eventBus.js";
6
- import { CallLogger as y } from "./src/outside-call/utils.js";
7
- import { ECallStatus as D, EMIT_EVENT_NAME as u, SIP_CODE_MESSAGE as R, SIP_ERROR_CAUSES as A } from "./src/outside-call/constants.js";
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
- y as CallLogger,
10
- D as ECallStatus,
9
+ _ as CallLogger,
10
+ i as ECallStatus,
11
11
  u as EMIT_EVENT_NAME,
12
- c as EventBus,
13
- R as SIP_CODE_MESSAGE,
14
- A as SIP_ERROR_CAUSES,
15
- p as aesDecryptString,
16
- s as aesEncryptString,
17
- a as createHeaders,
18
- S as generateRandomString,
19
- E as htmlSanitize,
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
  };
@@ -1,4 +1,4 @@
1
- import a from "../../commonjs-virtual-dir/index4.js";
1
+ import a from "../../commonjs-virtual-dir/index3.js";
2
2
  const u = {
3
3
  log(e, ...r) {
4
4
  console.log(`%c【${(/* @__PURE__ */ new Date()).toLocaleString()}】`, "color: green; font-weight: bold;", e, ...r);
@@ -0,0 +1,4 @@
1
+ var p = /* @__PURE__ */ ((c) => (c.publicKey = "X-Public-Key", c.encryptIv = "X-Encrypted-Iv", c.encryptKey = "X-Encrypted-Key", c.encryptIvLow = "x-encrypted-iv", c.encryptKeyLow = "x-encrypted-key", c))(p || {});
2
+ export {
3
+ p as EHeaderKey
4
+ };
@@ -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/index2.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,24 +1,24 @@
1
1
  import c from "@vitejs/plugin-legacy";
2
2
  import { vitePluginCompatibilityDetection as l } from "./vitePluginCompatibilityDetection.js";
3
3
  const f = {
4
- targets: "since 2021 and > 0.1% in CN",
4
+ targets: "since 2020",
5
5
  renderModernChunks: !1,
6
6
  modernPolyfills: !1
7
- }, g = (o) => {
7
+ }, a = (n) => {
8
8
  const e = {
9
9
  open: !0,
10
10
  openDetection: !0,
11
- ...o || {}
12
- }, i = e.detectionConfig?.platform === "h5", t = [], { open: s, openDetection: r, detectionConfig: p, ...n } = e;
11
+ ...n || {}
12
+ }, i = e.detectionConfig?.platform === "h5", t = [], { open: s, openDetection: r, detectionConfig: p, ...o } = e;
13
13
  return s && (t.push(
14
14
  c(
15
15
  i ? {
16
16
  ...f,
17
- ...n || {}
18
- } : n
17
+ ...o || {}
18
+ } : o
19
19
  )
20
20
  ), r && t.push(l(p))), t;
21
21
  };
22
22
  export {
23
- g as getCompatibilityPlugins
23
+ a as getCompatibilityPlugins
24
24
  };
@@ -1,4 +1,4 @@
1
- import { __exports as F } from "../../commonjs-virtual-dir/index8.js";
1
+ import { __exports as F } from "../../commonjs-virtual-dir/index6.js";
2
2
  var A;
3
3
  function _() {
4
4
  if (A) return F;
@@ -1,4 +1,4 @@
1
- import { __module as C } from "../../commonjs-virtual-dir/index7.js";
1
+ import { __module as C } from "../../commonjs-virtual-dir/index4.js";
2
2
  var $i = C.exports, Y;
3
3
  function Qi() {
4
4
  return Y ? C.exports : (Y = 1, function(x, Hi) {
@@ -1,4 +1,4 @@
1
- import { __exports as r } from "../../../commonjs-virtual-dir/index6.js";
1
+ import { __exports as r } from "../../../commonjs-virtual-dir/index5.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.5.14",
4
+ "version": "1.0.1",
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 --debug",
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
- };
@@ -1,4 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };
@@ -1,4 +0,0 @@
1
- var o = { exports: {} };
2
- export {
3
- o as __module
4
- };
@@ -1,4 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };
@@ -1,4 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };
@@ -1,4 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };
@@ -1,4 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };
@@ -1,4 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };
@@ -1,4 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };