@8ms/helpers 2.4.5 → 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.
@@ -1,20 +1,14 @@
1
1
  //#region src/crypto/server/getDecrypt.d.ts
2
2
  /**
3
3
  * Decrypt an encoding string using a salt.
4
- * @param salt32 must be 32 bytes
5
- * @param salt16 must be 16 bytes
6
- * @param input any string
7
4
  */
8
- declare const getDecrypt: (salt32: string, salt16: string, input: string) => string;
5
+ declare const getDecrypt: (appSalt: string, input: string) => string;
9
6
  //#endregion
10
7
  //#region src/crypto/server/getEncrypt.d.ts
11
8
  /**
12
9
  * Encrypt an encoding string using a salt.
13
- * @param salt32 must be 32 bytes
14
- * @param salt16 must be 16 bytes
15
- * @param input any string
16
10
  */
17
- declare const getEncrypt: (salt32: string, salt16: string, input: string) => string;
11
+ declare const getEncrypt: (appSalt: string, input: string) => string;
18
12
  //#endregion
19
13
  //#region src/crypto/server/getMd5.d.ts
20
14
  /**
@@ -4,29 +4,19 @@ import * as crypto from "crypto";
4
4
  //#region src/crypto/server/getDecrypt.ts
5
5
  /**
6
6
  * Decrypt an encoding string using a salt.
7
- * @param salt32 must be 32 bytes
8
- * @param salt16 must be 16 bytes
9
- * @param input any string
10
7
  */
11
- const getDecrypt = (salt32, salt16, input) => {
12
- const decipher = crypto.createDecipheriv("aes-256-cbc", salt32, salt16);
13
- let decrypted = decipher.update(input, "hex", "utf8");
14
- decrypted += decipher.final("utf8");
15
- return decrypted;
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");
16
11
  };
17
12
  //#endregion
18
13
  //#region src/crypto/server/getEncrypt.ts
19
14
  /**
20
15
  * Encrypt an encoding string using a salt.
21
- * @param salt32 must be 32 bytes
22
- * @param salt16 must be 16 bytes
23
- * @param input any string
24
16
  */
25
- const getEncrypt = (salt32, salt16, input) => {
26
- const cipher = crypto.createCipheriv("aes-256-cbc", salt32, salt16);
27
- let encrypted = cipher.update(input, "utf8", "hex");
28
- encrypted += cipher.final("hex");
29
- return encrypted;
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");
30
20
  };
31
21
  //#endregion
32
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.5",
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"