ggez-banking-sdk 0.1.105 → 0.1.107
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/account.d.ts +8 -8
- package/dist/api/clients/account.js +26 -19
- package/dist/api/clients/auth.d.ts +22 -17
- package/dist/api/clients/auth.js +57 -42
- package/dist/api/clients/blockchain.d.ts +16 -16
- package/dist/api/clients/blockchain.js +52 -42
- package/dist/api/clients/ipAddressAndLocation.js +15 -13
- package/dist/api/clients/limited.d.ts +42 -32
- package/dist/api/clients/limited.js +100 -82
- package/dist/api/clients/order.d.ts +4 -4
- package/dist/api/clients/order.js +16 -12
- package/dist/api/clients/organization.d.ts +23 -18
- package/dist/api/clients/organization.js +57 -45
- package/dist/api/clients/promotion.d.ts +28 -13
- package/dist/api/clients/promotion.js +32 -30
- package/dist/api/clients/transaction.d.ts +9 -9
- package/dist/api/clients/transaction.js +30 -24
- package/dist/api/clients/user.d.ts +387 -301
- package/dist/api/clients/user.js +886 -735
- package/dist/api/data/account.d.ts +3 -0
- package/dist/api/data/account.js +8 -0
- package/dist/api/data/blockchain.d.ts +2 -1
- package/dist/api/data/blockchain.js +11 -1
- package/dist/api/data/index.d.ts +2 -0
- package/dist/api/data/index.js +2 -0
- package/dist/api/data/order.d.ts +2 -1
- package/dist/api/data/order.js +15 -1
- package/dist/api/data/organization.d.ts +2 -1
- package/dist/api/data/organization.js +26 -1
- package/dist/api/data/result.d.ts +9 -0
- package/dist/api/data/result.js +48 -0
- package/dist/api/data/transaction.d.ts +4 -2
- package/dist/api/data/transaction.js +24 -1
- package/dist/api/data/user/confirmUserSecurity.d.ts +3 -0
- package/dist/api/data/user/confirmUserSecurity.js +12 -0
- package/dist/api/data/user/forgetSecurityData.d.ts +3 -0
- package/dist/api/data/user/forgetSecurityData.js +10 -0
- package/dist/api/data/user/index.d.ts +8 -8
- package/dist/api/data/user/index.js +8 -161
- package/dist/api/data/user/user.d.ts +6 -0
- package/dist/api/data/user/user.js +159 -0
- package/dist/api/data/user/validateLimitedSecurity.d.ts +3 -0
- package/dist/api/data/user/validateLimitedSecurity.js +10 -0
- package/dist/api/data/user/validateSecurityData.d.ts +3 -0
- package/dist/api/data/user/validateSecurityData.js +11 -0
- package/dist/api/data/user/verifyUserSecurity.d.ts +3 -0
- package/dist/api/data/user/verifyUserSecurity.js +11 -0
- package/dist/api/services/account.js +1 -1
- package/dist/api/services/auth.js +4 -5
- package/dist/api/services/base.d.ts +1 -1
- package/dist/api/services/base.js +1 -0
- package/dist/api/services/blockchain.js +5 -9
- package/dist/api/services/ipAddressAndLocation.js +10 -10
- package/dist/api/services/limited.js +2 -1
- package/dist/api/services/order.js +2 -3
- package/dist/api/services/organization.d.ts +2 -2
- package/dist/api/services/organization.js +7 -10
- package/dist/api/services/promotion.js +1 -1
- package/dist/api/services/transaction.d.ts +2 -2
- package/dist/api/services/transaction.js +3 -5
- package/dist/api/services/user.js +65 -127
- package/dist/constants/structure.d.ts +1 -0
- package/dist/constants/structure.js +1 -0
- package/dist/helper/api/axiosHelper.js +71 -71
- package/dist/helper/api/responseHelper.d.ts +12 -11
- package/dist/helper/api/responseHelper.js +24 -25
- package/dist/helper/cipherHelper.js +95 -97
- package/dist/helper/clientHelper.js +1 -0
- package/dist/helper/cookiesHelper.d.ts +5 -0
- package/dist/helper/cookiesHelper.js +169 -126
- package/dist/helper/deviceHelper.js +31 -31
- package/dist/helper/userHelper.d.ts +12 -2
- package/dist/helper/userHelper.js +69 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/banking/common/ResultSet.d.ts +10 -0
- package/dist/types/banking/common/ResultSet.js +1 -0
- package/dist/types/banking/common/index.d.ts +1 -0
- package/dist/types/banking/entities/address.d.ts +1 -0
- package/dist/types/banking/oauth/tokenData.d.ts +3 -1
- package/dist/types/banking/transaction/index.d.ts +1 -0
- package/dist/types/banking/transaction/transactionResultInquiry.d.ts +9 -0
- package/dist/types/banking/transaction/transactionResultInquiry.js +1 -0
- package/dist/types/helper/index.d.ts +4 -3
- package/dist/types/helper/index.js +1 -3
- package/dist/types/helper/userHelper.d.ts +17 -0
- package/dist/types/helper/userHelper.js +2 -0
- package/package.json +2 -2
@@ -1,106 +1,104 @@
|
|
1
|
-
var _a;
|
2
1
|
import { createCipheriv, createDecipheriv } from "crypto";
|
3
2
|
class CipherHelper {
|
4
|
-
|
5
|
-
_a = CipherHelper;
|
6
|
-
CipherHelper.Encrypt = (plainText, key, iv) => {
|
7
|
-
const keyBuffer = Buffer.from(key, "utf8");
|
8
|
-
const ivBuffer = Buffer.from(iv, "utf8");
|
9
|
-
const cipher = createCipheriv("aes-256-cbc", keyBuffer, ivBuffer);
|
10
|
-
let encrypted = cipher.update(plainText, "utf8", "base64");
|
11
|
-
encrypted += cipher.final("base64");
|
12
|
-
return encrypted;
|
13
|
-
};
|
14
|
-
CipherHelper.Decrypt = (cipherText, key, iv) => {
|
15
|
-
try {
|
3
|
+
static Encrypt = (plainText, key, iv) => {
|
16
4
|
const keyBuffer = Buffer.from(key, "utf8");
|
17
5
|
const ivBuffer = Buffer.from(iv, "utf8");
|
18
|
-
const
|
19
|
-
let
|
20
|
-
|
21
|
-
return
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
6
|
+
const cipher = createCipheriv("aes-256-cbc", keyBuffer, ivBuffer);
|
7
|
+
let encrypted = cipher.update(plainText, "utf8", "base64");
|
8
|
+
encrypted += cipher.final("base64");
|
9
|
+
return encrypted;
|
10
|
+
};
|
11
|
+
static Decrypt = (cipherText, key, iv) => {
|
12
|
+
try {
|
13
|
+
const keyBuffer = Buffer.from(key, "utf8");
|
14
|
+
const ivBuffer = Buffer.from(iv, "utf8");
|
15
|
+
const decipher = createDecipheriv("aes-256-cbc", keyBuffer, ivBuffer);
|
16
|
+
let decrypted = decipher.update(cipherText, "base64", "utf8");
|
17
|
+
decrypted += decipher.final("utf8");
|
18
|
+
return decrypted;
|
19
|
+
}
|
20
|
+
catch (error) {
|
21
|
+
return JSON.stringify(error);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
static Generate = (code) => {
|
25
|
+
try {
|
26
|
+
if (!code)
|
27
|
+
throw new Error("code is not defined");
|
28
|
+
const KEY = this.PaddingLeft(code.toString(), 32, "0");
|
29
|
+
const IV = this.PaddingLeft(code.toString(), 16, "0");
|
30
|
+
return { key: KEY, iv: IV };
|
31
|
+
}
|
32
|
+
catch (error) {
|
33
|
+
console.error(error);
|
34
|
+
return { key: "", iv: "" };
|
44
35
|
}
|
45
|
-
|
46
|
-
|
36
|
+
};
|
37
|
+
static GenerateByUSRAndIID = (USR, IID) => {
|
38
|
+
try {
|
39
|
+
if (!USR || !USR.device_id || !USR.user_id) {
|
40
|
+
throw new Error("USR is not defined");
|
41
|
+
}
|
42
|
+
if (!IID) {
|
43
|
+
throw new Error("IID is not defined");
|
44
|
+
}
|
45
|
+
const DID_KEY = this.PaddingLeft(USR.device_id.toString(), 10, "0");
|
46
|
+
const UID_KEY = this.PaddingLeft(USR.user_id.toString(), 10, "0");
|
47
|
+
const IID_KEY = IID.slice(0, 10);
|
48
|
+
const KEY = `${DID_KEY}.${UID_KEY}.${IID_KEY}`.toString();
|
49
|
+
const DID_IV = this.PaddingLeft(USR.device_id.toString(), 8, "0");
|
50
|
+
const UID_IV = this.PaddingLeft(USR.user_id.toString(), 8, "0");
|
51
|
+
const IV = `${DID_IV}${UID_IV}`;
|
52
|
+
return { key: KEY, iv: IV };
|
47
53
|
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
const KEY = `${DID_KEY}.${UID_KEY}.${IID_KEY}`.toString();
|
52
|
-
const DID_IV = _a.PaddingLeft(USR.device_id.toString(), 8, "0");
|
53
|
-
const UID_IV = _a.PaddingLeft(USR.user_id.toString(), 8, "0");
|
54
|
-
const IV = `${DID_IV}${UID_IV}`.toString();
|
55
|
-
return { key: KEY, iv: IV };
|
56
|
-
}
|
57
|
-
catch (error) {
|
58
|
-
console.error(error);
|
59
|
-
return { key: "", iv: "" };
|
60
|
-
}
|
61
|
-
};
|
62
|
-
CipherHelper.GenerateByProgramID = () => {
|
63
|
-
try {
|
64
|
-
const programId = process.env.NEXT_PUBLIC_PROGRAM_ID || process.env.VITE_PROGRAM_ID;
|
65
|
-
if (!programId) {
|
66
|
-
throw new Error("Program ID is not defined");
|
54
|
+
catch (error) {
|
55
|
+
console.error(error);
|
56
|
+
return { key: "", iv: "" };
|
67
57
|
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
}
|
82
|
-
|
83
|
-
const UID_KEY = _a.PaddingLeft(user_id.toString(), 32, "0");
|
84
|
-
const UID_IV = _a.PaddingLeft(user_id.toString(), 16, "0");
|
85
|
-
return { key: UID_KEY, iv: UID_IV };
|
86
|
-
};
|
87
|
-
CipherHelper.GenerateByInstallationID = (IID) => {
|
88
|
-
try {
|
89
|
-
if (!IID) {
|
90
|
-
throw new Error("Installation ID is not defined");
|
58
|
+
};
|
59
|
+
static GenerateByProgramID = () => {
|
60
|
+
try {
|
61
|
+
const programId = process.env.NEXT_PUBLIC_PROGRAM_ID || process.env.VITE_PROGRAM_ID;
|
62
|
+
if (!programId) {
|
63
|
+
throw new Error("Program ID is not defined");
|
64
|
+
}
|
65
|
+
const PID_KEY = this.PaddingLeft(programId.toString(), 10, "0");
|
66
|
+
const F_KEY = this.PaddingLeft("0".toString(), 10, "0");
|
67
|
+
const FingerPrint_KEY = this.PaddingLeft("", 10, "0");
|
68
|
+
const KEY = `${PID_KEY}.${F_KEY}.${FingerPrint_KEY}`;
|
69
|
+
const PID_IV = this.PaddingLeft(programId.toString(), 8, "0");
|
70
|
+
const F_IV = this.PaddingLeft("0".toString(), 8, "0");
|
71
|
+
const IV = `${PID_IV}${F_IV}`;
|
72
|
+
return { key: KEY, iv: IV };
|
91
73
|
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
};
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
74
|
+
catch (error) {
|
75
|
+
console.error(error);
|
76
|
+
return { key: "", iv: "" };
|
77
|
+
}
|
78
|
+
};
|
79
|
+
static GenerateByUserID = (user_id) => {
|
80
|
+
const UID_KEY = this.PaddingLeft(user_id.toString(), 32, "0");
|
81
|
+
const UID_IV = this.PaddingLeft(user_id.toString(), 16, "0");
|
82
|
+
return { key: UID_KEY, iv: UID_IV };
|
83
|
+
};
|
84
|
+
static GenerateByInstallationID = (IID) => {
|
85
|
+
try {
|
86
|
+
if (!IID) {
|
87
|
+
throw new Error("Installation ID is not defined");
|
88
|
+
}
|
89
|
+
const IID_KEY = IID.slice(0, 32);
|
90
|
+
const IID_IV = IID.slice(0, 16);
|
91
|
+
return { key: IID_KEY, iv: IID_IV };
|
92
|
+
}
|
93
|
+
catch (error) {
|
94
|
+
console.error(error);
|
95
|
+
return { key: "", iv: "" };
|
96
|
+
}
|
97
|
+
};
|
98
|
+
static PaddingLeft = (value, length, paddingChar) => {
|
99
|
+
if (value.length >= length)
|
100
|
+
return value;
|
101
|
+
return paddingChar.repeat(length - value.length) + value;
|
102
|
+
};
|
103
|
+
}
|
106
104
|
export { CipherHelper };
|
@@ -10,5 +10,10 @@ declare class CookiesHelper {
|
|
10
10
|
static GET: (key: string) => string | undefined;
|
11
11
|
static SET: (key: string, value: string, expires?: Date) => void;
|
12
12
|
static REMOVE: (key: string) => void;
|
13
|
+
static cookieEventHandler: (e: CookieChangeEvent, callback: () => void) => void;
|
14
|
+
static onChangeHandler: (changed: CookieInit[], callback: () => void) => void;
|
15
|
+
static onDeleteHandler: (deleted: CookieInit[], callback: () => void) => void;
|
16
|
+
static addOnChangeEventListener: (callback: () => void) => void;
|
17
|
+
static removeOnChangeEventListener: (callback: () => void) => void;
|
13
18
|
}
|
14
19
|
export { CookiesHelper };
|
@@ -1,132 +1,175 @@
|
|
1
|
-
var _a;
|
2
1
|
import { v4 } from "uuid";
|
3
2
|
import Cookies from "js-cookie";
|
4
3
|
import { CipherHelper } from ".";
|
5
4
|
class CookiesHelper {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
5
|
+
// #region "IID"
|
6
|
+
static GetIID = () => {
|
7
|
+
try {
|
8
|
+
const IID = this.GET("IID");
|
9
|
+
if (!IID) {
|
10
|
+
this.SetIID();
|
11
|
+
return this.GetIID();
|
12
|
+
}
|
13
|
+
const { key, iv } = CipherHelper.GenerateByProgramID();
|
14
|
+
const decryptedIID = CipherHelper.Decrypt(IID, key, iv);
|
15
|
+
return decryptedIID;
|
16
|
+
}
|
17
|
+
catch (error) {
|
18
|
+
console.error(error);
|
19
|
+
}
|
20
|
+
};
|
21
|
+
static SetIID = () => {
|
22
|
+
try {
|
23
|
+
const IID = v4();
|
24
|
+
const { key, iv } = CipherHelper.GenerateByProgramID();
|
25
|
+
const encryptedIID = CipherHelper.Encrypt(IID, key, iv);
|
26
|
+
this.SET("IID", encryptedIID);
|
27
|
+
}
|
28
|
+
catch (error) {
|
29
|
+
console.error(error);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
// #endregion
|
33
|
+
// #region "DEK"
|
34
|
+
static GetDEK = () => {
|
35
|
+
try {
|
36
|
+
const IID = this.GetIID();
|
37
|
+
const DEK = this.GET("DEK");
|
38
|
+
const USR = this.GetUSR();
|
39
|
+
if (!DEK || !USR) {
|
40
|
+
return null;
|
41
|
+
}
|
42
|
+
const { key, iv } = CipherHelper.GenerateByUSRAndIID(USR, IID);
|
43
|
+
const encryptionKey = CipherHelper.Decrypt(DEK, key, iv);
|
44
|
+
if (encryptionKey.length == 16)
|
45
|
+
return encryptionKey;
|
46
|
+
}
|
47
|
+
catch (error) {
|
48
|
+
console.error(error);
|
49
|
+
}
|
50
|
+
};
|
51
|
+
static SetDEK = (deviceEncryptionKey, USR) => {
|
52
|
+
try {
|
53
|
+
const IID = this.GetIID();
|
54
|
+
const { user_id } = USR;
|
55
|
+
const { key, iv } = CipherHelper.GenerateByUSRAndIID(USR, IID);
|
56
|
+
if (deviceEncryptionKey) {
|
57
|
+
const cipherKeys = CipherHelper.GenerateByUserID(user_id);
|
58
|
+
const encryptionKey = CipherHelper.Decrypt(deviceEncryptionKey, cipherKeys.key, cipherKeys.iv);
|
59
|
+
const DEK = CipherHelper.Encrypt(encryptionKey, key, iv);
|
60
|
+
this.SET("DEK", DEK);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
catch (error) {
|
64
|
+
console.error(error);
|
65
|
+
}
|
66
|
+
};
|
67
|
+
// #endregion
|
68
|
+
// #region "USR"
|
69
|
+
static GetUSR = () => {
|
70
|
+
try {
|
71
|
+
const IID = this.GetIID();
|
72
|
+
const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
|
73
|
+
const USR = this.GET("USR");
|
74
|
+
const decryptedUSR = CipherHelper.Decrypt(USR, key, iv);
|
75
|
+
return JSON.parse(decryptedUSR);
|
76
|
+
}
|
77
|
+
catch (error) {
|
78
|
+
console.error(error);
|
79
|
+
}
|
80
|
+
};
|
81
|
+
static SetUSR = (deviceId, userId) => {
|
82
|
+
try {
|
83
|
+
const IID = this.GetIID();
|
84
|
+
const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
|
85
|
+
const USR = JSON.stringify({
|
86
|
+
device_id: deviceId,
|
87
|
+
user_id: userId,
|
88
|
+
});
|
89
|
+
const encryptedUSR = CipherHelper.Encrypt(USR, key, iv);
|
90
|
+
this.SET("USR", encryptedUSR);
|
91
|
+
}
|
92
|
+
catch (error) {
|
93
|
+
console.error(error);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
// #endregion
|
97
|
+
// #region "Device Security Code"
|
98
|
+
static GetDeviceSecurityCode = () => {
|
99
|
+
try {
|
100
|
+
const IID = this.GetIID();
|
101
|
+
const DEK = this.GetDEK();
|
102
|
+
const USR = this.GetUSR();
|
103
|
+
const { key, iv } = CipherHelper.GenerateByUserID(USR.user_id.toString());
|
104
|
+
const DUID = IID + "." + DEK;
|
105
|
+
const deviceSecurityCode = CipherHelper.Encrypt(DUID, key, iv);
|
106
|
+
return deviceSecurityCode;
|
107
|
+
}
|
108
|
+
catch (error) {
|
109
|
+
console.error(error);
|
110
|
+
}
|
111
|
+
};
|
112
|
+
// #endregion
|
113
|
+
// #region "Getters & Setters"
|
114
|
+
static GET = (key) => {
|
115
|
+
return Cookies.get(key);
|
116
|
+
};
|
117
|
+
static SET = (key, value, expires) => {
|
118
|
+
const defaultExpireDate = new Date(Date.now() + 1000 * 60 * 60 * 24 * 365);
|
119
|
+
Cookies.set(key, value, {
|
120
|
+
path: "/",
|
121
|
+
sameSite: "lax",
|
122
|
+
domain: process.env.NEXT_PUBLIC_DOMAIN || process.env.VITE_DOMAIN || "ggez.one",
|
123
|
+
expires: expires || defaultExpireDate,
|
91
124
|
});
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
const
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
};
|
129
|
-
|
130
|
-
|
131
|
-
|
125
|
+
};
|
126
|
+
static REMOVE = (key) => {
|
127
|
+
Cookies.remove(key);
|
128
|
+
};
|
129
|
+
// #endregion
|
130
|
+
// #region "Cookie Change Event Listener"
|
131
|
+
static cookieEventHandler = (e, callback) => {
|
132
|
+
if (e.changed.length > 0) {
|
133
|
+
this.onChangeHandler(e.changed, callback);
|
134
|
+
}
|
135
|
+
if (e.deleted.length > 0) {
|
136
|
+
this.onDeleteHandler(e.deleted, callback);
|
137
|
+
}
|
138
|
+
};
|
139
|
+
static onChangeHandler = (changed, callback) => {
|
140
|
+
const changedCookie = changed[0];
|
141
|
+
switch (changedCookie.name) {
|
142
|
+
case "IID":
|
143
|
+
const IID = this.GetIID();
|
144
|
+
if (IID != changedCookie.value) {
|
145
|
+
callback();
|
146
|
+
}
|
147
|
+
break;
|
148
|
+
case "USR":
|
149
|
+
const USR = this.GetUSR();
|
150
|
+
if (USR.toString() != changedCookie.value) {
|
151
|
+
callback();
|
152
|
+
}
|
153
|
+
break;
|
154
|
+
case "DEK":
|
155
|
+
const DEK = this.GetDEK();
|
156
|
+
if (DEK != changedCookie.value) {
|
157
|
+
callback();
|
158
|
+
}
|
159
|
+
break;
|
160
|
+
}
|
161
|
+
};
|
162
|
+
static onDeleteHandler = (deleted, callback) => {
|
163
|
+
const deletedCookie = deleted[0];
|
164
|
+
if (["DEK", "USR", "IID"].includes(deletedCookie.name)) {
|
165
|
+
callback();
|
166
|
+
}
|
167
|
+
};
|
168
|
+
static addOnChangeEventListener = (callback) => {
|
169
|
+
window.cookieStore.addEventListener("change", (e) => this.cookieEventHandler(e, callback));
|
170
|
+
};
|
171
|
+
static removeOnChangeEventListener = (callback) => {
|
172
|
+
window.cookieStore.removeEventListener("change", (e) => this.cookieEventHandler(e, callback));
|
173
|
+
};
|
174
|
+
}
|
132
175
|
export { CookiesHelper };
|
@@ -2,36 +2,36 @@ import { DeviceType, SecurityOperationMethod } from "../constants";
|
|
2
2
|
import { ClientHelper } from "./clientHelper";
|
3
3
|
import { DateTimeHelper } from "./dateTimeHelper";
|
4
4
|
class DeviceHelper {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
5
|
+
static GetDeviceDetails = (asJson = false) => {
|
6
|
+
const clientHelper = new ClientHelper();
|
7
|
+
const device = {
|
8
|
+
type: DeviceType.Browser,
|
9
|
+
brand: `${clientHelper.getBrowser()}-${clientHelper.getBrowserVersion()}`,
|
10
|
+
os: clientHelper.getOS(),
|
11
|
+
extended_info: {
|
12
|
+
sim_info: null,
|
13
|
+
culture_info: null,
|
14
|
+
user_agent: clientHelper.getUserAgent(),
|
15
|
+
cpu: clientHelper.getCPU(),
|
16
|
+
system_language: clientHelper.getSystemLanguage(),
|
17
|
+
},
|
18
|
+
activity_type: SecurityOperationMethod.Login,
|
19
|
+
application_version: "",
|
20
|
+
serial_number: "",
|
21
|
+
source_ip_address: "",
|
22
|
+
geo_coordinates: "",
|
23
|
+
installation_id: "",
|
24
|
+
client_time_zone: DateTimeHelper.GetClientTimeZone(),
|
25
|
+
server_date: "",
|
26
|
+
date_utc: DateTimeHelper.GetDateUTC(),
|
27
|
+
client_date: DateTimeHelper.GetClientDate(),
|
28
|
+
update_date_utc: DateTimeHelper.GetDateUTC(),
|
29
|
+
original_source_id: "",
|
30
|
+
};
|
31
|
+
if (asJson)
|
32
|
+
return JSON.stringify(device);
|
33
|
+
return device;
|
31
34
|
};
|
32
|
-
|
33
|
-
|
34
|
-
return device;
|
35
|
-
};
|
36
|
-
DeviceHelper.GetDeviceExtendedInfo = () => { };
|
35
|
+
static GetDeviceExtendedInfo = () => { };
|
36
|
+
}
|
37
37
|
export { DeviceHelper };
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
import { TModifyByEntity, TModifyByDocumentData, TSortByID, TSortByIsPrimary, TSortByVerificationStatus, TSortEntity } from "..";
|
2
|
+
declare const OldUserHelper: (userInfo: any) => {
|
2
3
|
checkResponse: () => {
|
3
4
|
checkUserResponseAuth: (response: any, showMessageSuccess: boolean, funcName: string) => any;
|
4
5
|
checkGlobalResponse: (key: string, response: any, funcName: string, keyAction?: string) => {
|
@@ -8,4 +9,13 @@ declare const UserHelper: (userInfo: any) => {
|
|
8
9
|
};
|
9
10
|
};
|
10
11
|
export declare function sortUserInfo(list?: any[] | null): any;
|
11
|
-
export default
|
12
|
+
export default OldUserHelper;
|
13
|
+
declare class UserHelper {
|
14
|
+
static ModifyByEntity: TModifyByEntity;
|
15
|
+
static ModifyByDocumentData: TModifyByDocumentData;
|
16
|
+
static SortEntity: TSortEntity;
|
17
|
+
static SortByIsPrimary: TSortByIsPrimary;
|
18
|
+
static SortByVerificationStatus: TSortByVerificationStatus;
|
19
|
+
static SortById: TSortByID;
|
20
|
+
}
|
21
|
+
export { UserHelper };
|