ggez-banking-sdk 0.1.158 → 0.1.160
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,10 +2,10 @@ import { createCipheriv, createDecipheriv } from "crypto";
|
|
|
2
2
|
class CipherHelper {
|
|
3
3
|
static Encrypt = (plainText, key, iv) => {
|
|
4
4
|
try {
|
|
5
|
-
const keyBuffer = Buffer.from(key, "
|
|
6
|
-
const ivBuffer = Buffer.from(iv, "
|
|
5
|
+
const keyBuffer = Buffer.from(key, "utf16le");
|
|
6
|
+
const ivBuffer = Buffer.from(iv, "utf16le");
|
|
7
7
|
const cipher = createCipheriv("aes-256-cbc", keyBuffer, ivBuffer);
|
|
8
|
-
let encrypted = cipher.update(plainText, "
|
|
8
|
+
let encrypted = cipher.update(plainText, "utf16le", "base64");
|
|
9
9
|
encrypted += cipher.final("base64");
|
|
10
10
|
return encrypted;
|
|
11
11
|
}
|
|
@@ -16,11 +16,11 @@ class CipherHelper {
|
|
|
16
16
|
};
|
|
17
17
|
static Decrypt = (cipherText, key, iv) => {
|
|
18
18
|
try {
|
|
19
|
-
const keyBuffer = Buffer.from(key, "
|
|
20
|
-
const ivBuffer = Buffer.from(iv, "
|
|
19
|
+
const keyBuffer = Buffer.from(key, "utf16le");
|
|
20
|
+
const ivBuffer = Buffer.from(iv, "utf16le");
|
|
21
21
|
const decipher = createDecipheriv("aes-256-cbc", keyBuffer, ivBuffer);
|
|
22
|
-
let decrypted = decipher.update(cipherText, "base64", "
|
|
23
|
-
decrypted += decipher.final("
|
|
22
|
+
let decrypted = decipher.update(cipherText, "base64", "utf16le");
|
|
23
|
+
decrypted += decipher.final("utf16le");
|
|
24
24
|
if (decrypted == "{}") {
|
|
25
25
|
return "";
|
|
26
26
|
}
|
|
@@ -31,7 +31,9 @@ class LocalStorageHelper {
|
|
|
31
31
|
const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
|
|
32
32
|
const data = JSON.stringify(userData);
|
|
33
33
|
const encryptedUserData = CipherHelper.Encrypt(data, key, iv);
|
|
34
|
-
|
|
34
|
+
if (encryptedUserData) {
|
|
35
|
+
this.SET("CUD", encryptedUserData);
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
38
|
catch (error) {
|
|
37
39
|
console.error(error);
|
|
@@ -43,5 +45,8 @@ class LocalStorageHelper {
|
|
|
43
45
|
SET(key, value) {
|
|
44
46
|
localStorage.setItem(key, value);
|
|
45
47
|
}
|
|
48
|
+
REMOVE(key) {
|
|
49
|
+
localStorage.removeItem(key);
|
|
50
|
+
}
|
|
46
51
|
}
|
|
47
52
|
export { LocalStorageHelper };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ggez-banking-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.160",
|
|
4
4
|
"description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|