@brushes/component-core 1.1.6 → 2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brushes/component-core",
3
- "version": "1.1.6",
3
+ "version": "2.0.1",
4
4
  "main": "src/index.ts",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -4,7 +4,7 @@ import { useMountedRef } from '@brushes/form';
4
4
  import { get } from '@brushes/request';
5
5
  import { encryptBySM2 } from '../tool';
6
6
 
7
- export const CodeComponent = ({ api = '/web/ml/muser/sendPhone.json', codeKey, height = 36, encryption = false }: { codeKey?: string; api?: string; height?: number; encryption?: boolean }) => {
7
+ export const CodeComponent = ({ api = '/web/ml/muser/sendPhone.json', codeKey, height = 36, encryption = true }: { codeKey?: string; api?: string; height?: number; encryption?: boolean }) => {
8
8
  const form = Form.useFormInstance();
9
9
  const verCode = form.getFieldValue('verCode');
10
10
  const [dataTime, setDataTime] = useState(0);
@@ -13,7 +13,7 @@ const useStyle = createStyles(({ token, css }, { height }: { height: number }) =
13
13
  `
14
14
  };
15
15
  });
16
- export const ImageCodeComponent = ({ api = '/web/ml/mlogin/getVerCode.img', codeKey, height = 40, encryption = false }: { api?: string; codeKey?: string; height?: number; encryption?: boolean }) => {
16
+ export const ImageCodeComponent = ({ api = '/web/ml/mlogin/getVerCode.img', codeKey, height = 40, encryption = true }: { api?: string; codeKey?: string; height?: number; encryption?: boolean }) => {
17
17
  const { styles } = useStyle({ height });
18
18
  const form = Form.useFormInstance();
19
19
  const isDisabled = form.getFieldValue('isDisabled');
@@ -19,9 +19,9 @@ const requestPublicKey = async (): Promise<string> => {
19
19
  return publicKey;
20
20
  };
21
21
 
22
- const getPublicKey = async () => {
22
+ const getPublicKey = (): Promise<string> => {
23
23
  if (!publicKeyPromise) {
24
- publicKeyPromise = await requestPublicKey().catch((error) => {
24
+ publicKeyPromise = requestPublicKey().catch((error) => {
25
25
  publicKeyPromise = null;
26
26
  throw error;
27
27
  });
@@ -35,7 +35,7 @@ export const encryptBySM2 = async (plainText: string): Promise<string> => {
35
35
  const publicKey = await getPublicKey();
36
36
  return `04${sm2.doEncrypt(String(plainText), publicKey, 1)}`;
37
37
  } catch (error) {
38
- message.error('SM2 密钥获取失败');
38
+ // message.error('SM2 密钥获取失败');
39
39
  return plainText;
40
40
  }
41
41
  };