@yqg/simple 1.0.0 → 1.0.1-beta.1.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/README.md +221 -4
- package/dist/constant/fields.d.ts +1 -1
- package/dist/index-1632f3d7.js +2 -0
- package/dist/index-1632f3d7.js.map +1 -0
- package/dist/index-66c4e9f4.js +2 -0
- package/dist/index-66c4e9f4.js.map +1 -0
- package/dist/index-87a0d73b.js +2 -0
- package/dist/index-87a0d73b.js.map +1 -0
- package/dist/index-9f0efb47.js +2 -0
- package/dist/index-9f0efb47.js.map +1 -0
- package/dist/index-a9c19e9c.js +2 -0
- package/dist/index-a9c19e9c.js.map +1 -0
- package/dist/index-bad730f4.js +2 -0
- package/dist/index-bad730f4.js.map +1 -0
- package/dist/index-c1aefa89.js +2 -0
- package/dist/index-c1aefa89.js.map +1 -0
- package/dist/index-d7b51690.js +2 -0
- package/dist/index-d7b51690.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +66 -2
- package/src/constant/fields.ts +2 -2
- package/src/index.js +3 -0
- package/src/types/mixin/index.d.ts +60 -0
- package/src/types/util/enum.d.ts +20 -0
- package/src/types/util/format-map.d.ts +84 -0
- package/src/types/util/index.d.ts +19 -0
- package/src/types/util/json.d.ts +21 -0
- package/src/types/util/keyCodeMap.d.ts +26 -0
- package/src/types/util/local-storage.d.ts +26 -0
- package/src/types/util/object.d.ts +91 -0
- package/src/types/util/storage.d.ts +62 -0
- package/src/types/util/swim-lane.d.ts +15 -0
- package/src/types/util/tool.d.ts +13 -0
- package/src/util/tool.js +0 -41
package/src/util/tool.js
CHANGED
|
@@ -5,47 +5,6 @@
|
|
|
5
5
|
* @Last Modified time: 2022-10-20 18:15:32
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import CryptoJS from 'crypto-js';
|
|
9
|
-
|
|
10
|
-
const CALL_SECRET = 'ainiliangwannian';
|
|
11
|
-
/**
|
|
12
|
-
* AES 解密
|
|
13
|
-
* @param ciphertext, key
|
|
14
|
-
* @returns utf8字符串
|
|
15
|
-
*/
|
|
16
|
-
export const aesDecrypt = (ciphertext, key = CALL_SECRET) => {
|
|
17
|
-
if (ciphertext) {
|
|
18
|
-
const encodeKey = CryptoJS.enc.Utf8.parse(key);
|
|
19
|
-
const decrypted = CryptoJS.AES.decrypt(ciphertext, encodeKey, {
|
|
20
|
-
mode: CryptoJS.mode.ECB,
|
|
21
|
-
padding: CryptoJS.pad.Pkcs7
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return decrypted.toString(CryptoJS.enc.Utf8);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return ciphertext;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* AES 加密
|
|
32
|
-
* @param message, key
|
|
33
|
-
* @returns 密码对象Base64字符串
|
|
34
|
-
*/
|
|
35
|
-
export const aesEncrypt = (message, key = CALL_SECRET) => {
|
|
36
|
-
if (message) {
|
|
37
|
-
const encodeKey = CryptoJS.enc.Utf8.parse(key);
|
|
38
|
-
const ciphertext = CryptoJS.AES.encrypt(message, encodeKey, {
|
|
39
|
-
mode: CryptoJS.mode.ECB,
|
|
40
|
-
padding: CryptoJS.pad.Pkcs7
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return ciphertext.toString();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return message;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
8
|
const isString = value => (typeof value === 'string');
|
|
50
9
|
/* 驼峰转换为下划线链接,例如camelStr => camel_str */
|
|
51
10
|
export const camelCaseToUnderscore = camelStr => (
|