@ka-libs/crypto 1.0.1 → 1.1.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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * AES解密
3
+ */
4
+ declare function aesDecrypt(data: string, aesKey: string, aesIv: string): Promise<any>;
5
+
6
+ export { aesDecrypt, aesDecrypt as default };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * AES加密
3
+ */
4
+ declare function aesEncrypt<T>(data: T, aesKey?: Uint8Array<ArrayBuffer>, aesIv?: Uint8Array<ArrayBuffer>): Promise<{
5
+ data: string;
6
+ key: string;
7
+ iv: string;
8
+ }>;
9
+
10
+ export { aesEncrypt, aesEncrypt as default };
@@ -0,0 +1,3 @@
1
+ declare function arrayBufferToBase64(input: ArrayBuffer | Uint8Array): string;
2
+
3
+ export { arrayBufferToBase64, arrayBufferToBase64 as default };
@@ -0,0 +1,3 @@
1
+ declare function base64Cleaner(input: string): string;
2
+
3
+ export { base64Cleaner, base64Cleaner as default };
@@ -0,0 +1,3 @@
1
+ declare function base64ToArrayBuffer(input: Base64URLString): ArrayBuffer;
2
+
3
+ export { base64ToArrayBuffer, base64ToArrayBuffer as default };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 混合解密
3
+ */
4
+ declare function decrypt(data: string, valid: string, privateKey: string): Promise<any>;
5
+
6
+ export { decrypt, decrypt as default };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 混合加密
3
+ */
4
+ declare function encrypt<T>(data: T, publicKey: string): Promise<{
5
+ valid: string;
6
+ data: string;
7
+ } | null>;
8
+
9
+ export { encrypt as default, encrypt };
@@ -0,0 +1,3 @@
1
+ declare function exportKeyPairs(dist: string): Promise<void>;
2
+
3
+ export { exportKeyPairs as default, exportKeyPairs };
@@ -0,0 +1,3 @@
1
+ declare function getRandomBytes(length?: number): Uint8Array<ArrayBuffer>;
2
+
3
+ export { getRandomBytes as default, getRandomBytes };
@@ -0,0 +1,3 @@
1
+ declare function getRandomValues<T extends Exclude<BufferSource, ArrayBuffer>>(abv: T): T;
2
+
3
+ export { getRandomValues as default, getRandomValues };
@@ -0,0 +1,3 @@
1
+ declare function keyPairs(): Promise<string[]>;
2
+
3
+ export { keyPairs as default, keyPairs };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * RSA解密
3
+ */
4
+ declare function rsaDecrypt(data: string, privateKey: string): Promise<any>;
5
+
6
+ export { rsaDecrypt as default, rsaDecrypt };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * RSA加密
3
+ */
4
+ declare function rsaEncrypt<T>(data: T, publicKey: string): Promise<string>;
5
+
6
+ export { rsaEncrypt as default, rsaEncrypt };
@@ -0,0 +1,3 @@
1
+ declare function uuidv4(simplify?: boolean): string;
2
+
3
+ export { uuidv4 as default, uuidv4 };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * UUID v5 generator
3
+ */
4
+ declare function uuidv5(name: string, namespace?: string): Promise<string>;
5
+
6
+ export { uuidv5 as default, uuidv5 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ka-libs/crypto",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Cross-environment crypto utility for Node.js & Browser, implement RSA-AES hybrid encryption based on native Web Crypto / Node.js crypto without third-party dependencies.",
5
5
  "scripts": {
6
6
  "build:js": "rollup -c",
@@ -11,58 +11,73 @@
11
11
  "main": "./dist/cjs/index.cjs",
12
12
  "module": "./dist/esm/index.js",
13
13
  "browser": "dist/index.esm.js",
14
- "types": "./dist/index.d.ts",
14
+ "types": "./dist/types/index.d.ts",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/index.d.ts",
18
+ "types": "./dist/types/index.d.ts",
19
19
  "import": "./dist/esm/index.js",
20
20
  "require": "./dist/cjs/index.cjs"
21
21
  },
22
22
  "./aes-decrypt": {
23
- "import": "./dist/esm/exports/aes-decrypt.js"
23
+ "import": "./dist/esm/exports/aes-decrypt.js",
24
+ "types": "./dist/types/aes-decrypt.d.ts"
24
25
  },
25
26
  "./aes-encrypt": {
26
- "import": "./dist/esm/exports/aes-encrypt.js"
27
+ "import": "./dist/esm/exports/aes-encrypt.js",
28
+ "types": "./dist/types/aes-encrypt.d.ts"
27
29
  },
28
30
  "./array-buffer-to-base64": {
29
- "import": "./dist/esm/exports/array-buffer-to-base64.js"
31
+ "import": "./dist/esm/exports/array-buffer-to-base64.js",
32
+ "types": "./dist/types/array-buffer-to-base64.d.ts"
30
33
  },
31
34
  "./base64-cleaner": {
32
- "import": "./dist/esm/exports/base64-cleaner.js"
35
+ "import": "./dist/esm/exports/base64-cleaner.js",
36
+ "types": "./dist/types/base64-cleaner.d.ts"
33
37
  },
34
38
  "./base64-to-array-buffer": {
35
- "import": "./dist/esm/exports/base64-to-array-buffer.js"
39
+ "import": "./dist/esm/exports/base64-to-array-buffer.js",
40
+ "types": "./dist/types/base64-to-array-buffer.d.ts"
36
41
  },
37
42
  "./decrypt": {
38
- "import": "./dist/esm/exports/decrypt.js"
43
+ "import": "./dist/esm/exports/decrypt.js",
44
+ "types": "./dist/types/decrypt.d.ts"
39
45
  },
40
46
  "./encrypt": {
41
- "import": "./dist/esm/exports/encrypt.js"
47
+ "import": "./dist/esm/exports/encrypt.js",
48
+ "types": "./dist/types/encrypt.d.ts"
42
49
  },
43
50
  "./export-key-pairs": {
44
- "import": "./dist/esm/exports/export-key-pairs.js"
51
+ "import": "./dist/esm/exports/export-key-pairs.js",
52
+ "types": "./dist/types/export-key-pairs.d.ts"
45
53
  },
46
54
  "./get-random-bytes": {
47
- "import": "./dist/esm/exports/get-random-bytes.js"
55
+ "import": "./dist/esm/exports/get-random-bytes.js",
56
+ "types": "./dist/types/get-random-bytes.d.ts"
48
57
  },
49
58
  "./get-random-values": {
50
- "import": "./dist/esm/exports/get-random-values.js"
59
+ "import": "./dist/esm/exports/get-random-values.js",
60
+ "types": "./dist/types/get-random-values.d.ts"
51
61
  },
52
62
  "./key-pairs": {
53
- "import": "./dist/esm/exports/key-pairs.js"
63
+ "import": "./dist/esm/exports/key-pairs.js",
64
+ "types": "./dist/types/key-pairs.d.ts"
54
65
  },
55
66
  "./rsa-decrypt": {
56
- "import": "./dist/esm/exports/rsa-decrypt.js"
67
+ "import": "./dist/esm/exports/rsa-decrypt.js",
68
+ "types": "./dist/types/rsa-decrypt.d.ts"
57
69
  },
58
70
  "./rsa-encrypt": {
59
- "import": "./dist/esm/exports/rsa-encrypt.js"
71
+ "import": "./dist/esm/exports/rsa-encrypt.js",
72
+ "types": "./dist/types/rsa-encrypt.d.ts"
60
73
  },
61
74
  "./uuidv4": {
62
- "import": "./dist/esm/exports/uuidv4.js"
75
+ "import": "./dist/esm/exports/uuidv4.js",
76
+ "types": "./dist/types/uuidv4.d.ts"
63
77
  },
64
78
  "./uuidv5": {
65
- "import": "./dist/esm/exports/uuidv5.js"
79
+ "import": "./dist/esm/exports/uuidv5.js",
80
+ "types": "./dist/types/uuidv5.d.ts"
66
81
  }
67
82
  },
68
83
  "files": [
File without changes