module-develop-kit 1.4.1 → 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.
- package/dist/commonjs-virtual-dir/index2.js +2 -5
- package/dist/commonjs-virtual-dir/index3.js +4 -2
- package/dist/commonjs-virtual-dir/index4.js +2 -2
- package/dist/main.d.ts +60 -14
- package/dist/main.js +19 -19
- package/dist/src/shield/gcm-crypto/axios-adapter.js +82 -0
- package/dist/src/shield/gcm-crypto/constants.js +4 -0
- package/dist/src/shield/gcm-crypto/gcm.config.js +60 -0
- package/dist/src/shield/gcm-crypto/index.js +22 -19
- package/dist/src/shield/gcm-crypto/utils.js +40 -0
- package/dist/types/axios.d.ts +10 -8
- package/dist/vendor/ieee754/index.js +1 -1
- package/dist/vendor/sdp-transform/lib/index.js +1 -1
- package/dist/vendor/token-types/lib/index.js +1 -1
- package/package.json +1 -1
- package/dist/commonjs-virtual-dir/index5.js +0 -4
- package/dist/commonjs-virtual-dir/index6.js +0 -4
- package/dist/src/shield/crypto/const.js +0 -4
- package/dist/src/shield/crypto/sm2.js +0 -7
- package/dist/src/shield/crypto/util.js +0 -17
- package/dist/src/shield/gcm-crypto/gcm.service.js +0 -29
- package/dist/src/shield/gcm-crypto/hex.js +0 -18
- package/dist/src/shield/gcm-crypto/init.js +0 -61
- package/dist/src/shield/gcm-crypto/string.js +0 -10
- package/dist/vendor/jsbn/index.js +0 -714
- package/dist/vendor/sm-crypto/src/index.js +0 -14
- package/dist/vendor/sm-crypto/src/sm2/asn1.js +0 -86
- package/dist/vendor/sm-crypto/src/sm2/ec.js +0 -205
- package/dist/vendor/sm-crypto/src/sm2/index.js +0 -114
- package/dist/vendor/sm-crypto/src/sm2/sm3.js +0 -71
- package/dist/vendor/sm-crypto/src/sm2/utils.js +0 -95
- package/dist/vendor/sm-crypto/src/sm3/index.js +0 -50
- package/dist/vendor/sm-crypto/src/sm4/index.js +0 -408
|
@@ -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
|
-
};
|