@trustchex/react-native-sdk 1.178.0 → 1.214.0
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/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +3 -0
- package/lib/module/Screens/Static/ResultScreen.js +5 -0
- package/lib/module/Shared/Libs/native-device-info.utils.js +6 -35
- package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts +0 -9
- package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -1
- package/package.json +8 -3
- package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +3 -0
- package/src/Screens/Static/ResultScreen.tsx +7 -0
- package/src/Shared/Libs/native-device-info.utils.ts +6 -40
|
@@ -103,6 +103,9 @@ const ContractAcceptanceScreen = () => {
|
|
|
103
103
|
if (!consent.contractIds.includes(acceptedContractId)) {
|
|
104
104
|
consent.contractIds.push(acceptedContractId);
|
|
105
105
|
consent.deviceInfo = await generateHumanReadableIdentifier();
|
|
106
|
+
|
|
107
|
+
// Update the context with the new device info
|
|
108
|
+
appContext.identificationInfo.consent = consent;
|
|
106
109
|
}
|
|
107
110
|
navigationManagerRef.current?.navigateToNextStep();
|
|
108
111
|
},
|
|
@@ -71,6 +71,11 @@ const ResultScreen = () => {
|
|
|
71
71
|
}
|
|
72
72
|
}, []);
|
|
73
73
|
const submitIdentificationConsent = useCallback(async (identificationId, sessionKey) => {
|
|
74
|
+
// Ensure device info is always populated before sending consent
|
|
75
|
+
if (!appContext.identificationInfo.consent.deviceInfo) {
|
|
76
|
+
console.log('Device info not set, generating now...');
|
|
77
|
+
appContext.identificationInfo.consent.deviceInfo = await NativeDeviceInfo.generateHumanReadableIdentifier();
|
|
78
|
+
}
|
|
74
79
|
const {
|
|
75
80
|
encryptedData,
|
|
76
81
|
nonce
|
|
@@ -1,43 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Native device info utility using React Native's built-in APIs
|
|
7
|
-
* Replaces basic react-native-device-info functionality
|
|
8
|
-
*/
|
|
4
|
+
import DeviceInfo from 'react-native-device-info';
|
|
9
5
|
export const NativeDeviceInfo = {
|
|
10
|
-
getBrand: () => {
|
|
11
|
-
return Platform.OS === 'ios' ? 'Apple' : 'Android';
|
|
12
|
-
},
|
|
13
|
-
getModel: () => {
|
|
14
|
-
// For React Native, we can't get the exact model without native modules
|
|
15
|
-
// But we can provide meaningful fallbacks
|
|
16
|
-
if (Platform.OS === 'ios') {
|
|
17
|
-
return Platform.isPad ? 'iPad' : 'iPhone';
|
|
18
|
-
}
|
|
19
|
-
return 'Android Device';
|
|
20
|
-
},
|
|
21
|
-
getSystemName: () => {
|
|
22
|
-
return Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
23
|
-
},
|
|
24
|
-
getSystemVersion: () => {
|
|
25
|
-
return Platform.Version.toString();
|
|
26
|
-
},
|
|
27
|
-
getUniqueId: async () => {
|
|
28
|
-
// Generate a session-based unique identifier
|
|
29
|
-
// This is not persistent across app restarts but serves the same purpose for most use cases
|
|
30
|
-
const timestamp = Date.now().toString(36);
|
|
31
|
-
const random = Math.random().toString(36).substr(2, 5);
|
|
32
|
-
const platform = Platform.OS.substr(0, 3);
|
|
33
|
-
return `${platform}-${timestamp}-${random}`;
|
|
34
|
-
},
|
|
35
6
|
generateHumanReadableIdentifier: async () => {
|
|
36
|
-
const brand =
|
|
37
|
-
const model =
|
|
38
|
-
const systemName =
|
|
39
|
-
const systemVersion =
|
|
40
|
-
const uniqueId = await
|
|
7
|
+
const brand = DeviceInfo.getBrand();
|
|
8
|
+
const model = DeviceInfo.getModel();
|
|
9
|
+
const systemName = Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
10
|
+
const systemVersion = DeviceInfo.getSystemVersion();
|
|
11
|
+
const uniqueId = await DeviceInfo.getUniqueId();
|
|
41
12
|
return `${brand} ${model} (${systemName} ${systemVersion}) - ${uniqueId}`;
|
|
42
13
|
}
|
|
43
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractAcceptanceScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Dynamic/ContractAcceptanceScreen.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,wBAAwB,+
|
|
1
|
+
{"version":3,"file":"ContractAcceptanceScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Dynamic/ContractAcceptanceScreen.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,wBAAwB,+CAyH7B,CAAC;AA4BF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/ResultScreen.tsx"],"names":[],"mappings":"AAiCA,QAAA,MAAM,YAAY,+
|
|
1
|
+
{"version":3,"file":"ResultScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/ResultScreen.tsx"],"names":[],"mappings":"AAiCA,QAAA,MAAM,YAAY,+CA4uBjB,CAAC;AAsGF,eAAe,YAAY,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Native device info utility using React Native's built-in APIs
|
|
3
|
-
* Replaces basic react-native-device-info functionality
|
|
4
|
-
*/
|
|
5
1
|
export declare const NativeDeviceInfo: {
|
|
6
|
-
getBrand: () => string;
|
|
7
|
-
getModel: () => string;
|
|
8
|
-
getSystemName: () => string;
|
|
9
|
-
getSystemVersion: () => string;
|
|
10
|
-
getUniqueId: () => Promise<string>;
|
|
11
2
|
generateHumanReadableIdentifier: () => Promise<string>;
|
|
12
3
|
};
|
|
13
4
|
export default NativeDeviceInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-device-info.utils.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/native-device-info.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"native-device-info.utils.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/native-device-info.utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;2CACgB,OAAO,CAAC,MAAM,CAAC;CAS3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustchex/react-native-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.214.0",
|
|
4
4
|
"description": "Trustchex mobile app react native SDK for android or ios devices",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/trustchex/trustchex.git"
|
|
22
|
+
"url": "git+https://github.com/trustchex/trustchex.git",
|
|
23
|
+
"directory": "react-native-sdk"
|
|
23
24
|
},
|
|
24
25
|
"license": "SEE LICENSE IN LICENSE",
|
|
25
26
|
"author": "Trustchex <support@trustchex.com> (https://trustchex.com)",
|
|
@@ -69,7 +70,6 @@
|
|
|
69
70
|
"@eslint/compat": "^1.2.7",
|
|
70
71
|
"@eslint/eslintrc": "^3.3.0",
|
|
71
72
|
"@eslint/js": "^9.22.0",
|
|
72
|
-
"@evilmartians/lefthook": "^1.5.0",
|
|
73
73
|
"@react-native-community/cli": "15.0.0-alpha.2",
|
|
74
74
|
"@react-native-community/image-editor": "^4.3.0",
|
|
75
75
|
"@react-native/babel-preset": "0.79.5",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"react-native": "0.79.5",
|
|
93
93
|
"react-native-builder-bob": "^0.40.13",
|
|
94
94
|
"react-native-compressor": "^1.12.0",
|
|
95
|
+
"react-native-device-info": "^13.0.0",
|
|
95
96
|
"react-native-fast-opencv": "^0.4.6",
|
|
96
97
|
"react-native-fs": "^2.20.0",
|
|
97
98
|
"react-native-gesture-handler": "^2.27.1",
|
|
@@ -128,6 +129,7 @@
|
|
|
128
129
|
"react": ">=19.0.0",
|
|
129
130
|
"react-native": ">=0.79.5",
|
|
130
131
|
"react-native-compressor": ">=1.12.0",
|
|
132
|
+
"react-native-device-info": ">=13.0.0",
|
|
131
133
|
"react-native-fast-opencv": ">=0.4.6",
|
|
132
134
|
"react-native-fs": ">=2.20.0",
|
|
133
135
|
"react-native-gesture-handler": ">=2.27.1",
|
|
@@ -168,6 +170,9 @@
|
|
|
168
170
|
"react-native-compressor": {
|
|
169
171
|
"optional": false
|
|
170
172
|
},
|
|
173
|
+
"react-native-device-info": {
|
|
174
|
+
"optional": false
|
|
175
|
+
},
|
|
171
176
|
"react-native-fast-opencv": {
|
|
172
177
|
"optional": false
|
|
173
178
|
},
|
|
@@ -123,6 +123,9 @@ const ContractAcceptanceScreen = () => {
|
|
|
123
123
|
if (!consent.contractIds.includes(acceptedContractId)) {
|
|
124
124
|
consent.contractIds.push(acceptedContractId);
|
|
125
125
|
consent.deviceInfo = await generateHumanReadableIdentifier();
|
|
126
|
+
|
|
127
|
+
// Update the context with the new device info
|
|
128
|
+
appContext.identificationInfo.consent = consent;
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
navigationManagerRef.current?.navigateToNextStep();
|
|
@@ -109,6 +109,13 @@ const ResultScreen = () => {
|
|
|
109
109
|
|
|
110
110
|
const submitIdentificationConsent = useCallback(
|
|
111
111
|
async (identificationId: string, sessionKey: string) => {
|
|
112
|
+
// Ensure device info is always populated before sending consent
|
|
113
|
+
if (!appContext.identificationInfo.consent.deviceInfo) {
|
|
114
|
+
console.log('Device info not set, generating now...');
|
|
115
|
+
appContext.identificationInfo.consent.deviceInfo =
|
|
116
|
+
await NativeDeviceInfo.generateHumanReadableIdentifier();
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
const { encryptedData, nonce } = encryptWithAes(
|
|
113
120
|
JSON.stringify(appContext.identificationInfo.consent),
|
|
114
121
|
sessionKey
|
|
@@ -1,47 +1,13 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
+
import DeviceInfo from 'react-native-device-info';
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
* Native device info utility using React Native's built-in APIs
|
|
5
|
-
* Replaces basic react-native-device-info functionality
|
|
6
|
-
*/
|
|
7
4
|
export const NativeDeviceInfo = {
|
|
8
|
-
getBrand: (): string => {
|
|
9
|
-
return Platform.OS === 'ios' ? 'Apple' : 'Android';
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
getModel: (): string => {
|
|
13
|
-
// For React Native, we can't get the exact model without native modules
|
|
14
|
-
// But we can provide meaningful fallbacks
|
|
15
|
-
if (Platform.OS === 'ios') {
|
|
16
|
-
return Platform.isPad ? 'iPad' : 'iPhone';
|
|
17
|
-
}
|
|
18
|
-
return 'Android Device';
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
getSystemName: (): string => {
|
|
22
|
-
return Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
getSystemVersion: (): string => {
|
|
26
|
-
return Platform.Version.toString();
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
getUniqueId: async (): Promise<string> => {
|
|
30
|
-
// Generate a session-based unique identifier
|
|
31
|
-
// This is not persistent across app restarts but serves the same purpose for most use cases
|
|
32
|
-
const timestamp = Date.now().toString(36);
|
|
33
|
-
const random = Math.random().toString(36).substr(2, 5);
|
|
34
|
-
const platform = Platform.OS.substr(0, 3);
|
|
35
|
-
|
|
36
|
-
return `${platform}-${timestamp}-${random}`;
|
|
37
|
-
},
|
|
38
|
-
|
|
39
5
|
generateHumanReadableIdentifier: async (): Promise<string> => {
|
|
40
|
-
const brand =
|
|
41
|
-
const model =
|
|
42
|
-
const systemName =
|
|
43
|
-
const systemVersion =
|
|
44
|
-
const uniqueId = await
|
|
6
|
+
const brand = DeviceInfo.getBrand();
|
|
7
|
+
const model = DeviceInfo.getModel();
|
|
8
|
+
const systemName = Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
9
|
+
const systemVersion = DeviceInfo.getSystemVersion();
|
|
10
|
+
const uniqueId = await DeviceInfo.getUniqueId();
|
|
45
11
|
|
|
46
12
|
return `${brand} ${model} (${systemName} ${systemVersion}) - ${uniqueId}`;
|
|
47
13
|
},
|