@wandzai/utils 1.0.33 → 1.0.34
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 +1 -1
- package/src/encrypt-decrypt.js +2 -2
package/package.json
CHANGED
package/src/encrypt-decrypt.js
CHANGED
|
@@ -4,13 +4,13 @@ exports.decryptData = exports.encryptData = void 0;
|
|
|
4
4
|
const CryptoJS = require("crypto-js");
|
|
5
5
|
const key = '66807eb6-f5c0-4245-8e4c-0c5d3f80f203';
|
|
6
6
|
const encryptData = (data) => {
|
|
7
|
-
const encryptedData = CryptoJS.
|
|
7
|
+
const encryptedData = CryptoJS.RC4.encrypt(JSON.stringify(data), key).toString();
|
|
8
8
|
return encodeURIComponent(encryptedData);
|
|
9
9
|
};
|
|
10
10
|
exports.encryptData = encryptData;
|
|
11
11
|
const decryptData = (data) => {
|
|
12
12
|
const decodedEncrypted = decodeURIComponent(data);
|
|
13
|
-
const bytes = CryptoJS.
|
|
13
|
+
const bytes = CryptoJS.RC4.decrypt(decodedEncrypted, key);
|
|
14
14
|
return JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
|
|
15
15
|
};
|
|
16
16
|
exports.decryptData = decryptData;
|