@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
package/src/components/code.tsx
CHANGED
|
@@ -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 =
|
|
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);
|
package/src/components/image.tsx
CHANGED
|
@@ -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 =
|
|
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');
|
package/src/tool/sm2Crypto.ts
CHANGED
|
@@ -19,9 +19,9 @@ const requestPublicKey = async (): Promise<string> => {
|
|
|
19
19
|
return publicKey;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const getPublicKey =
|
|
22
|
+
const getPublicKey = (): Promise<string> => {
|
|
23
23
|
if (!publicKeyPromise) {
|
|
24
|
-
publicKeyPromise =
|
|
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
|
};
|