ggez-banking-sdk 0.1.144 → 0.1.146

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,9 +1,3 @@
1
- declare const HTTPMethod: {
2
- readonly GET: "GET";
3
- readonly POST: "POST";
4
- readonly PUT: "PUT";
5
- readonly DELETE: "DELETE";
6
- };
7
1
  declare const Endpoints: {
8
2
  readonly Blockchain: "v1/blockchain";
9
3
  readonly Account: "v1/account";
@@ -17,9 +11,6 @@ declare const Endpoints: {
17
11
  readonly Auth: "oauth/token";
18
12
  readonly IPAddress: "v1/myipaddress";
19
13
  };
20
- declare const TransactionEndpoints: {
21
- readonly Inquiry: "/inquiry";
22
- };
23
14
  declare const AccountEndpoints: {
24
15
  Limits: string;
25
16
  };
@@ -31,6 +22,12 @@ declare const LimitedEndpoints: {
31
22
  readonly SecurityForgetValidate: "/security/forget/validate";
32
23
  readonly SecurityForgetConfirm: "/security/forget/confirm";
33
24
  };
25
+ declare const TransactionEndpoints: {
26
+ readonly Inquiry: "/inquiry";
27
+ };
28
+ declare const OrganizationEndpoints: {
29
+ Document: string;
30
+ };
34
31
  declare const UserEndpoints: {
35
32
  readonly Preferences: "/preferences";
36
33
  readonly TermsAndConditions: "/terms_and_conditions";
@@ -66,8 +63,11 @@ declare const UserEndpoints: {
66
63
  readonly AuthDelete: "/auth/delete";
67
64
  readonly HistoryLatest: "/history/latest";
68
65
  };
69
- declare const OrganizationEndpoints: {
70
- Document: string;
66
+ declare const HTTPMethod: {
67
+ readonly GET: "GET";
68
+ readonly POST: "POST";
69
+ readonly PUT: "PUT";
70
+ readonly DELETE: "DELETE";
71
71
  };
72
72
  declare const HeaderKeys: {
73
73
  readonly Authorization: "Authorization";
@@ -87,4 +87,11 @@ declare const GrantType: {
87
87
  readonly DeviceCredential: "device_credential";
88
88
  readonly LimitedCredential: "limited_credential";
89
89
  };
90
- export { HTTPMethod, HeaderKeys, Endpoints, UserEndpoints, TransactionEndpoints, AccountEndpoints, OrganizationEndpoints, LimitedEndpoints, GrantType, };
90
+ declare const CookieKeys: {
91
+ readonly DEK: "DEK";
92
+ readonly USR: "USR";
93
+ readonly IID: "IID";
94
+ readonly access_token: "access_token";
95
+ readonly jwt_token: "jwt_token";
96
+ };
97
+ export { HTTPMethod, HeaderKeys, Endpoints, UserEndpoints, TransactionEndpoints, AccountEndpoints, OrganizationEndpoints, LimitedEndpoints, GrantType, CookieKeys, };
@@ -1,14 +1,9 @@
1
- const HTTPMethod = {
2
- GET: "GET",
3
- POST: "POST",
4
- PUT: "PUT",
5
- DELETE: "DELETE",
6
- };
1
+ // #region "Endpoints"
7
2
  const Endpoints = {
8
3
  Blockchain: "v1/blockchain",
9
4
  Account: "v1/account",
10
5
  Transaction: "v1/transaction",
11
- Promotion: "api/promotion", // CHECK-HERE
6
+ Promotion: "api/promotion",
12
7
  User: "v1/user",
13
8
  Organization: "v1/organization",
14
9
  Order: "v1/order",
@@ -17,9 +12,6 @@ const Endpoints = {
17
12
  Auth: "oauth/token",
18
13
  IPAddress: "v1/myipaddress",
19
14
  };
20
- const TransactionEndpoints = {
21
- Inquiry: "/inquiry",
22
- };
23
15
  const AccountEndpoints = {
24
16
  Limits: "/limits",
25
17
  };
@@ -31,6 +23,12 @@ const LimitedEndpoints = {
31
23
  SecurityForgetValidate: "/security/forget/validate",
32
24
  SecurityForgetConfirm: "/security/forget/confirm",
33
25
  };
26
+ const TransactionEndpoints = {
27
+ Inquiry: "/inquiry",
28
+ };
29
+ const OrganizationEndpoints = {
30
+ Document: "/document",
31
+ };
34
32
  const UserEndpoints = {
35
33
  Preferences: "/preferences",
36
34
  TermsAndConditions: "/terms_and_conditions",
@@ -66,8 +64,13 @@ const UserEndpoints = {
66
64
  AuthDelete: "/auth/delete",
67
65
  HistoryLatest: "/history/latest",
68
66
  };
69
- const OrganizationEndpoints = {
70
- Document: "/document",
67
+ // #endregion
68
+ // #region "API"
69
+ const HTTPMethod = {
70
+ GET: "GET",
71
+ POST: "POST",
72
+ PUT: "PUT",
73
+ DELETE: "DELETE",
71
74
  };
72
75
  const HeaderKeys = {
73
76
  Authorization: "Authorization",
@@ -87,4 +90,14 @@ const GrantType = {
87
90
  DeviceCredential: "device_credential",
88
91
  LimitedCredential: "limited_credential",
89
92
  };
90
- export { HTTPMethod, HeaderKeys, Endpoints, UserEndpoints, TransactionEndpoints, AccountEndpoints, OrganizationEndpoints, LimitedEndpoints, GrantType, };
93
+ // #endregion
94
+ // #region "Cookies"
95
+ const CookieKeys = {
96
+ DEK: "DEK",
97
+ USR: "USR",
98
+ IID: "IID",
99
+ access_token: "access_token",
100
+ jwt_token: "jwt_token",
101
+ };
102
+ // #endregion
103
+ export { HTTPMethod, HeaderKeys, Endpoints, UserEndpoints, TransactionEndpoints, AccountEndpoints, OrganizationEndpoints, LimitedEndpoints, GrantType, CookieKeys, };
@@ -4,6 +4,7 @@ const BlockchainActions = {
4
4
  Delegate: "delegate",
5
5
  Undelegate: "undelegate",
6
6
  };
7
+ // #region "Codes"
7
8
  const StructTicketMessageDescriptionCodes = {
8
9
  Custom: "M000",
9
10
  Identification_Is_Being_Verified: "M100",
@@ -77,4 +78,5 @@ const SystemResponses = {
77
78
  Invalid_Authentication_Code: "6049",
78
79
  Internal_Server_Error: "7001",
79
80
  };
81
+ // #endregion
80
82
  export { BlockchainActions, StructTicketMessageDescriptionCodes, SystemResponses, };
@@ -15,6 +15,9 @@ class CipherHelper {
15
15
  const decipher = createDecipheriv("aes-256-cbc", keyBuffer, ivBuffer);
16
16
  let decrypted = decipher.update(cipherText, "base64", "utf8");
17
17
  decrypted += decipher.final("utf8");
18
+ if (decrypted == "{}") {
19
+ return "";
20
+ }
18
21
  return decrypted;
19
22
  }
20
23
  catch (error) {
@@ -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.144",
3
+ "version": "0.1.146",
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",