module-develop-kit 1.4.0 → 1.4.2

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 (37) hide show
  1. package/dist/commonjs-virtual-dir/browser.js +2 -5
  2. package/dist/commonjs-virtual-dir/browser2.js +5 -2
  3. package/dist/commonjs-virtual-dir/index2.js +2 -5
  4. package/dist/commonjs-virtual-dir/index3.js +4 -2
  5. package/dist/commonjs-virtual-dir/index4.js +2 -2
  6. package/dist/main.d.ts +60 -14
  7. package/dist/main.js +19 -19
  8. package/dist/src/shield/gcm-crypto/axios-adapter.js +82 -0
  9. package/dist/src/shield/gcm-crypto/constants.js +4 -0
  10. package/dist/src/shield/gcm-crypto/gcm.config.js +60 -0
  11. package/dist/src/shield/gcm-crypto/index.js +22 -19
  12. package/dist/src/shield/gcm-crypto/utils.js +40 -0
  13. package/dist/types/axios.d.ts +20 -4
  14. package/dist/vendor/@tokenizer/inflate/lib/ZipHandler.js +1 -1
  15. package/dist/vendor/debug/src/browser.js +1 -1
  16. package/dist/vendor/ieee754/index.js +1 -1
  17. package/dist/vendor/sdp-transform/lib/index.js +1 -1
  18. package/dist/vendor/token-types/lib/index.js +1 -1
  19. package/package.json +1 -1
  20. package/dist/commonjs-virtual-dir/index5.js +0 -4
  21. package/dist/commonjs-virtual-dir/index6.js +0 -4
  22. package/dist/src/shield/crypto/const.js +0 -4
  23. package/dist/src/shield/crypto/sm2.js +0 -7
  24. package/dist/src/shield/crypto/util.js +0 -17
  25. package/dist/src/shield/gcm-crypto/gcm.service.js +0 -29
  26. package/dist/src/shield/gcm-crypto/hex.js +0 -18
  27. package/dist/src/shield/gcm-crypto/init.js +0 -61
  28. package/dist/src/shield/gcm-crypto/string.js +0 -10
  29. package/dist/vendor/jsbn/index.js +0 -714
  30. package/dist/vendor/sm-crypto/src/index.js +0 -14
  31. package/dist/vendor/sm-crypto/src/sm2/asn1.js +0 -86
  32. package/dist/vendor/sm-crypto/src/sm2/ec.js +0 -205
  33. package/dist/vendor/sm-crypto/src/sm2/index.js +0 -114
  34. package/dist/vendor/sm-crypto/src/sm2/sm3.js +0 -71
  35. package/dist/vendor/sm-crypto/src/sm2/utils.js +0 -95
  36. package/dist/vendor/sm-crypto/src/sm3/index.js +0 -50
  37. package/dist/vendor/sm-crypto/src/sm4/index.js +0 -408
@@ -1,18 +0,0 @@
1
- const o = (e) => Array.from(crypto.getRandomValues(new Uint8Array(e))).map((n) => n.toString(16).padStart(2, "0")).join(""), a = (e) => {
2
- let n = "";
3
- for (let t = 0; t < e.length; t += 32768)
4
- n += String.fromCharCode(...e.subarray(t, t + 32768));
5
- return btoa(n);
6
- }, c = (e) => new TextEncoder().encode(e), i = (e) => new TextDecoder().decode(e), s = (e) => {
7
- const n = atob(e), r = new Uint8Array(n.length);
8
- for (let t = 0; t < n.length; t++)
9
- r[t] = n.charCodeAt(t);
10
- return Array.from(r, (t) => t.toString(16).padStart(2, "0")).join("");
11
- };
12
- export {
13
- s as base64ToHex,
14
- a as bytesToBase64,
15
- o as generateHex,
16
- c as stringToUtf8Bytes,
17
- i as utf8BytesToString
18
- };
@@ -1,61 +0,0 @@
1
- import { sm2 as K } from "../../../vendor/sm-crypto-v2/dist/index.js";
2
- import { EHeaderKey as r } from "../crypto/const.js";
3
- import { sm2Decrypt as b } from "../crypto/sm2.js";
4
- import { base64ToHex as f } from "../crypto/util.js";
5
- import { gcmService as o } from "./gcm.service.js";
6
- import { requestDataEncryption as C, responseDataDecryption as D } from "./index.js";
7
- import { formatUrlToGcmCryptoUri as s } from "./string.js";
8
- import { isNullOrUndefined as n } from "../../utils/is.js";
9
- import "vue";
10
- const B = {
11
- install: (t, e) => {
12
- o.init(e);
13
- }
14
- }, G = () => o.initPublicKey(), I = (t) => {
15
- o.addRequestBeforeCryptoCallback(t);
16
- }, m = /* @__PURE__ */ new Map(), c = (t, e) => t && (t[e] || t.get(e)) || "", k = (t) => {
17
- if (!o.isEncrypt || !o.publicKey)
18
- return t;
19
- if (!t.isNotAutoEncryption && t.url) {
20
- o.requestBeforeCryptoCallBacks.forEach((a) => {
21
- a(t);
22
- });
23
- const { headers: e, data: p } = C(
24
- o.publicKey,
25
- t.data,
26
- s(t.url)
27
- );
28
- if (c(t.headers, "Content-Type") !== "multipart/form-data" && (t.data = n(t.data) ? t.data : p), t.isAutoDecryptionResponse) {
29
- const { publicKey: a, privateKey: i } = K.generateKeyPairHex();
30
- m.set(a, i), t.headers.set(r.gcmPublicKey, a);
31
- }
32
- t.headers.set(e);
33
- }
34
- return t;
35
- }, R = (t) => {
36
- if (t.config.isAutoDecryptionResponse && t.request.responseType !== "blob") {
37
- const { data: e, ...p } = t.data, a = c(t.headers, r.gcmPublicKey);
38
- if (!a)
39
- return t;
40
- const i = m.get(a);
41
- if (i && !n(e)) {
42
- const u = c(t.headers, r.encryptIv), d = c(t.headers, r.encryptKey), l = c(t.headers, r.encryptTag), y = b(i, f(d));
43
- t.data = {
44
- ...p,
45
- data: D(y, e, s(t.config.url), {
46
- [r.encryptIv]: u,
47
- [r.encryptKey]: y,
48
- [r.encryptTag]: l
49
- })
50
- };
51
- }
52
- }
53
- return t;
54
- };
55
- export {
56
- B as gcmCrypto,
57
- G as initPublicKey,
58
- I as requestDataBeforeGcmCrypto,
59
- k as requestDataGcmCryptoInterceptor,
60
- R as responseDataGcmCryptoInterceptor
61
- };
@@ -1,10 +0,0 @@
1
- const t = (o) => typeof o == "object" ? JSON.stringify(o ?? {}) : typeof o == "number" ? String(o) : o ?? "", i = (o) => {
2
- if (!o)
3
- return "";
4
- const r = o.split("/").filter(Boolean);
5
- return r.shift(), `/${r.join("/")}`;
6
- };
7
- export {
8
- t as dataToStr,
9
- i as formatUrlToGcmCryptoUri
10
- };