gzjs-utils 1.0.2-7.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 ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "gzjs-utils",
3
+ "version": "1.0.27.1",
4
+ "description": "smart js utils",
5
+ "main": "lib/index.cjs",
6
+ "module": "lib/index.mjs",
7
+ "browser": "lib/index.umd.js",
8
+ "typings": "types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./lib/index.mjs",
12
+ "require": "./lib/index.cjs",
13
+ "browser": "./lib/index.umd.js",
14
+ "types": "./types/index.d.ts"
15
+ }
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://gitee.com/xiyuan-lgz/gzjs-utils.git"
20
+ },
21
+ "keywords": [
22
+ "js-utils",
23
+ "util",
24
+ "AES",
25
+ "Base64",
26
+ "MD5",
27
+ "SHA",
28
+ "SHA1",
29
+ "SHA224",
30
+ "SHA256",
31
+ "SHA384",
32
+ "SHA512",
33
+ "Hmac",
34
+ "Bytes"
35
+ ],
36
+ "author": "xiyuan-lgz",
37
+ "license": "ISC",
38
+ "engines": {
39
+ "node": ">=10"
40
+ },
41
+ "files": [
42
+ "lib",
43
+ "types",
44
+ "LICENSE"
45
+ ]
46
+ }
@@ -0,0 +1,12 @@
1
+ import { default as JsUtils } from './utils';
2
+ import { default as AES } from './utils/AES';
3
+ import { default as Base64 } from './utils/Base64';
4
+ import { default as MD5 } from './utils/MD5';
5
+ import { default as Hmac } from './utils/Hmac';
6
+ import { default as SHA } from './utils/SHA';
7
+ import { default as Bytes } from './utils/Bytes';
8
+ import { default as TreeUtils } from './utils/TreeUtils';
9
+ import { default as Regexps } from './utils/Regexps';
10
+ import { default as DateUtils } from './utils/DateUtils';
11
+ export default JsUtils;
12
+ export { AES, JsUtils, Base64, Bytes, MD5, Hmac, SHA, TreeUtils, Regexps, DateUtils, };
@@ -0,0 +1,140 @@
1
+ export type IV = number[] | string | Uint8Array | Int8Array;
2
+ export type Options = {
3
+ /**
4
+ * 填充方式 pck7padding
5
+ */
6
+ padding?: string | "PKCS#5" | "PKCS#7" | "NoPadding" | "PKCS5Padding" | "PKCS7Padding" | "pkcs5padding" | "pkcs7padding";
7
+ /**
8
+ * 16 bytes iv
9
+ */
10
+ iv?: IV;
11
+ /**
12
+ * 分段大小
13
+ */
14
+ segmentSize?: number;
15
+ /**
16
+ * CTR 模式参数 向量初始值
17
+ */
18
+ count?: IV | number;
19
+ };
20
+ declare const provders: {
21
+ ECB: {
22
+ /**
23
+ * ECB 模式 加密
24
+ * @param key 加密密钥
25
+ * @param plaintext 待加密的数据内容
26
+ * @param opts
27
+ */
28
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding">): Uint8Array;
29
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding">): Uint8Array<ArrayBufferLike>;
30
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding">): string;
31
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding">): string;
32
+ };
33
+ CBC: {
34
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array;
35
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array<ArrayBufferLike>;
36
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding" | "iv">): string;
37
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding" | "iv">): string;
38
+ };
39
+ CFB: {
40
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv" | "segmentSize">): Uint8Array;
41
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv" | "segmentSize">): Uint8Array<ArrayBufferLike>;
42
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding" | "iv" | "segmentSize">): string;
43
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding" | "iv" | "segmentSize">): string;
44
+ };
45
+ OFB: {
46
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array;
47
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array<ArrayBufferLike>;
48
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding" | "iv">): string;
49
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding" | "iv">): string;
50
+ };
51
+ CTR: {
52
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array;
53
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array<ArrayBufferLike>;
54
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding" | "iv">): string;
55
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding" | "iv">): string;
56
+ };
57
+ };
58
+ export type Mode = keyof typeof provders | string;
59
+ export type Opts = Options & {
60
+ /**
61
+ * 加密模式
62
+ */
63
+ mode?: Mode;
64
+ };
65
+ export declare const _AES_: {
66
+ /**
67
+ * 获取允许的加密模式
68
+ */
69
+ modes(): string[];
70
+ /**
71
+ * 加密函数
72
+ * @param text 待加密内容
73
+ * @param key 加密密钥
74
+ * @param opts 加密套件参数
75
+ * @return 返回 Uint8Array 数据数组
76
+ */
77
+ encrypt(key: string, text: string, opts?: Opts): Uint8Array;
78
+ /**
79
+ * 解密
80
+ * @param text 加密的内容 hex内容格式
81
+ * @param key 解密密钥
82
+ * @param opts 加密套件参数
83
+ * @return 返回 Uint8Array 数据数组
84
+ */
85
+ decrypt(key: string, text: string, opts?: Opts): Uint8Array;
86
+ /**
87
+ * 加密密钥
88
+ * @param text 待加密内容
89
+ * @param key 加密密钥
90
+ * @param opts 加密套件参数
91
+ * @return 加密后的 hex 内容
92
+ */
93
+ encode(key: string, text: string, opts?: Opts): string;
94
+ /**
95
+ * 解密
96
+ * @param text 加密的内容 hex内容格式
97
+ * @param key 解密密钥
98
+ * @param opts 加密套件参数
99
+ * @return 解密后的字符串
100
+ */
101
+ decode(key: string, text: string, opts?: Opts): any;
102
+ ECB: {
103
+ /**
104
+ * ECB 模式 加密
105
+ * @param key 加密密钥
106
+ * @param plaintext 待加密的数据内容
107
+ * @param opts
108
+ */
109
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding">): Uint8Array;
110
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding">): Uint8Array<ArrayBufferLike>;
111
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding">): string;
112
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding">): string;
113
+ };
114
+ CBC: {
115
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array;
116
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array<ArrayBufferLike>;
117
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding" | "iv">): string;
118
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding" | "iv">): string;
119
+ };
120
+ CFB: {
121
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv" | "segmentSize">): Uint8Array;
122
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv" | "segmentSize">): Uint8Array<ArrayBufferLike>;
123
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding" | "iv" | "segmentSize">): string;
124
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding" | "iv" | "segmentSize">): string;
125
+ };
126
+ OFB: {
127
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array;
128
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array<ArrayBufferLike>;
129
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding" | "iv">): string;
130
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding" | "iv">): string;
131
+ };
132
+ CTR: {
133
+ encrypt(key: string, plaintext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array;
134
+ decrypt(key: string, ciphertext: Uint8Array | Int8Array, opts?: Pick<Options, "padding" | "iv">): Uint8Array<ArrayBufferLike>;
135
+ encode(key: string, plaintext: string, opts?: Pick<Options, "padding" | "iv">): string;
136
+ decode(key: string, ciphertext: string, opts?: Pick<Options, "padding" | "iv">): string;
137
+ };
138
+ };
139
+ export default _AES_;
140
+ export declare type AES = typeof _AES_;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * 判断是否为base64 内容
3
+ * @param str
4
+ */
5
+ export declare function is(str: any): boolean;
6
+ /**
7
+ * base64 加密
8
+ * @param input 需要解密的内容
9
+ */
10
+ export declare function encode(input: any): string;
11
+ /**
12
+ * base64 解密
13
+ * @param input 待解密内容
14
+ */
15
+ export declare function decode(input: any): string;
16
+ export declare function encrypt(input: any): Int8Array;
17
+ export declare function decrypt(input: any): Int8Array;
18
+ declare const _Base64_: {
19
+ /**
20
+ * 判断是否为base64 内容
21
+ * @param str
22
+ */
23
+ is: typeof is;
24
+ /**
25
+ * base64 加密
26
+ * @param input 需要解密的内容
27
+ */
28
+ encode: typeof encode;
29
+ /**
30
+ * base64 解密
31
+ * @param input 待解密内容
32
+ */
33
+ decode: typeof decode;
34
+ /**
35
+ * 加密数据
36
+ * @param input
37
+ */
38
+ decrypt: typeof decrypt;
39
+ /**
40
+ * 解密数据
41
+ * @param input
42
+ */
43
+ encrypt: typeof encrypt;
44
+ };
45
+ export default _Base64_;
46
+ export declare type Base64 = typeof _Base64_;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * 字符串转字节数组,
3
+ * @param str 字符串
4
+ */
5
+ declare function toBytes(str: string): Int8Array;
6
+ /**
7
+ * 字节数组转字符串
8
+ * @param {Int8Array|Uint8Array|[Number]} bytes 字节数组
9
+ */
10
+ declare function fromBytes(bytes: Int8Array | Uint8Array | number[] | unknown): string;
11
+ /**
12
+ * 将 数字 转换成 byte, [-128, 127]
13
+ * @param num
14
+ */
15
+ declare function byte(num: string | number): number;
16
+ /**
17
+ * 字符串转 16进制字符串
18
+ * @param str 字符串
19
+ */
20
+ declare function toHex(str: string | number | number[] | Int8Array | Uint8Array): string;
21
+ /**
22
+ * 将十六进制字符串 转化为 Int8Array
23
+ * @param hexs
24
+ */
25
+ declare function fromHex(hexs: string): Int8Array<ArrayBuffer>;
26
+ /**
27
+ * 十六进制字符串转String
28
+ * @param hex
29
+ */
30
+ declare function hex2str(hex: string): string;
31
+ /**
32
+ *
33
+ * @param str
34
+ */
35
+ declare function toUint8Array(str: string | Int8Array | Uint8Array | number[] | any): Uint8Array;
36
+ declare const _Bytes_: {
37
+ /**
38
+ * 将 数字 转换成 byte, [-128, 127]
39
+ * @param num
40
+ */
41
+ byte: typeof byte;
42
+ /**
43
+ * 字符串转字节数组,
44
+ * @param str 字符串
45
+ */
46
+ toBytes: typeof toBytes;
47
+ /**
48
+ * 字节数组转字符串
49
+ * @param {Int8Array|Uint8Array|[Number]} bytes 字节数组
50
+ */
51
+ fromBytes: typeof fromBytes;
52
+ /**
53
+ * 字符串转 16进制字符串
54
+ * @param str 字符串
55
+ */
56
+ toHex: typeof toHex;
57
+ /**
58
+ * 将十六进制字符串 转化为 Int8Array
59
+ * @param hexs
60
+ */
61
+ fromHex: typeof fromHex;
62
+ /**
63
+ * 字符串转 hex 字符串
64
+ * @param str
65
+ */
66
+ str2hex: typeof toHex;
67
+ /**
68
+ * 十六进制字符串转String
69
+ * @param hex
70
+ */
71
+ hex2str: typeof hex2str;
72
+ };
73
+ export { toBytes, fromBytes, toHex, hex2str, fromHex, byte, toUint8Array };
74
+ export default _Bytes_;
75
+ export type Bytes = typeof _Bytes_;
@@ -0,0 +1,45 @@
1
+ export interface ConsoleInstance {
2
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/assert_static) */
3
+ assert(condition?: boolean, ...data: any[]): void;
4
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
5
+ clear(): void;
6
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
7
+ count(label?: string): void;
8
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */
9
+ countReset(label?: string): void;
10
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
11
+ debug(...data: any[]): void;
12
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
13
+ dir(item?: any, options?: any): void;
14
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
15
+ dirxml(...data: any[]): void;
16
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
17
+ error(...data: any[]): void;
18
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
19
+ group(...data: any[]): void;
20
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */
21
+ groupCollapsed(...data: any[]): void;
22
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */
23
+ groupEnd(): void;
24
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
25
+ info(...data: any[]): void;
26
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
27
+ log(...data: any[]): void;
28
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
29
+ table(tabularData?: any, properties?: string[]): void;
30
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
31
+ time(label?: string): void;
32
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
33
+ timeEnd(label?: string): void;
34
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */
35
+ timeLog(label?: string, ...data: any[]): void;
36
+ timeStamp(label?: string): void;
37
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
38
+ trace(...data: any[]): void;
39
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
40
+ warn(...data: any[]): void;
41
+ }
42
+ export declare const Console: any;
43
+ declare const _default: ConsoleInstance;
44
+ export default _default;
45
+ export declare const getNativeConsole: () => Console;
@@ -0,0 +1,64 @@
1
+ declare const _DateUtils_: {
2
+ /**
3
+ * 指定日期获取值,返回格式 yyyy-MM-dd hh:mm:ss
4
+ * @param date 指定时间, 默认=当前时间
5
+ */
6
+ getDateTime(date?: Date): string;
7
+ /**
8
+ * 指定日期获取值, 返回格式 yyyy-MM-dd
9
+ * @param date 指定时间, 默认=当前时间
10
+ */
11
+ getDateString(date?: Date): string;
12
+ /**
13
+ * 指定日期获取值,返回格式 yyyyMMdd
14
+ * @param date 指定时间, 默认=当前时间
15
+ */
16
+ getDateInt(date?: any): string;
17
+ /**
18
+ * 日期格式化<br>
19
+ *
20
+ * <pre>
21
+ * fmt 参数 接受内容如下:
22
+ * Y|y = 年, 范围:yy | yyyy | YY |YYYY。yy|YY = 表示2025 中的25
23
+ * M = 月, 范围:M: 1-12,MM: 01-12
24
+ * d = 日, 范围:d: 1-31,dd: 01-31
25
+ * H = 时, 范围:H: 0-23,HH: 00-23
26
+ * H = 时, 范围:h: 0-12,hh: 00-12
27
+ * m = 分, 范围:h: 0-59,mm: 00-59
28
+ * s = 秒, 范围:s: 0-59,ss: 00-59
29
+ * f|F|S = 毫秒,范围:s: 0-9,ff: 00-99,fff:000-999
30
+ * A = AM | PM
31
+ * a = am | pm
32
+ * w = 一周中的一天,范围:w: 0-6,ww:00-06
33
+ * W = 星期几,Sunday - Saturday
34
+ * </pre>
35
+ *
36
+ * @param date
37
+ * @param fmt 格式内容
38
+ */
39
+ format(date: Date, fmt: string): string;
40
+ /**
41
+ * 解析时间
42
+ * @param s
43
+ * @param fmt
44
+ */
45
+ parse(s: string | Date, fmt?: string): Date;
46
+ /**
47
+ * 获取时间差
48
+ * @param start 开始时间
49
+ * @param end 结束时间
50
+ */
51
+ diff(start: string | Date, end?: string | Date): {
52
+ day: number;
53
+ hour: number;
54
+ minute: number;
55
+ second: number;
56
+ millisecond: number;
57
+ diff: number;
58
+ };
59
+ };
60
+ export default _DateUtils_;
61
+ /**
62
+ * 日期工具类
63
+ */
64
+ export declare type DateUtils = typeof _DateUtils_;
@@ -0,0 +1,35 @@
1
+ import { EnumItem } from './index';
2
+ type SimpleType = string | number | boolean | undefined | null;
3
+ interface ET extends EnumItem {
4
+ }
5
+ type ExtType = {
6
+ eq?(val: SimpleType | ET | any): boolean;
7
+ };
8
+ /**
9
+ * 构建并返回传入的对象
10
+ * @param valueField
11
+ * @param textField
12
+ * @param obj
13
+ * @param props
14
+ */
15
+ declare function build<KT extends string, ES>(valueField: KT, textField: KT, obj: ES, props?: KT[] | KT): { [K in keyof ES]: ES[K] & ET & Required<ExtType>; } & {
16
+ /**
17
+ * 获取枚举项
18
+ * @param key
19
+ */
20
+ get<K_1 = { [k in keyof ES]: ES[k]; }>(key: K_1 | string | number): ES[keyof ES] & ET & Required<ExtType> & { [P in KT]: any; };
21
+ /**
22
+ * 枚举列表
23
+ */
24
+ list: (ES[keyof ES] & ET & Required<ExtType> & { [P in KT]: any; })[];
25
+ /**
26
+ * 获取枚举名称
27
+ * @param value 枚举项名称或者 枚举类对象
28
+ * @param defaultValue 默认值
29
+ */
30
+ getLabel(value: SimpleType | (ES[keyof ES] & ET & Required<ExtType> & { [P in KT]: any; }), defaultValue?: string): string;
31
+ };
32
+ declare const EnumBuilder: {
33
+ build: typeof build;
34
+ };
35
+ export default EnumBuilder;
@@ -0,0 +1,3 @@
1
+ export type Env = typeof process.env & Record<any, any>;
2
+ export declare const isDevelopment: (value: string) => value is "development" | "dev" | "debug" | "test" | "preview";
3
+ export declare const getEnvironments: () => Env;
@@ -0,0 +1,74 @@
1
+ export declare function set_exp_utils(tool: any): void;
2
+ declare const _ExpUtils_: {
3
+ defaultVars: {
4
+ Math: Math;
5
+ Date: DateConstructor;
6
+ RegExp: RegExpConstructor;
7
+ JSON: JSON;
8
+ String: StringConstructor;
9
+ Array: ArrayConstructor;
10
+ Object: ObjectConstructor;
11
+ Number: NumberConstructor;
12
+ Boolean: BooleanConstructor;
13
+ Function: FunctionConstructor;
14
+ Symbol: SymbolConstructor;
15
+ Map: MapConstructor;
16
+ WeakMap: WeakMapConstructor;
17
+ Set: SetConstructor;
18
+ WeakSet: WeakSetConstructor;
19
+ console: Console;
20
+ E: number;
21
+ LN10: number;
22
+ LN2: number;
23
+ LOG2E: number;
24
+ LOG10E: number;
25
+ PI: number;
26
+ SQRT1_2: number;
27
+ SQRT2: number;
28
+ abs(x: number): number;
29
+ acos(x: number): number;
30
+ asin(x: number): number;
31
+ atan(x: number): number;
32
+ atan2(y: number, x: number): number;
33
+ ceil(x: number): number;
34
+ cos(x: number): number;
35
+ exp(x: number): number;
36
+ floor(x: number): number;
37
+ log(x: number): number;
38
+ max(...values: number[]): number;
39
+ min(...values: number[]): number;
40
+ pow(x: number, y: number): number;
41
+ random(): number;
42
+ round(x: number): number;
43
+ sin(x: number): number;
44
+ sqrt(x: number): number;
45
+ tan(x: number): number;
46
+ clz32(x: number): number;
47
+ imul(x: number, y: number): number;
48
+ sign(x: number): number;
49
+ log10(x: number): number;
50
+ log2(x: number): number;
51
+ log1p(x: number): number;
52
+ expm1(x: number): number;
53
+ cosh(x: number): number;
54
+ sinh(x: number): number;
55
+ tanh(x: number): number;
56
+ acosh(x: number): number;
57
+ asinh(x: number): number;
58
+ atanh(x: number): number;
59
+ hypot(...values: number[]): number;
60
+ trunc(x: number): number;
61
+ fround(x: number): number;
62
+ cbrt(x: number): number;
63
+ f16round(x: number): number;
64
+ [Symbol.toStringTag]: string;
65
+ };
66
+ /**
67
+ * 执行表达式
68
+ * @param expression 表达式文本
69
+ * @param params 运行参数
70
+ */
71
+ execute(expression: string, params: Record<any, any>): any;
72
+ };
73
+ export default _ExpUtils_;
74
+ export type ExpUtils = typeof _ExpUtils_;
@@ -0,0 +1,81 @@
1
+ import { default as CryptoJS } from 'crypto-js';
2
+ /**
3
+ * 输入类型:string | Uint8Array | Int8Array | number[]
4
+ */
5
+ type HmacInput = string | Uint8Array | Int8Array | number[];
6
+ /**
7
+ * HMAC (Hash-based Message Authentication Code) 工具类
8
+ * 基于 crypto-js 实现,支持 MD5、SHA1、SHA224、SHA256、SHA384、SHA512
9
+ */
10
+ declare const _Hmac_: {
11
+ /**
12
+ * HMAC-MD5 加密
13
+ * @param key 密钥
14
+ * @param data 待加密数据
15
+ * @returns 16 进制字符串(32 字符)
16
+ */
17
+ md5(key: HmacInput, data: HmacInput): string;
18
+ /**
19
+ * HMAC-SHA1 加密
20
+ * @param key 密钥
21
+ * @param data 待加密数据
22
+ * @returns 16 进制字符串(40 字符)
23
+ */
24
+ sha1(key: HmacInput, data: HmacInput): string;
25
+ /**
26
+ * HMAC-SHA224 加密
27
+ * @param key 密钥
28
+ * @param data 待加密数据
29
+ * @returns 16 进制字符串(56 字符)
30
+ */
31
+ sha224(key: HmacInput, data: HmacInput): string;
32
+ /**
33
+ * HMAC-SHA256 加密
34
+ * @param key 密钥
35
+ * @param data 待加密数据
36
+ * @returns 16 进制字符串(64 字符)
37
+ */
38
+ sha256(key: HmacInput, data: HmacInput): string;
39
+ /**
40
+ * HMAC-SHA384 加密
41
+ * @param key 密钥
42
+ * @param data 待加密数据
43
+ * @returns 16 进制字符串(96 字符)
44
+ */
45
+ sha384(key: HmacInput, data: HmacInput): string;
46
+ /**
47
+ * HMAC-SHA512 加密
48
+ * @param key 密钥
49
+ * @param data 待加密数据
50
+ * @returns 16 进制字符串(128 字符)
51
+ */
52
+ sha512(key: HmacInput, data: HmacInput): string;
53
+ /**
54
+ * HMAC-SHA256 返回 WordArray(用于内部调用)
55
+ * @param key 密钥
56
+ * @param data 待加密数据
57
+ * @returns CryptoJS WordArray
58
+ */
59
+ SHA256(key: HmacInput, data: HmacInput): CryptoJS.lib.WordArray;
60
+ /**
61
+ * HMAC-SHA512 返回 WordArray(用于内部调用)
62
+ * @param key 密钥
63
+ * @param data 待加密数据
64
+ * @returns CryptoJS WordArray
65
+ */
66
+ SHA512(key: HmacInput, data: HmacInput): CryptoJS.lib.WordArray;
67
+ /**
68
+ * HMAC-SHA1 返回 WordArray
69
+ */
70
+ SHA1(key: HmacInput, data: HmacInput): CryptoJS.lib.WordArray;
71
+ /**
72
+ * HMAC-SHA224 返回 WordArray
73
+ */
74
+ SHA224(key: HmacInput, data: HmacInput): CryptoJS.lib.WordArray;
75
+ /**
76
+ * HMAC-SHA384 返回 WordArray
77
+ */
78
+ SHA384(key: HmacInput, data: HmacInput): CryptoJS.lib.WordArray;
79
+ };
80
+ export default _Hmac_;
81
+ export type Hmac = typeof _Hmac_;