ms-types 0.3.23 → 0.3.24
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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare namespace cryptoUtils {
|
|
2
|
+
/// 使用AES CBC模式加密数据 默认使用PKCS7填充
|
|
3
|
+
/// - Parameters:
|
|
4
|
+
/// - aesKey: AES密钥
|
|
5
|
+
/// - data: 要加密的数据
|
|
6
|
+
/// - noPadding: 是否禁用填充,默认为false
|
|
7
|
+
/// - Returns: 加密后的数据
|
|
8
|
+
function encryptWithAES(
|
|
9
|
+
aesKey: string,
|
|
10
|
+
data: string,
|
|
11
|
+
noPadding?: boolean
|
|
12
|
+
): string;
|
|
13
|
+
|
|
14
|
+
/// 使用AES CBC模式解密数据 默认使用PKCS7填充
|
|
15
|
+
/// - Parameters:
|
|
16
|
+
/// - aesKey: AES密钥
|
|
17
|
+
/// - data: 要解密的数据
|
|
18
|
+
/// - noPadding: 是否禁用填充,默认为false
|
|
19
|
+
/// - Returns: 解密后的数据
|
|
20
|
+
function decryptWithAES(
|
|
21
|
+
aesKey: string,
|
|
22
|
+
data: string,
|
|
23
|
+
noPadding?: boolean
|
|
24
|
+
): string;
|
|
25
|
+
|
|
26
|
+
/// 使用RSA公钥加密数据 默认使用PKCS1填充
|
|
27
|
+
/// - Parameters:
|
|
28
|
+
/// - rsaPublicKey: RSA公钥
|
|
29
|
+
/// - data: 要加密的数据
|
|
30
|
+
/// - Returns: 加密后的数据
|
|
31
|
+
function encryptWithRSA(rsaPublicKey: string, data: string): string;
|
|
32
|
+
|
|
33
|
+
/// 使用RSA私钥解密数据 默认使用PKCS1填充
|
|
34
|
+
/// - Parameters:
|
|
35
|
+
/// - rsaPrivateKey: RSA私钥
|
|
36
|
+
/// - data: 要解密的数据
|
|
37
|
+
/// - Returns: 解密后的数据
|
|
38
|
+
function decryptWithRSA(rsaPrivateKey: string, data: string): string;
|
|
39
|
+
|
|
40
|
+
/// 计算MD5值
|
|
41
|
+
/// - Parameters:
|
|
42
|
+
/// - data: 要计算MD5的值
|
|
43
|
+
/// - Returns: MD5值
|
|
44
|
+
function md5(data: string): string;
|
|
45
|
+
|
|
46
|
+
/// 计算SHA1值
|
|
47
|
+
/// - Parameters:
|
|
48
|
+
/// - data: 要计算SHA1的值
|
|
49
|
+
/// - Returns: SHA1值
|
|
50
|
+
function sha1(data: string): string;
|
|
51
|
+
|
|
52
|
+
/// 计算SHA256值
|
|
53
|
+
/// - Parameters:
|
|
54
|
+
/// - data: 要计算SHA256的值
|
|
55
|
+
/// - Returns: SHA256值
|
|
56
|
+
function sha256(data: string): string;
|
|
57
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference path="action.d.ts" />
|
|
2
2
|
/// <reference path="appleOcr.d.ts" />
|
|
3
3
|
/// <reference path="config.d.ts" />
|
|
4
|
+
/// <reference path="cryptoUtils.d.ts" />
|
|
4
5
|
/// <reference path="device.d.ts" />
|
|
5
6
|
/// <reference path="file.d.ts" />
|
|
6
7
|
/// <reference path="global.d.ts" />
|
package/types/utils.d.ts
CHANGED
|
@@ -25,4 +25,37 @@ declare namespace utils {
|
|
|
25
25
|
* utils.takeMeToFront()
|
|
26
26
|
*/
|
|
27
27
|
function takeMeToFront(): boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 字符串转base64
|
|
31
|
+
* @param source 字符串
|
|
32
|
+
* @returns base64字符串
|
|
33
|
+
* @example
|
|
34
|
+
* utils.base64Encoded("hello")
|
|
35
|
+
*/
|
|
36
|
+
function base64Encoded(source: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* base64转字符串
|
|
39
|
+
* @param source base64字符串
|
|
40
|
+
* @returns 字符串
|
|
41
|
+
* @example
|
|
42
|
+
* utils.base64Decoded("aGVsbG8=")
|
|
43
|
+
*/
|
|
44
|
+
function base64Decoded(source: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* 16进制字符串转 base64
|
|
47
|
+
* @param hexString 16进制字符串
|
|
48
|
+
* @returns base64字符串
|
|
49
|
+
* @example
|
|
50
|
+
* utils.hexStringBase64Encoded("68656c6c6f")
|
|
51
|
+
*/
|
|
52
|
+
function hexStringBase64Encoded(hexString: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* base64 转 16进制字符串
|
|
55
|
+
* @param base64HexString base64字符串
|
|
56
|
+
* @returns 16进制字符串
|
|
57
|
+
* @example
|
|
58
|
+
* utils.hexStringBase64Decoded("aGVsbG8=")
|
|
59
|
+
*/
|
|
60
|
+
function hexStringBase64Decoded(base64HexString: string): string;
|
|
28
61
|
}
|
|
@@ -27,4 +27,36 @@ declare namespace $工具 {
|
|
|
27
27
|
* $工具.APP切入前台()
|
|
28
28
|
*/
|
|
29
29
|
function APP切入前台(): 布尔值;
|
|
30
|
+
/**
|
|
31
|
+
* 字符串转base64
|
|
32
|
+
* @param source 字符串
|
|
33
|
+
* @returns base64字符串
|
|
34
|
+
* @example
|
|
35
|
+
* $工具.字符串转base64("hello")
|
|
36
|
+
*/
|
|
37
|
+
function 字符串转base64(源字符串: 字符串): 字符串;
|
|
38
|
+
/**
|
|
39
|
+
* base64转字符串
|
|
40
|
+
* @param source base64字符串
|
|
41
|
+
* @returns 字符串
|
|
42
|
+
* @example
|
|
43
|
+
* $工具.base64转字符串("aGVsbG8=")
|
|
44
|
+
*/
|
|
45
|
+
function base64转字符串(源base64字符串: 字符串): 字符串;
|
|
46
|
+
/**
|
|
47
|
+
* 16进制字符串转 base64
|
|
48
|
+
* @param hexString 16进制字符串
|
|
49
|
+
* @returns base64字符串
|
|
50
|
+
* @example
|
|
51
|
+
* $工具.hex字符串转base64("68656c6c6f")
|
|
52
|
+
*/
|
|
53
|
+
function hex字符串转base64(源16进制字符串: 字符串): 字符串;
|
|
54
|
+
/**
|
|
55
|
+
* base64 转 16进制字符串
|
|
56
|
+
* @param base64HexString base64字符串
|
|
57
|
+
* @returns 16进制字符串
|
|
58
|
+
* @example
|
|
59
|
+
* $工具.base64转hex字符串("aGVsbG8=")
|
|
60
|
+
*/
|
|
61
|
+
function base64转hex字符串(源base64字符串: 字符串): 字符串;
|
|
30
62
|
}
|