@trustchex/react-native-sdk 1.381.0 → 1.464.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/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKModule.kt +2 -8
- package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +60 -13
- package/android/src/main/java/com/trustchex/reactnativesdk/mlkit/MLKitModule.kt +1 -1
- package/ios/Camera/TrustchexCameraView.swift +10 -13
- package/ios/MLKit/MLKitModule.swift +1 -1
- package/lib/module/Screens/Debug/BarcodeTestScreen.js +308 -0
- package/lib/module/Screens/Debug/MRZTestScreen.js +105 -13
- package/lib/module/Screens/Debug/NFCScanTestScreen.js +635 -0
- package/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +49 -32
- package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +22 -4
- package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +5 -0
- package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +126 -27
- package/lib/module/Screens/Dynamic/VerbalConsentScreen.js +1079 -0
- package/lib/module/Screens/Dynamic/VideoCallScreen.js +678 -0
- package/lib/module/Screens/Static/OTPVerificationScreen.js +6 -0
- package/lib/module/Screens/Static/QrCodeScanningScreen.js +7 -1
- package/lib/module/Screens/Static/ResultScreen.js +154 -34
- package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +59 -51
- package/lib/module/Shared/Animations/recording.json +1 -0
- package/lib/module/Shared/Animations/video-call.json +1 -0
- package/lib/module/Shared/Components/DebugNavigationPanel.js +231 -67
- package/lib/module/Shared/Components/EIDScanner.js +213 -112
- package/lib/module/Shared/Components/IdentityDocumentCamera.flows.js +5 -3
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +77 -39
- package/lib/module/Shared/Components/IdentityDocumentCamera.utils.js +13 -4
- package/lib/module/Shared/Components/NavigationManager.js +39 -19
- package/lib/module/Shared/Contexts/AppContext.js +1 -0
- package/lib/module/Shared/EIDReader/aesSecureMessagingWrapper.js +51 -0
- package/lib/module/Shared/EIDReader/apduLevelPACECapable.js +3 -0
- package/lib/module/Shared/EIDReader/bacKey.js +16 -2
- package/lib/module/Shared/EIDReader/eidReader.js +354 -13
- package/lib/module/Shared/EIDReader/eidService.js +25 -1
- package/lib/module/Shared/EIDReader/nfcManagerCardService.js +4 -7
- package/lib/module/Shared/EIDReader/paceInfo.js +85 -0
- package/lib/module/Shared/EIDReader/paceKeySpec.js +51 -0
- package/lib/module/Shared/EIDReader/protocol/paceAPDUSender.js +100 -0
- package/lib/module/Shared/EIDReader/protocol/paceProtocol.js +655 -0
- package/lib/module/Shared/EIDReader/protocol/paceResult.js +37 -0
- package/lib/module/Shared/EIDReader/secureMessagingWrapper.js +27 -4
- package/lib/module/Shared/EIDReader/smartcards/commandAPDU.js +2 -1
- package/lib/module/Shared/EIDReader/tlv/tlv.helpers.js +1 -1
- package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +6 -3
- package/lib/module/Shared/EIDReader/utils/aesCrypto.utils.js +189 -0
- package/lib/module/Shared/Libs/SignalingClient.js +128 -0
- package/lib/module/Shared/Libs/analytics.utils.js +8 -0
- package/lib/module/Shared/Libs/contains.js +1 -40
- package/lib/module/Shared/Libs/country-display.utils.js +34 -0
- package/lib/module/Shared/Libs/deeplink.utils.js +9 -1
- package/lib/module/Shared/Libs/demo.utils.js +8 -0
- package/lib/module/Shared/Libs/http-client.js +9 -0
- package/lib/module/Shared/Libs/mrz.utils.js +3 -2
- package/lib/module/Shared/Libs/promise.utils.js +16 -2
- package/lib/module/Shared/Libs/status-bar.utils.js +23 -0
- package/lib/module/Shared/Services/DataUploadService.js +294 -0
- package/lib/module/Shared/Services/VideoSessionService.js +156 -0
- package/lib/module/Shared/Services/WebRTCService.js +510 -0
- package/lib/module/Shared/Types/analytics.types.js +4 -0
- package/lib/module/Translation/Resources/en.js +61 -2
- package/lib/module/Translation/Resources/tr.js +61 -2
- package/lib/module/Trustchex.js +64 -20
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/Screens/Debug/BarcodeTestScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Debug/BarcodeTestScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Debug/MRZTestScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Debug/NFCScanTestScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Debug/NFCScanTestScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/VerbalConsentScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/VerbalConsentScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.flows.d.ts +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.flows.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.utils.d.ts +5 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/NavigationManager.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts +1 -0
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/aesSecureMessagingWrapper.d.ts +18 -0
- package/lib/typescript/src/Shared/EIDReader/aesSecureMessagingWrapper.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/apduLevelPACECapable.d.ts +23 -0
- package/lib/typescript/src/Shared/EIDReader/apduLevelPACECapable.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts +6 -0
- package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/eidService.d.ts +9 -0
- package/lib/typescript/src/Shared/EIDReader/eidService.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/nfcManagerCardService.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/paceInfo.d.ts +50 -0
- package/lib/typescript/src/Shared/EIDReader/paceInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/paceKeySpec.d.ts +30 -0
- package/lib/typescript/src/Shared/EIDReader/paceKeySpec.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceAPDUSender.d.ts +17 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceAPDUSender.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceProtocol.d.ts +105 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceProtocol.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceResult.d.ts +24 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceResult.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts +15 -0
- package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/smartcards/commandAPDU.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/utils/aesCrypto.utils.d.ts +39 -0
- package/lib/typescript/src/Shared/EIDReader/utils/aesCrypto.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/SignalingClient.d.ts +24 -0
- package/lib/typescript/src/Shared/Libs/SignalingClient.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/contains.d.ts +0 -7
- package/lib/typescript/src/Shared/Libs/contains.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/country-display.utils.d.ts +2 -0
- package/lib/typescript/src/Shared/Libs/country-display.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/http-client.d.ts +1 -1
- package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/promise.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/status-bar.utils.d.ts +9 -0
- package/lib/typescript/src/Shared/Libs/status-bar.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/DataUploadService.d.ts +25 -0
- package/lib/typescript/src/Shared/Services/DataUploadService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/VideoSessionService.d.ts +33 -0
- package/lib/typescript/src/Shared/Services/VideoSessionService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/WebRTCService.d.ts +58 -0
- package/lib/typescript/src/Shared/Services/WebRTCService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/analytics.types.d.ts +4 -0
- package/lib/typescript/src/Shared/Types/analytics.types.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +13 -1
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
- package/lib/typescript/src/Translation/Resources/en.d.ts +60 -1
- package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
- package/lib/typescript/src/Translation/Resources/tr.d.ts +60 -1
- package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
- package/lib/typescript/src/Trustchex.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +35 -5
- package/src/Screens/Debug/BarcodeTestScreen.tsx +317 -0
- package/src/Screens/Debug/MRZTestScreen.tsx +107 -13
- package/src/Screens/Debug/NFCScanTestScreen.tsx +692 -0
- package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +58 -35
- package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +27 -4
- package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +6 -0
- package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +156 -27
- package/src/Screens/Dynamic/VerbalConsentScreen.tsx +1401 -0
- package/src/Screens/Dynamic/VideoCallScreen.tsx +766 -0
- package/src/Screens/Static/OTPVerificationScreen.tsx +6 -0
- package/src/Screens/Static/QrCodeScanningScreen.tsx +7 -1
- package/src/Screens/Static/ResultScreen.tsx +235 -48
- package/src/Screens/Static/VerificationSessionCheckScreen.tsx +67 -72
- package/src/Shared/Animations/recording.json +1 -0
- package/src/Shared/Animations/video-call.json +1 -0
- package/src/Shared/Components/DebugNavigationPanel.tsx +252 -51
- package/src/Shared/Components/EIDScanner.tsx +223 -116
- package/src/Shared/Components/IdentityDocumentCamera.flows.ts +7 -4
- package/src/Shared/Components/IdentityDocumentCamera.tsx +224 -188
- package/src/Shared/Components/IdentityDocumentCamera.utils.ts +13 -4
- package/src/Shared/Components/NavigationManager.tsx +41 -19
- package/src/Shared/Contexts/AppContext.ts +2 -0
- package/src/Shared/EIDReader/aesSecureMessagingWrapper.ts +69 -0
- package/src/Shared/EIDReader/apduLevelPACECapable.ts +34 -0
- package/src/Shared/EIDReader/bacKey.ts +24 -8
- package/src/Shared/EIDReader/eidReader.ts +398 -12
- package/src/Shared/EIDReader/eidService.ts +49 -1
- package/src/Shared/EIDReader/nfcManagerCardService.ts +4 -6
- package/src/Shared/EIDReader/paceInfo.ts +159 -0
- package/src/Shared/EIDReader/paceKeySpec.ts +56 -0
- package/src/Shared/EIDReader/protocol/paceAPDUSender.ts +163 -0
- package/src/Shared/EIDReader/protocol/paceProtocol.ts +946 -0
- package/src/Shared/EIDReader/protocol/paceResult.ts +62 -0
- package/src/Shared/EIDReader/secureMessagingWrapper.ts +28 -10
- package/src/Shared/EIDReader/smartcards/commandAPDU.ts +2 -1
- package/src/Shared/EIDReader/tlv/tlv.helpers.ts +1 -1
- package/src/Shared/EIDReader/tlv/tlv.utils.ts +8 -5
- package/src/Shared/EIDReader/utils/aesCrypto.utils.ts +217 -0
- package/src/Shared/Libs/SignalingClient.ts +189 -0
- package/src/Shared/Libs/analytics.utils.ts +8 -0
- package/src/Shared/Libs/contains.ts +0 -53
- package/src/Shared/Libs/country-display.utils.ts +55 -0
- package/src/Shared/Libs/crypto.utils.ts +2 -2
- package/src/Shared/Libs/deeplink.utils.ts +12 -1
- package/src/Shared/Libs/demo.utils.ts +10 -0
- package/src/Shared/Libs/http-client.ts +19 -1
- package/src/Shared/Libs/mrz.utils.ts +3 -2
- package/src/Shared/Libs/promise.utils.ts +16 -2
- package/src/Shared/Libs/status-bar.utils.ts +21 -0
- package/src/Shared/Services/DataUploadService.ts +395 -0
- package/src/Shared/Services/VideoSessionService.ts +190 -0
- package/src/Shared/Services/WebRTCService.ts +636 -0
- package/src/Shared/Types/analytics.types.ts +4 -0
- package/src/Shared/Types/identificationInfo.ts +16 -1
- package/src/Translation/Resources/en.ts +88 -3
- package/src/Translation/Resources/tr.ts +89 -3
- package/src/Trustchex.tsx +65 -19
- package/src/version.ts +1 -1
|
@@ -18,9 +18,10 @@ import i18n from '../../Translation';
|
|
|
18
18
|
import StyledButton from './StyledButton';
|
|
19
19
|
import { analyticsService } from '../Services/AnalyticsService';
|
|
20
20
|
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// Navigation lock - use a ref-like pattern so unmounting resets state.
|
|
22
|
+
// The module-level object is shared across all instances but the
|
|
23
|
+
// cleanup effect in the component resets it on unmount.
|
|
24
|
+
const navigationLock = { isNavigating: false, lastNavigationTime: 0 };
|
|
24
25
|
|
|
25
26
|
export type NavigationManagerRef = {
|
|
26
27
|
navigateToNextStep: () => void;
|
|
@@ -45,20 +46,22 @@ const NavigationManager = forwardRef(
|
|
|
45
46
|
IDENTITY_DOCUMENT_SCAN: 'IdentityDocumentScanningScreen',
|
|
46
47
|
IDENTITY_DOCUMENT_EID_SCAN: 'IdentityDocumentEIDScanningScreen',
|
|
47
48
|
LIVENESS_CHECK: 'LivenessDetectionScreen',
|
|
49
|
+
VERBAL_CONSENT: 'VerbalConsentScreen',
|
|
50
|
+
VIDEO_CALL: 'VideoCallScreen',
|
|
48
51
|
},
|
|
49
52
|
RESULT: 'ResultScreen',
|
|
50
53
|
};
|
|
51
54
|
|
|
52
55
|
React.useEffect(() => {
|
|
53
56
|
const handleFocus = () => {
|
|
54
|
-
isNavigating = false;
|
|
57
|
+
navigationLock.isNavigating = false;
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
navigation.addListener('focus', handleFocus);
|
|
58
61
|
|
|
59
62
|
return () => {
|
|
60
63
|
navigation.removeListener('focus', handleFocus);
|
|
61
|
-
isNavigating = false;
|
|
64
|
+
navigationLock.isNavigating = false;
|
|
62
65
|
};
|
|
63
66
|
}, [navigation]);
|
|
64
67
|
|
|
@@ -109,16 +112,26 @@ const NavigationManager = forwardRef(
|
|
|
109
112
|
return routes.DYNAMIC_ROUTES.LIVENESS_CHECK;
|
|
110
113
|
}
|
|
111
114
|
|
|
115
|
+
if (nextStep.type === 'VIDEO_CALL') {
|
|
116
|
+
return routes.DYNAMIC_ROUTES.VIDEO_CALL;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (nextStep.type === 'VERBAL_CONSENT') {
|
|
120
|
+
return routes.DYNAMIC_ROUTES.VERBAL_CONSENT;
|
|
121
|
+
}
|
|
122
|
+
|
|
112
123
|
return routes.VERIFICATION_SESSION_CHECK;
|
|
113
124
|
},
|
|
114
125
|
[
|
|
115
126
|
appContext,
|
|
116
127
|
routes.VERIFICATION_SESSION_CHECK,
|
|
128
|
+
routes.RESULT,
|
|
117
129
|
routes.DYNAMIC_ROUTES.CONTRACT_ACCEPTANCE,
|
|
118
|
-
routes.DYNAMIC_ROUTES.IDENTITY_DOCUMENT_EID_SCAN,
|
|
119
130
|
routes.DYNAMIC_ROUTES.IDENTITY_DOCUMENT_SCAN,
|
|
131
|
+
routes.DYNAMIC_ROUTES.IDENTITY_DOCUMENT_EID_SCAN,
|
|
120
132
|
routes.DYNAMIC_ROUTES.LIVENESS_CHECK,
|
|
121
|
-
routes.
|
|
133
|
+
routes.DYNAMIC_ROUTES.VIDEO_CALL,
|
|
134
|
+
routes.DYNAMIC_ROUTES.VERBAL_CONSENT,
|
|
122
135
|
]
|
|
123
136
|
);
|
|
124
137
|
|
|
@@ -127,14 +140,15 @@ const NavigationManager = forwardRef(
|
|
|
127
140
|
const minTimeBetweenNavigation = 1000;
|
|
128
141
|
|
|
129
142
|
if (
|
|
130
|
-
isNavigating ||
|
|
131
|
-
currentTime - lastNavigationTime <
|
|
143
|
+
navigationLock.isNavigating ||
|
|
144
|
+
currentTime - navigationLock.lastNavigationTime <
|
|
145
|
+
minTimeBetweenNavigation
|
|
132
146
|
) {
|
|
133
147
|
return;
|
|
134
148
|
}
|
|
135
149
|
|
|
136
|
-
isNavigating = true;
|
|
137
|
-
lastNavigationTime = currentTime;
|
|
150
|
+
navigationLock.isNavigating = true;
|
|
151
|
+
navigationLock.lastNavigationTime = currentTime;
|
|
138
152
|
|
|
139
153
|
try {
|
|
140
154
|
const nextRoute = getNextRoute(
|
|
@@ -151,12 +165,12 @@ const NavigationManager = forwardRef(
|
|
|
151
165
|
})
|
|
152
166
|
);
|
|
153
167
|
} catch (error) {
|
|
154
|
-
isNavigating = false;
|
|
168
|
+
navigationLock.isNavigating = false;
|
|
155
169
|
throw error;
|
|
156
170
|
}
|
|
157
171
|
|
|
158
172
|
setTimeout(() => {
|
|
159
|
-
isNavigating = false;
|
|
173
|
+
navigationLock.isNavigating = false;
|
|
160
174
|
}, 1000);
|
|
161
175
|
}, [
|
|
162
176
|
getNextRoute,
|
|
@@ -166,7 +180,7 @@ const NavigationManager = forwardRef(
|
|
|
166
180
|
]);
|
|
167
181
|
|
|
168
182
|
const goToNextRouteWithAlert = useCallback(() => {
|
|
169
|
-
if (isNavigating) {
|
|
183
|
+
if (navigationLock.isNavigating) {
|
|
170
184
|
return;
|
|
171
185
|
}
|
|
172
186
|
|
|
@@ -187,11 +201,11 @@ const NavigationManager = forwardRef(
|
|
|
187
201
|
}, [goToNextRoute, t]);
|
|
188
202
|
|
|
189
203
|
const reset = useCallback(() => {
|
|
190
|
-
if (isNavigating) {
|
|
204
|
+
if (navigationLock.isNavigating) {
|
|
191
205
|
return;
|
|
192
206
|
}
|
|
193
207
|
|
|
194
|
-
isNavigating = true;
|
|
208
|
+
navigationLock.isNavigating = true;
|
|
195
209
|
|
|
196
210
|
try {
|
|
197
211
|
// Preserve demo session state when resetting
|
|
@@ -207,7 +221,14 @@ const NavigationManager = forwardRef(
|
|
|
207
221
|
deviceInfo: '',
|
|
208
222
|
},
|
|
209
223
|
locale: appContext.locale || i18n.language,
|
|
224
|
+
// Explicitly reset collected data fields
|
|
225
|
+
scannedDocument: undefined,
|
|
226
|
+
livenessDetection: undefined,
|
|
227
|
+
authToken: undefined,
|
|
228
|
+
videoSessionId: undefined,
|
|
210
229
|
};
|
|
230
|
+
|
|
231
|
+
// Reset branding to defaults while preserving any custom values
|
|
211
232
|
appContext.branding = {
|
|
212
233
|
logoUrl: appContext.branding?.logoUrl || '',
|
|
213
234
|
primaryColor: appContext.branding?.primaryColor || '#000000',
|
|
@@ -220,6 +241,7 @@ const NavigationManager = forwardRef(
|
|
|
220
241
|
appContext.setIsDemoSession?.(false);
|
|
221
242
|
analyticsService.setDemoSession(false);
|
|
222
243
|
}
|
|
244
|
+
appContext.isTestVideoSession = false;
|
|
223
245
|
|
|
224
246
|
navigation.dispatch(
|
|
225
247
|
CommonActions.reset({
|
|
@@ -228,17 +250,17 @@ const NavigationManager = forwardRef(
|
|
|
228
250
|
})
|
|
229
251
|
);
|
|
230
252
|
} catch (error) {
|
|
231
|
-
isNavigating = false;
|
|
253
|
+
navigationLock.isNavigating = false;
|
|
232
254
|
throw error;
|
|
233
255
|
}
|
|
234
256
|
|
|
235
257
|
setTimeout(() => {
|
|
236
|
-
isNavigating = false;
|
|
258
|
+
navigationLock.isNavigating = false;
|
|
237
259
|
}, 1000);
|
|
238
260
|
}, [appContext, navigation, routes.VERIFICATION_SESSION_CHECK]);
|
|
239
261
|
|
|
240
262
|
usePreventRemove(true, ({ data }) => {
|
|
241
|
-
if (data
|
|
263
|
+
if (data?.action?.type === 'RESET') {
|
|
242
264
|
navigation.dispatch(data.action);
|
|
243
265
|
}
|
|
244
266
|
});
|
|
@@ -18,6 +18,7 @@ export type AppContextType = {
|
|
|
18
18
|
workflowSteps?: WorkflowStep[];
|
|
19
19
|
currentWorkflowStep?: WorkflowStep;
|
|
20
20
|
isDebugNavigated?: boolean;
|
|
21
|
+
isTestVideoSession?: boolean;
|
|
21
22
|
onCompleted?: () => void;
|
|
22
23
|
onError?: (error: string) => void;
|
|
23
24
|
setSessionId?: (id: string) => void;
|
|
@@ -47,6 +48,7 @@ export default createContext<AppContextType>({
|
|
|
47
48
|
workflowSteps: [],
|
|
48
49
|
currentWorkflowStep: undefined,
|
|
49
50
|
isDebugNavigated: false,
|
|
51
|
+
isTestVideoSession: false,
|
|
50
52
|
onCompleted: undefined,
|
|
51
53
|
onError: undefined,
|
|
52
54
|
setSessionId: undefined,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SecureMessagingWrapper } from './secureMessagingWrapper';
|
|
2
|
+
import { Buffer } from 'buffer';
|
|
3
|
+
import {
|
|
4
|
+
aesEncryptCBC,
|
|
5
|
+
aesDecryptCBC,
|
|
6
|
+
aesEncryptECB,
|
|
7
|
+
aesCMAC,
|
|
8
|
+
} from './utils/aesCrypto.utils';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* AES-based secure messaging wrapper for PACE.
|
|
12
|
+
*
|
|
13
|
+
* Uses AES-CBC for encryption and AES-CMAC for MAC computation,
|
|
14
|
+
* as specified in ICAO Doc 9303 Part 11.
|
|
15
|
+
*/
|
|
16
|
+
export class AESSecureMessagingWrapper extends SecureMessagingWrapper {
|
|
17
|
+
constructor(
|
|
18
|
+
ksEnc: string,
|
|
19
|
+
ksMac: string,
|
|
20
|
+
maxTransceiveLength: number,
|
|
21
|
+
shouldCheckMAC: boolean,
|
|
22
|
+
ssc: bigint
|
|
23
|
+
) {
|
|
24
|
+
super(ksEnc, ksMac, maxTransceiveLength, shouldCheckMAC, ssc);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public getType(): string {
|
|
28
|
+
return 'AES';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected getPadLength(): number {
|
|
32
|
+
return 16;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected getIV(): number[] {
|
|
36
|
+
// AES IV is E(ksEnc, SSC)
|
|
37
|
+
const sscHex = Buffer.from(this.getEncodedSendSequenceCounter()).toString(
|
|
38
|
+
'hex'
|
|
39
|
+
);
|
|
40
|
+
const ivHex = aesEncryptECB(sscHex, this.getEncryptionKey());
|
|
41
|
+
return Array.from(Buffer.from(ivHex, 'hex'));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
protected encrypt(dataHex: string, keyHex: string): string {
|
|
45
|
+
const ivHex = Buffer.from(this.getIV()).toString('hex');
|
|
46
|
+
return aesEncryptCBC(dataHex, keyHex, ivHex);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected decrypt(dataHex: string, keyHex: string): string {
|
|
50
|
+
const ivHex = Buffer.from(this.getIV()).toString('hex');
|
|
51
|
+
return aesDecryptCBC(dataHex, keyHex, ivHex);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected computeMAC(dataHex: string, keyHex: string): string {
|
|
55
|
+
return aesCMAC(dataHex, keyHex);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public getEncodedSendSequenceCounter(): Uint8Array {
|
|
59
|
+
// AES uses 16-byte SSC (128-bit counter)
|
|
60
|
+
const ssc = this.getSendSequenceCounter();
|
|
61
|
+
const bytes = new Uint8Array(16);
|
|
62
|
+
let remaining = ssc;
|
|
63
|
+
for (let i = 15; i >= 0; i--) {
|
|
64
|
+
bytes[i] = Number(remaining & 0xffn);
|
|
65
|
+
remaining >>= 8n;
|
|
66
|
+
}
|
|
67
|
+
return bytes;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { APDUWrapper } from './smartcards/apduWrapper';
|
|
2
|
+
|
|
3
|
+
export interface APDULevelPACECapable {
|
|
4
|
+
/**
|
|
5
|
+
* Sends MSE:Set AT for mutual authentication (PACE).
|
|
6
|
+
*
|
|
7
|
+
* @param wrapper the existing secure messaging wrapper (or null)
|
|
8
|
+
* @param oid the PACE protocol OID
|
|
9
|
+
* @param refPublicKeyOrSecretKey the key reference (0x01 = MRZ, 0x02 = CAN, etc.)
|
|
10
|
+
* @param refPrivateKeyOrForComputingSessionKey optional parameter ID
|
|
11
|
+
*/
|
|
12
|
+
sendMSESetATMutualAuth(
|
|
13
|
+
wrapper: APDUWrapper | null,
|
|
14
|
+
oid: string,
|
|
15
|
+
refPublicKeyOrSecretKey: number,
|
|
16
|
+
refPrivateKeyOrForComputingSessionKey: number[] | null
|
|
17
|
+
): Promise<void>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sends a General Authenticate command for PACE.
|
|
21
|
+
*
|
|
22
|
+
* @param wrapper the existing secure messaging wrapper (or null)
|
|
23
|
+
* @param data the data to send (without 0x7C wrapper)
|
|
24
|
+
* @param le expected response length
|
|
25
|
+
* @param isLast whether this is the last command in the chain
|
|
26
|
+
* @returns the response data (without 0x7C wrapper)
|
|
27
|
+
*/
|
|
28
|
+
sendGeneralAuthenticate(
|
|
29
|
+
wrapper: APDUWrapper | null,
|
|
30
|
+
data: number[],
|
|
31
|
+
le: number,
|
|
32
|
+
isLast: boolean
|
|
33
|
+
): Promise<number[]>;
|
|
34
|
+
}
|
|
@@ -79,19 +79,35 @@ export class BACKey implements BACKeySpec {
|
|
|
79
79
|
*/
|
|
80
80
|
public getKey() {
|
|
81
81
|
try {
|
|
82
|
-
|
|
83
|
-
this.documentNumber +
|
|
84
|
-
MRZInfo.checkDigit(this.documentNumber, false) +
|
|
85
|
-
this.dateOfBirth +
|
|
86
|
-
MRZInfo.checkDigit(this.dateOfBirth, false) +
|
|
87
|
-
this.dateOfExpiry +
|
|
88
|
-
MRZInfo.checkDigit(this.dateOfExpiry, false);
|
|
89
|
-
return cryptoUtils.computeKeySeed(mrz, 'SHA-1', true);
|
|
82
|
+
return cryptoUtils.computeKeySeed(this.getMRZString(), 'SHA-1', true);
|
|
90
83
|
} catch (gse) {
|
|
91
84
|
throw new Error('Unexpected exception');
|
|
92
85
|
}
|
|
93
86
|
}
|
|
94
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Returns the key seed for PACE, which is the full (non-truncated) SHA-1 hash
|
|
90
|
+
* of the MRZ info. PACE uses the full 20-byte hash unlike BAC which truncates to 16.
|
|
91
|
+
*/
|
|
92
|
+
public getKeySeedForPACE(): string {
|
|
93
|
+
try {
|
|
94
|
+
return cryptoUtils.computeKeySeed(this.getMRZString(), 'SHA-1', false);
|
|
95
|
+
} catch (gse) {
|
|
96
|
+
throw new Error('Unexpected exception');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private getMRZString(): string {
|
|
101
|
+
return (
|
|
102
|
+
this.documentNumber +
|
|
103
|
+
MRZInfo.checkDigit(this.documentNumber, false) +
|
|
104
|
+
this.dateOfBirth +
|
|
105
|
+
MRZInfo.checkDigit(this.dateOfBirth, false) +
|
|
106
|
+
this.dateOfExpiry +
|
|
107
|
+
MRZInfo.checkDigit(this.dateOfExpiry, false)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
95
111
|
/**
|
|
96
112
|
* Sets the document number.
|
|
97
113
|
*
|