ggez-banking-sdk 0.3.27 → 0.3.28
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,6 +1,7 @@
|
|
|
1
1
|
import type { ChangeEventParameters } from "../../types/helper/storageHelper/cookiesHelper";
|
|
2
2
|
import type { CredentialsCookies } from "../../types/storage/cookies";
|
|
3
3
|
import type { USR } from "../../types/helper/cipherHelper";
|
|
4
|
+
import { TokenData } from "../..";
|
|
4
5
|
declare class CookiesHelper {
|
|
5
6
|
private key;
|
|
6
7
|
private pendingIID;
|
|
@@ -48,6 +49,8 @@ declare class CookiesHelper {
|
|
|
48
49
|
get(key: string): Promise<string>;
|
|
49
50
|
set(key: string, value: string, expires?: number): Promise<void>;
|
|
50
51
|
remove(key: string): Promise<void>;
|
|
52
|
+
setCredentialCookiesByTokenData(tokenData: TokenData): Promise<void>;
|
|
53
|
+
clearCredentialCookies(): Promise<void>;
|
|
51
54
|
cookieEventHandler(e: CookieChangeEvent, params: ChangeEventParameters): Promise<void>;
|
|
52
55
|
onChangeHandler(changed: CookieInit[], params: ChangeEventParameters): Promise<void>;
|
|
53
56
|
onDeleteHandler(deleted: CookieInit[], params: ChangeEventParameters): Promise<void>;
|
|
@@ -458,6 +458,40 @@ class CookiesHelper {
|
|
|
458
458
|
this.deleteCookieFallback(cookieName, this.domain);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
+
async setCredentialCookiesByTokenData(tokenData) {
|
|
462
|
+
try {
|
|
463
|
+
const { device_id, user_id, access_token, device_encryption_key, jwt_token, expires_in, } = tokenData;
|
|
464
|
+
await Promise.all([
|
|
465
|
+
this.setAccessToken(access_token, Date.now() + expires_in * 1000),
|
|
466
|
+
this.setJWTToken(jwt_token),
|
|
467
|
+
this.setUSR(device_id, user_id),
|
|
468
|
+
this.setDEK(device_encryption_key, {
|
|
469
|
+
user_id,
|
|
470
|
+
device_id,
|
|
471
|
+
}),
|
|
472
|
+
]);
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
this.errorHandler(error);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
async clearCredentialCookies() {
|
|
479
|
+
try {
|
|
480
|
+
await Promise.all([
|
|
481
|
+
this.remove("USR"),
|
|
482
|
+
this.remove("DEK"),
|
|
483
|
+
this.remove("access_token"),
|
|
484
|
+
this.remove("jwt_token"),
|
|
485
|
+
]);
|
|
486
|
+
this.cachedUSR = null;
|
|
487
|
+
this.cachedDEK = null;
|
|
488
|
+
this.cachedAccessToken = null;
|
|
489
|
+
this.cachedJWTToken = null;
|
|
490
|
+
}
|
|
491
|
+
catch (error) {
|
|
492
|
+
this.errorHandler(error);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
461
495
|
// #endregion
|
|
462
496
|
// #region "Cookie Change Event Listener"
|
|
463
497
|
async cookieEventHandler(e, params) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ggez-banking-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.28",
|
|
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",
|