ddan-js 2.7.9 → 2.8.0
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/bin/ddan-js.esm.js +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/lib/index.js +1 -0
- package/bin/lib/modules/convert/base.js +112 -0
- package/bin/lib/modules/convert/index.js +4 -47
- package/bin/lib/modules/convert/pkcs.js +16 -0
- package/bin/lib/modules/crypto/index.js +2 -0
- package/bin/lib/modules/crypto/tea.js +78 -0
- package/bin/lib/modules/hook/index.js +2 -0
- package/bin/lib/modules/hook/log.js +30 -0
- package/bin/lib/modules/string/index.js +28 -17
- package/bin/types/index.d.ts +88 -15
- package/bin/types/modules/convert/base.d.ts +14 -0
- package/bin/types/modules/convert/index.d.ts +13 -5
- package/bin/types/modules/convert/pkcs.d.ts +5 -0
- package/bin/types/modules/crypto/index.d.ts +9 -0
- package/bin/types/modules/crypto/tea.d.ts +10 -0
- package/bin/types/modules/hook/index.d.ts +2 -0
- package/bin/types/modules/hook/log.d.ts +5 -0
- package/bin/types/modules/string/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
bytes2str: (bytes: Uint8Array) => string;
|
|
3
|
+
str2bytes: (str?: string) => Uint8Array;
|
|
4
|
+
str2hex: (str: string) => string;
|
|
5
|
+
hex2str: (hexstr: string) => string;
|
|
6
|
+
concatBytes: (...args: Uint8Array[]) => Uint8Array;
|
|
7
|
+
uint32ToBytes: (uint32: Uint32Array) => Uint8Array;
|
|
8
|
+
bytesToUint32: (bytes: Uint8Array) => Uint32Array;
|
|
9
|
+
hex2bytes: (hex: string) => Uint8Array;
|
|
10
|
+
bytes2hex: (bytes: Uint8Array) => string;
|
|
11
|
+
toUint32: (str: string) => Uint32Array;
|
|
12
|
+
fromUint32: (uint32: Uint32Array) => string;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
str2Hex: (str: string) => string;
|
|
3
|
-
hex2Str: (hexstr: string) => string;
|
|
4
2
|
str2ab: (content?: string, base64?: boolean) => ArrayBuffer;
|
|
5
3
|
ab2str: (data: ArrayBuffer, base64?: boolean) => string;
|
|
6
|
-
bytesToStr: (bytes: Uint8Array) => string;
|
|
7
|
-
strToBytes: (str?: string) => Uint8Array;
|
|
8
4
|
utf8ToBase64: (str: string) => string;
|
|
9
5
|
base64ToUtf8: (base64Str: string) => string;
|
|
10
6
|
getRandomBytes: (length: number) => Uint8Array;
|
|
11
7
|
textEncode: (text: string) => Uint8Array;
|
|
12
8
|
textDecode: (buf: ArrayBufferLike) => string;
|
|
13
9
|
toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
|
|
14
|
-
concatBytes: (...args: Uint8Array[]) => Uint8Array;
|
|
15
10
|
toBase64: (input?: string) => string;
|
|
16
11
|
fromBase64: (input?: string) => string;
|
|
17
12
|
bytesToBase64: (bytes: Uint8Array) => string;
|
|
@@ -20,5 +15,18 @@ declare const _default: {
|
|
|
20
15
|
fromUtf8: (utftext: string) => string;
|
|
21
16
|
toUtf8Bytes: (content: string) => Uint8Array;
|
|
22
17
|
fromUtf8Bytes: (utf8Bytes: Uint8Array) => string;
|
|
18
|
+
pkcs7Padding: (plaintext: Uint8Array, blockSize: number) => Uint8Array;
|
|
19
|
+
pkcs7Unpadding: (ciphertext: Uint8Array) => Uint8Array;
|
|
20
|
+
bytes2str: (bytes: Uint8Array) => string;
|
|
21
|
+
str2bytes: (str?: string) => Uint8Array;
|
|
22
|
+
str2hex: (str: string) => string;
|
|
23
|
+
hex2str: (hexstr: string) => string;
|
|
24
|
+
concatBytes: (...args: Uint8Array[]) => Uint8Array;
|
|
25
|
+
uint32ToBytes: (uint32: Uint32Array) => Uint8Array;
|
|
26
|
+
bytesToUint32: (bytes: Uint8Array) => Uint32Array;
|
|
27
|
+
hex2bytes: (hex: string) => Uint8Array;
|
|
28
|
+
bytes2hex: (bytes: Uint8Array) => string;
|
|
29
|
+
toUint32: (str: string) => Uint32Array;
|
|
30
|
+
fromUint32: (uint32: Uint32Array) => string;
|
|
23
31
|
};
|
|
24
32
|
export default _default;
|
|
@@ -4,6 +4,15 @@ declare const _default: {
|
|
|
4
4
|
decode: (base64Str: string) => string;
|
|
5
5
|
encodeByOss: (input: string) => string;
|
|
6
6
|
};
|
|
7
|
+
tea: {
|
|
8
|
+
encrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
9
|
+
decrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
10
|
+
toTeaKey: (str: string) => Uint32Array;
|
|
11
|
+
encode: (plaintext: string, key: string) => string;
|
|
12
|
+
decode: (ciphertext: string, key: string) => string;
|
|
13
|
+
encodeBytes: (plainbytes: Uint8Array, key: string) => Uint8Array;
|
|
14
|
+
decodeBytes: (cipherbytes: Uint8Array, key: string) => Uint8Array;
|
|
15
|
+
};
|
|
7
16
|
uuid: (len?: number, radix?: number) => string;
|
|
8
17
|
guid: (len: number, prefix?: boolean, sep?: string) => string;
|
|
9
18
|
getHexString: (len: number) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
encrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
3
|
+
decrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
4
|
+
toTeaKey: (str: string) => Uint32Array;
|
|
5
|
+
encode: (plaintext: string, key: string) => string;
|
|
6
|
+
decode: (ciphertext: string, key: string) => string;
|
|
7
|
+
encodeBytes: (plainbytes: Uint8Array, key: string) => Uint8Array;
|
|
8
|
+
decodeBytes: (cipherbytes: Uint8Array, key: string) => Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -25,6 +25,8 @@ declare const _default: {
|
|
|
25
25
|
pipe: (func: Ddan.Function, callback?: ((result: Ddan.SafeResult<any>) => void) | undefined) => DPipeline;
|
|
26
26
|
pipeline: (max?: number) => DPipeline;
|
|
27
27
|
safeTask: (func: Ddan.Function, callback?: ((result: Ddan.SafeResult<any>) => void) | undefined) => DSafeTask;
|
|
28
|
+
logString: (data: any) => Promise<string>;
|
|
29
|
+
logParse: (logStr: string) => Promise<string>;
|
|
28
30
|
to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
|
|
29
31
|
go: <T_1 = any>(task?: Ddan.PFunction<T_1> | undefined) => Promise<[any, undefined] | [null, T_1]>;
|
|
30
32
|
delay: (ms?: number) => Promise<unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ddan } from
|
|
1
|
+
import { Ddan } from '../../typings';
|
|
2
2
|
declare function toString(value: any): any;
|
|
3
3
|
declare const _default: {
|
|
4
4
|
toString: typeof toString;
|
|
@@ -16,5 +16,6 @@ declare const _default: {
|
|
|
16
16
|
boolean?: boolean | undefined;
|
|
17
17
|
}) => any;
|
|
18
18
|
replace: (source: string, rules: Ddan.IRegexRule | Ddan.IRegexRule[]) => string;
|
|
19
|
+
jsonFormat: (jsonString: string) => string;
|
|
19
20
|
};
|
|
20
21
|
export default _default;
|