ggez-banking-sdk 0.1.127 → 0.1.129
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/dist/api/clients/user.js
CHANGED
|
@@ -239,7 +239,9 @@ class UserClient {
|
|
|
239
239
|
CreateUser = async (data) => {
|
|
240
240
|
try {
|
|
241
241
|
const userData = FillCreateUserData(data);
|
|
242
|
-
const { data: tokenData } = await this.authService.generateLimitedToken(
|
|
242
|
+
const { data: tokenData } = await this.authService.generateLimitedToken({
|
|
243
|
+
installationId: data.installationID,
|
|
244
|
+
});
|
|
243
245
|
const config = {
|
|
244
246
|
headers: { Authorization: `Bearer ${tokenData?.access_token}` },
|
|
245
247
|
};
|
|
@@ -255,7 +257,9 @@ class UserClient {
|
|
|
255
257
|
CreateUserWithGoogle = async (data) => {
|
|
256
258
|
try {
|
|
257
259
|
const userData = FillCreateUserWithGoogleData(data);
|
|
258
|
-
const { data: tokenData } = await this.authService.generateLimitedToken(
|
|
260
|
+
const { data: tokenData } = await this.authService.generateLimitedToken({
|
|
261
|
+
installationId: data.installationID,
|
|
262
|
+
});
|
|
259
263
|
const config = {
|
|
260
264
|
headers: { Authorization: `Bearer ${tokenData?.access_token}` },
|
|
261
265
|
};
|
|
@@ -7,6 +7,6 @@ declare class AuthService extends BaseService {
|
|
|
7
7
|
endpoint: string;
|
|
8
8
|
constructor(config: AxiosRequestConfig, nodeUrl: string);
|
|
9
9
|
login(data: string): Promise<import("axios").AxiosResponse<TokenData, any, {}>>;
|
|
10
|
-
generateLimitedToken(data
|
|
10
|
+
generateLimitedToken(data: IGenerateLimitedTokenData): Promise<import("axios").AxiosResponse<TokenData, any, {}>>;
|
|
11
11
|
}
|
|
12
12
|
export { AuthService };
|
|
@@ -11,7 +11,9 @@ class LimitedService extends BaseService {
|
|
|
11
11
|
this.axiosInstance.interceptors.request.use(async (req) => {
|
|
12
12
|
const config = AxiosHelper.GetAuthAxiosConfig(this.nodeUrl, "", "");
|
|
13
13
|
const authService = new AuthService(config, this.nodeUrl);
|
|
14
|
-
const { data } = await authService.generateLimitedToken(
|
|
14
|
+
const { data } = await authService.generateLimitedToken({
|
|
15
|
+
installationId: "",
|
|
16
|
+
});
|
|
15
17
|
const token = data?.access_token;
|
|
16
18
|
if (token) {
|
|
17
19
|
req.headers.setAuthorization(`Bearer ${token}`);
|
|
@@ -9,6 +9,8 @@ declare class CookiesHelper {
|
|
|
9
9
|
static GetDeviceSecurityCode: () => string;
|
|
10
10
|
static GetAccessToken: () => string;
|
|
11
11
|
static SetAccessToken: (accessToken: string) => void;
|
|
12
|
+
static GetJWTToken: () => string;
|
|
13
|
+
static SetJWTToken: (jwtToken: string) => void;
|
|
12
14
|
static GET: (key: string) => string | undefined;
|
|
13
15
|
static SET: (key: string, value: string, expires?: Date) => void;
|
|
14
16
|
static REMOVE: (key: string) => void;
|
|
@@ -135,6 +135,31 @@ class CookiesHelper {
|
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
// #endregion
|
|
138
|
+
// #region "JWT Token"
|
|
139
|
+
static GetJWTToken = () => {
|
|
140
|
+
try {
|
|
141
|
+
const IID = this.GetIID();
|
|
142
|
+
const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
|
|
143
|
+
const jwtToken = this.GET("jwt_token");
|
|
144
|
+
const decryptedAccessToken = CipherHelper.Decrypt(jwtToken, key, iv);
|
|
145
|
+
return decryptedAccessToken;
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.error(error);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
static SetJWTToken = (jwtToken) => {
|
|
152
|
+
try {
|
|
153
|
+
const IID = this.GetIID();
|
|
154
|
+
const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
|
|
155
|
+
const encryptedAccessToken = CipherHelper.Encrypt(jwtToken, key, iv);
|
|
156
|
+
this.SET("jwt_token", encryptedAccessToken);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
console.error(error);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
// #endregion
|
|
138
163
|
// #region "Getters & Setters"
|
|
139
164
|
static GET = (key) => {
|
|
140
165
|
return Cookies.get(key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ggez-banking-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.129",
|
|
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",
|