@pubinfo-pr/module-crypto 0.189.2 → 0.200.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.
@@ -1,22 +1,22 @@
1
- import { basic as request } from '../../request';
1
+ import { basic as request } from '@/api/request';
2
2
  /**
3
3
  * @description 编辑加解密配置
4
4
  * @url /crypto/editCryptoConfig
5
5
  * @method POST
6
6
  * @author @pubinfo/openapi
7
7
  */
8
- export declare function postCryptoEditCryptoConfig<R = API.ResponseDataBoolean, T = API.ResponseDataBoolean>(body: API.EditCryptoConfigDto, options?: Parameters<typeof request.Post<R, T>>[2]): import('alova').Method<import('alova').RespondedAlovaGenerics<import('pubinfo-pr').AG, R, T>>;
8
+ export declare function postCryptoEditCryptoConfig<R = API.ResponseDataBoolean, T = API.ResponseDataBoolean>(body: API.EditCryptoConfigDto, options?: Parameters<typeof request.Post<R, T>>[2]): import("alova").Method<import("alova").RespondedAlovaGenerics<import("pubinfo-pr").AG, R, T>>;
9
9
  /**
10
10
  * @description 获取加解密配置
11
11
  * @url /crypto/getCryptoConfig
12
12
  * @method GET
13
13
  * @author @pubinfo/openapi
14
14
  */
15
- export declare function getCryptoGetCryptoConfig<R = API.ResponseDataCryptoConfig, T = API.ResponseDataCryptoConfig>(options?: Parameters<typeof request.Get<R, T>>[1]): import('alova').Method<import('alova').RespondedAlovaGenerics<import('pubinfo-pr').AG, R, T>>;
15
+ export declare function getCryptoGetCryptoConfig<R = API.ResponseDataCryptoConfig, T = API.ResponseDataCryptoConfig>(options?: Parameters<typeof request.Get<R, T>>[1]): import("alova").Method<import("alova").RespondedAlovaGenerics<import("pubinfo-pr").AG, R, T>>;
16
16
  /**
17
17
  * @description 获取公钥及加解密配置
18
18
  * @url /crypto/getPublicKeyAndConfig
19
19
  * @method GET
20
20
  * @author @pubinfo/openapi
21
21
  */
22
- export declare function getCryptoGetPublicKeyAndConfig<R = API.ResponseDataCryptoConfigExt, T = API.ResponseDataCryptoConfigExt>(options?: Parameters<typeof request.Get<R, T>>[1]): import('alova').Method<import('alova').RespondedAlovaGenerics<import('pubinfo-pr').AG, R, T>>;
22
+ export declare function getCryptoGetPublicKeyAndConfig<R = API.ResponseDataCryptoConfigExt, T = API.ResponseDataCryptoConfigExt>(options?: Parameters<typeof request.Get<R, T>>[1]): import("alova").Method<import("alova").RespondedAlovaGenerics<import("pubinfo-pr").AG, R, T>>;
@@ -1 +1 @@
1
- export declare const basic: import('pubinfo-pr').RequestInstance;
1
+ export declare const basic: import("pubinfo-pr").RequestInstance;
@@ -1,2 +1,2 @@
1
- import { InternalContext } from './interface';
2
- export declare const apictx: import('unctx').UseContext<InternalContext>;
1
+ import type { InternalContext } from './interface';
2
+ export declare const apictx: import("unctx").UseContext<InternalContext>;
package/dist/context.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { cryptoInternal } from './interface';
2
- export declare const ctx: import('unctx').UseContext<{
1
+ import type { cryptoInternal } from './interface';
2
+ export declare const ctx: import("unctx").UseContext<{
3
3
  isCrypto: boolean;
4
4
  cryptoSetting: cryptoInternal;
5
5
  whiteListUrls?: API.UrlEntry[];
@@ -1,4 +1,4 @@
1
- import { cryptoInternal } from '../interface';
1
+ import type { cryptoInternal } from '@/interface';
2
2
  export declare function aesEncrypt(plainText: string): Promise<string>;
3
3
  export declare function aesDecrypt(cipherText: string): Promise<string>;
4
4
  export declare function setupAes(): cryptoInternal;
@@ -1,4 +1,4 @@
1
- import { cryptoInternal } from '../interface';
1
+ import type { cryptoInternal } from '@/interface';
2
2
  export declare function sm4CBCEncrypt(plainText: string): Promise<string>;
3
3
  export declare function sm4CBCDecrypt(cipherText: string): Promise<string>;
4
4
  export declare function setupSm4Cbc(): cryptoInternal;
@@ -1,4 +1,4 @@
1
- import { cryptoInternal } from '../interface';
1
+ import type { cryptoInternal } from '@/interface';
2
2
  export declare function sm4ECBEncrypt(plainText: string): Promise<string>;
3
3
  export declare function sm4ECBDecrypt(cipherText: string): Promise<string>;
4
4
  export declare function setupSm4Ecb(): cryptoInternal;
@@ -1,5 +1,5 @@
1
- import { RequestMethod } from 'pubinfo-pr';
2
- import { cryptoInternal } from './interface';
1
+ import type { RequestMethod } from 'pubinfo-pr';
2
+ import type { cryptoInternal } from './interface';
3
3
  export declare function isMethodNeedCrypto(url: string, isCrypto: boolean, cryptoMode: boolean, whiteListUrls?: API.UrlEntry[]): boolean;
4
4
  export declare function isUrlInWhiteList(url: string, cryptoMode: boolean, whiteListUrls?: API.UrlEntry[]): boolean;
5
5
  export declare function encrypt(method: RequestMethod, cryptoSetting: cryptoInternal): Promise<void>;
@@ -1,7 +1,6 @@
1
1
  import { Button, Drawer, Form, FormItem, Input, Space, Textarea } from "ant-design-vue/es";
2
2
  import { createBlock, createTextVNode, createVNode, defineComponent, isRef, onMounted, openBlock, reactive, ref, shallowRef, toValue, unref, withCtx } from "vue";
3
3
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
4
- /* @__NO_SIDE_EFFECTS__ */
5
4
  function useToggle(e = !1, c = {}) {
6
5
  let { truthyValue: l = !0, falsyValue: u = !1 } = c, d = isRef(e), f = shallowRef(e);
7
6
  function p(e) {
@@ -22,14 +21,14 @@ var drawerCryptoUrl_default = /* @__PURE__ */ defineComponent({
22
21
  required: !0,
23
22
  validator: O,
24
23
  trigger: ["blur", "change"]
25
- }] }, [x, S] = /* @__PURE__ */ useToggle(!1), C = ref(), w = ref({}), T = ref(!1), E = ref([]), D = ref(0);
24
+ }] }, [x, S] = useToggle(!1), C = ref(), w = ref({}), T = ref(!1), E = ref([]), D = ref(0);
26
25
  function O(e, c, l) {
27
26
  c ? /^\/(?!.*\*{3})(?:[\w-]+|:\w+|\*{1,2})(?:\/(?:[\w-]+|:\w+|\*{1,2}))*$/.test(c) ? l() : l(/* @__PURE__ */ Error("url格式不正确")) : l(/* @__PURE__ */ Error("请输入url"));
28
27
  }
29
28
  async function k(e, c, l) {
30
29
  S(!0), E.value = c || [], D.value = l || 0, e ? (T.value = !0, w.value = { ...c?.[l || 0] }) : (T.value = !1, w.value = {});
31
30
  }
32
- let [A, j] = /* @__PURE__ */ useToggle(!1);
31
+ let [A, j] = useToggle(!1);
33
32
  function M() {
34
33
  C.value?.validate().then(() => {
35
34
  j(!0);
@@ -54,17 +53,15 @@ var drawerCryptoUrl_default = /* @__PURE__ */ defineComponent({
54
53
  }, {
55
54
  footer: withCtx(() => [createVNode(T, null, {
56
55
  default: withCtx(() => [createVNode(S, { onClick: N }, {
57
- default: withCtx(() => h[4] ||= [createTextVNode(" 取消 ")]),
58
- _: 1,
59
- __: [4]
56
+ default: withCtx(() => [...h[4] ||= [createTextVNode(" 取消 ", -1)]]),
57
+ _: 1
60
58
  }), createVNode(S, {
61
59
  type: "primary",
62
60
  loading: unref(A),
63
61
  onClick: h[2] ||= (e) => M()
64
62
  }, {
65
- default: withCtx(() => h[5] ||= [createTextVNode(" 提交 ")]),
66
- _: 1,
67
- __: [5]
63
+ default: withCtx(() => [...h[5] ||= [createTextVNode(" 提交 ", -1)]]),
64
+ _: 1
68
65
  }, 8, ["loading"])]),
69
66
  _: 1
70
67
  })]),
@@ -1,2 +1,2 @@
1
- import { t as drawerCryptoUrl_default } from "./drawerCryptoUrl-DiezF2QX.js";
1
+ import { t as drawerCryptoUrl_default } from "./drawerCryptoUrl-CKgf1Uxz.js";
2
2
  export { drawerCryptoUrl_default as default };
package/dist/helper.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { RequestMethod } from 'pubinfo-pr';
1
+ import type { RequestMethod } from 'pubinfo-pr';
2
2
  export declare function setMethodRole(method: RequestMethod): RequestMethod;
3
3
  export declare function generateKey(num: number): string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ModuleOptions } from 'pubinfo-pr';
2
- import { CryptoOptions } from './interface';
1
+ import type { ModuleOptions } from 'pubinfo-pr';
2
+ import type { CryptoOptions } from './interface';
3
3
  import 'uno.css';
4
4
  export declare function crypto(options: CryptoOptions): ModuleOptions;
5
5
  export { setupAes } from './cryptoAlg/aes.ts';
package/dist/index.js CHANGED
@@ -11,12 +11,12 @@ import './index.css';var __create = Object.create, __defProp = Object.defineProp
11
11
  }) : n, e)), __require = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
12
12
  if (typeof require < "u") return require.apply(this, arguments);
13
13
  throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function.");
14
- }), __virtual_pubinfo_resolver_default = {
14
+ }), _virtual_pubinfo_resolver_default = {
15
15
  icons: {},
16
16
  layouts: {},
17
17
  pages: {
18
- "src/pages/setting.vue": () => import("./setting-B92b1yHA.js"),
19
- "src/pages/components/drawerCryptoUrl.vue": () => import("./drawerCryptoUrl-DPRsQXAo.js")
18
+ "src/pages/setting.vue": () => import("./setting-DkwAGQxz.js"),
19
+ "src/pages/components/drawerCryptoUrl.vue": () => import("./drawerCryptoUrl-DltbAlje.js")
20
20
  }
21
21
  };
22
22
  const apictx = createContext("crypto-api"), basic = wrapProxy(apictx.use, "request");
@@ -5443,7 +5443,7 @@ async function encryptMethod(e, t) {
5443
5443
  let n = JSON.parse(JSON.stringify(e.config.params));
5444
5444
  e.config.params = { secureData: decodeURIComponent(await t(decodeURIComponent(new URLSearchParams(n).toString()))) };
5445
5445
  }
5446
- if (e.config.meta && e.config.meta.pathParams) for (let n of e.config.meta.pathParams) e.url = e.url.replace(n, await t(n));
5446
+ if (e.config.meta && e.config.meta.pathParams) for (let n of e.config.meta.pathParams) e.url = e.url.replace(n, await t(`${n}`));
5447
5447
  }
5448
5448
  async function encrypt(e, t) {
5449
5449
  let n = ctx.use().key, r = ctx.use().iv;
@@ -7608,7 +7608,7 @@ function setupSm4Ecb() {
7608
7608
  decrypt: sm4ECBDecrypt
7609
7609
  };
7610
7610
  }
7611
- defineRouteModule("crypto", __virtual_pubinfo_resolver_default.pages), defineIconModule("crypto", __virtual_pubinfo_resolver_default.icons);
7611
+ defineRouteModule("crypto", _virtual_pubinfo_resolver_default.pages), defineIconModule("crypto", _virtual_pubinfo_resolver_default.icons);
7612
7612
  function crypto(e) {
7613
7613
  let { request: t, cryptoSetting: n } = e;
7614
7614
  return apictx.set({ request: t }), ctx.set({
@@ -1,4 +1,4 @@
1
- import { RequestInstance } from 'pubinfo-pr';
1
+ import type { RequestInstance } from 'pubinfo-pr';
2
2
  export interface CryptoOptions {
3
3
  /**
4
4
  * 接口请求实例
@@ -1,5 +1,5 @@
1
1
  import { n as getCryptoGetCryptoConfig, r as postCryptoEditCryptoConfig, t as ctx } from "./index.js";
2
- import { n as useToggle, t as drawerCryptoUrl_default } from "./drawerCryptoUrl-DiezF2QX.js";
2
+ import { n as useToggle, t as drawerCryptoUrl_default } from "./drawerCryptoUrl-CKgf1Uxz.js";
3
3
  import { PubinfoIcon, useAuth } from "pubinfo-pr";
4
4
  import { Button, CheckableTag, Form, FormItem, Space, Switch } from "ant-design-vue/es";
5
5
  import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, onMounted, openBlock, reactive, ref, resolveDirective, toDisplayString, unref, withCtx, withDirectives } from "vue";
@@ -147,9 +147,8 @@ var _hoisted_1 = {
147
147
  class: normalizeClass(unref(G) ? "cursor-not-allowed!" : ""),
148
148
  onChange: E[1] ||= (e) => !unref(G) && J(!0, e)
149
149
  }, {
150
- default: withCtx(() => E[4] ||= [createTextVNode(" 白名单 ")]),
151
- _: 1,
152
- __: [4]
150
+ default: withCtx(() => [...E[4] ||= [createTextVNode(" 白名单 ", -1)]]),
151
+ _: 1
153
152
  }, 8, [
154
153
  "checked",
155
154
  "disabled",
@@ -159,10 +158,9 @@ var _hoisted_1 = {
159
158
  class: normalizeClass(["mr-0px!", unref(G) ? "cursor-not-allowed!" : ""]),
160
159
  onChange: E[2] ||= (e) => !unref(G) && J(!1, e)
161
160
  }, {
162
- default: withCtx(() => E[5] ||= [createTextVNode(" 黑名单 ")]),
163
- _: 1,
164
- __: [5]
165
- }, 8, ["checked", "class"])]), createElementVNode("div", _hoisted_6, [createVNode(unref(QuestionCircleOutlined), { class: "mr-5px" }), E[6] ||= createTextVNode("白名单模式下,仅不加密过滤列表中的接口;黑名单模式下,仅加密过滤列表中的接口。 ")])])]),
161
+ default: withCtx(() => [...E[5] ||= [createTextVNode(" 黑名单 ", -1)]]),
162
+ _: 1
163
+ }, 8, ["checked", "class"])]), createElementVNode("div", _hoisted_6, [createVNode(unref(QuestionCircleOutlined), { class: "mr-5px" }), E[6] ||= createTextVNode("白名单模式下,仅不加密过滤列表中的接口;黑名单模式下,仅加密过滤列表中的接口。 ", -1)])])]),
166
164
  _: 1
167
165
  })]),
168
166
  _: 1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo-pr/module-crypto",
3
3
  "type": "module",
4
- "version": "0.189.2",
4
+ "version": "0.200.1",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -23,10 +23,10 @@
23
23
  "@ant-design/icons-vue": "^7.0.1",
24
24
  "@pubinfo/pro-components": "^1.8.0",
25
25
  "ant-design-vue": "^4.2.6",
26
- "pubinfo-pr": "0.189.2"
26
+ "pubinfo-pr": "0.200.1"
27
27
  },
28
28
  "dependencies": {
29
- "@vueuse/core": "^13.7.0",
29
+ "@vueuse/core": "^14.1.0",
30
30
  "crypto-js": "^4.2.0",
31
31
  "gm-crypto": "^0.1.12",
32
32
  "jsencrypt": "^3.3.2"
@@ -36,7 +36,7 @@
36
36
  "@pubinfo/pro-components": "^1.8.0",
37
37
  "@types/crypto-js": "^4.2.2",
38
38
  "ant-design-vue": "^4.2.6",
39
- "pubinfo-pr": "0.189.2"
39
+ "pubinfo-pr": "0.200.1"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "pubinfo build -w --sourcemap",
@@ -48,7 +48,7 @@ async function encryptMethod(method: RequestMethod, fun: (arg0: string) => Promi
48
48
  }
49
49
  if (method.config.meta && method.config.meta.pathParams) {
50
50
  for (const item of method.config.meta.pathParams) {
51
- method.url = method.url.replace(item, await fun(item));
51
+ method.url = method.url.replace(item, await fun(`${item}`));
52
52
  }
53
53
  }
54
54
  }