@8ms/helpers 2.4.4 → 2.4.6
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.
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Decrypt an encoding string using a salt.
|
|
4
4
|
*/
|
|
5
|
-
declare const getDecrypt: (appSalt: string, input: string
|
|
5
|
+
declare const getDecrypt: (appSalt: string, input: string) => string;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/crypto/server/getEncrypt.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Encrypt an encoding string using a salt.
|
|
10
10
|
*/
|
|
11
|
-
declare const getEncrypt: (appSalt: string, input: string
|
|
11
|
+
declare const getEncrypt: (appSalt: string, input: string) => string;
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/crypto/server/getMd5.d.ts
|
|
14
14
|
/**
|
|
@@ -5,29 +5,18 @@ import * as crypto from "crypto";
|
|
|
5
5
|
/**
|
|
6
6
|
* Decrypt an encoding string using a salt.
|
|
7
7
|
*/
|
|
8
|
-
const getDecrypt = (appSalt, input
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const [ivHex, encryptedHex] = input.split(":");
|
|
12
|
-
const key = crypto.pbkdf2Sync(customSalt, "salt", 1e5, 32, "sha256");
|
|
13
|
-
const iv = Buffer.from(ivHex, "hex");
|
|
14
|
-
const encrypted = Buffer.from(encryptedHex, "hex");
|
|
15
|
-
const decipher = crypto.createDecipheriv(ALGORITHM, key, iv);
|
|
16
|
-
return Buffer.concat([decipher.update(encrypted), decipher.final()]).toString("utf8");
|
|
8
|
+
const getDecrypt = (appSalt, input) => {
|
|
9
|
+
const decipher = crypto.createDecipheriv("aes-256-ecb", appSalt, null);
|
|
10
|
+
return decipher.update(input, "hex", "utf8") + decipher.final("utf8");
|
|
17
11
|
};
|
|
18
12
|
//#endregion
|
|
19
13
|
//#region src/crypto/server/getEncrypt.ts
|
|
20
14
|
/**
|
|
21
15
|
* Encrypt an encoding string using a salt.
|
|
22
16
|
*/
|
|
23
|
-
const getEncrypt = (appSalt, input
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const key = crypto.pbkdf2Sync(customSalt, "salt", 1e5, 32, "sha256");
|
|
27
|
-
const iv = crypto.randomBytes(16);
|
|
28
|
-
const cipher = crypto.createCipheriv(ALGORITHM, key, iv);
|
|
29
|
-
const encrypted = Buffer.concat([cipher.update(input, "utf8"), cipher.final()]);
|
|
30
|
-
return iv.toString("hex") + ":" + encrypted.toString("hex");
|
|
17
|
+
const getEncrypt = (appSalt, input) => {
|
|
18
|
+
const cipher = crypto.createCipheriv("aes-256-ecb", appSalt, null);
|
|
19
|
+
return cipher.update(input, "utf8", "hex") + cipher.final("hex");
|
|
31
20
|
};
|
|
32
21
|
//#endregion
|
|
33
22
|
//#region src/crypto/server/getMd5.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@8ms/helpers",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.6",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
"build": "tsdown",
|
|
12
12
|
"jest": "jest --watch"
|
|
13
13
|
},
|
|
14
|
-
"packageManager": "yarn@4.12.0",
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": "24"
|
|
17
|
-
},
|
|
18
14
|
"dependencies": {
|
|
19
15
|
"fs-extra": "^11.0.0",
|
|
20
16
|
"ky": "^2.0.0",
|