ggez-banking-sdk 0.1.145 → 0.1.147

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.
@@ -21,7 +21,9 @@ class CipherHelper {
21
21
  return decrypted;
22
22
  }
23
23
  catch (error) {
24
- return JSON.stringify(error);
24
+ console.error(error + " CipherHelper.Decrypt");
25
+ return "";
26
+ // return JSON.stringify(error);
25
27
  }
26
28
  };
27
29
  static Generate = (code) => {
@@ -1,4 +1,4 @@
1
- import { USR } from "../types";
1
+ import { UserData, USR } from "../types";
2
2
  declare class CookiesHelper {
3
3
  static GetIID: () => any;
4
4
  static SetIID: () => void;
@@ -16,6 +16,8 @@ declare class CookiesHelper {
16
16
  static GetJWTToken: () => string;
17
17
  static SetJWTToken: (jwtToken: string) => void;
18
18
  static ValidateJWTToken: (jwtToken: string) => string;
19
+ static GetUserData: () => UserData;
20
+ static SetUserData: (data: UserData) => void;
19
21
  static GET: (key: string) => string | undefined;
20
22
  static SET: (key: string, value: string, expires?: Date) => void;
21
23
  static REMOVE: (key: string) => void;
@@ -226,6 +226,31 @@ class CookiesHelper {
226
226
  }
227
227
  };
228
228
  // #endregion
229
+ // #region "User Data"
230
+ static GetUserData = () => {
231
+ try {
232
+ const IID = this.GetIID();
233
+ const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
234
+ const userData = this.GET("CUD");
235
+ const decryptedUserData = CipherHelper.Decrypt(userData, key, iv);
236
+ return JSON.parse(decryptedUserData);
237
+ }
238
+ catch (error) {
239
+ console.error(error);
240
+ }
241
+ };
242
+ static SetUserData = (data) => {
243
+ try {
244
+ const IID = this.GetIID();
245
+ const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
246
+ const encryptedUserData = CipherHelper.Encrypt(JSON.stringify(data), key, iv);
247
+ this.SET("CUD", encryptedUserData);
248
+ }
249
+ catch (error) {
250
+ console.error(error);
251
+ }
252
+ };
253
+ // #endregion
229
254
  // #region "Getters & Setters"
230
255
  static GET = (key) => {
231
256
  return Cookies.get(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ggez-banking-sdk",
3
- "version": "0.1.145",
3
+ "version": "0.1.147",
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",