@trustchex/react-native-sdk 1.161.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/LICENSE +49 -0
- package/README.md +223 -0
- package/TrustchexSDK.podspec +26 -0
- package/android/build.gradle +103 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKModule.kt +40 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKPackage.kt +61 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/barcodescanner/BarcodeScannerFrameProcessorPlugin.kt +301 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/BitmapUtils.kt +205 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/CropperPlugin.kt +72 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/FrameMetadata.kt +4 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/facedetector/FaceDetectorFrameProcessorPlugin.kt +303 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/textrecognition/TextRecognitionFrameProcessorPlugin.kt +115 -0
- package/ios/TrustchexSDK.h +5 -0
- package/ios/TrustchexSDK.mm +28 -0
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.mm +22 -0
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.swift +172 -0
- package/ios/VisionCameraPlugins/Cropper/Cropper-Bridging-Header.h +13 -0
- package/ios/VisionCameraPlugins/Cropper/Cropper.h +20 -0
- package/ios/VisionCameraPlugins/Cropper/Cropper.mm +22 -0
- package/ios/VisionCameraPlugins/Cropper/Cropper.swift +145 -0
- package/ios/VisionCameraPlugins/Cropper/CropperUtils.swift +49 -0
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin-Bridging-Header.h +4 -0
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.mm +22 -0
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.swift +320 -0
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin-Bridging-Header.h +4 -0
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.mm +27 -0
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.swift +144 -0
- package/lib/module/NativeTrustchexSDK.js +4 -0
- package/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +141 -0
- package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +140 -0
- package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +100 -0
- package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +596 -0
- package/lib/module/Screens/Static/QrCodeScanningScreen.js +36 -0
- package/lib/module/Screens/Static/ResultScreen.js +627 -0
- package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +381 -0
- package/lib/module/Shared/Animations/face-scan.json +1 -0
- package/lib/module/Shared/Animations/hole.json +76 -0
- package/lib/module/Shared/Animations/hologram-scan.json +1 -0
- package/lib/module/Shared/Animations/id-or-passport.json +1 -0
- package/lib/module/Shared/Animations/light.json +1 -0
- package/lib/module/Shared/Animations/loading.json +1 -0
- package/lib/module/Shared/Animations/nfc-scan.json +1 -0
- package/lib/module/Shared/Animations/nfc.json +1 -0
- package/lib/module/Shared/Animations/scanning.json +1 -0
- package/lib/module/Shared/Animations/success.json +1 -0
- package/lib/module/Shared/Assets/trustchex-logo-black.png +0 -0
- package/lib/module/Shared/Components/EIDScanner.js +372 -0
- package/lib/module/Shared/Components/FaceCamera.js +223 -0
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +968 -0
- package/lib/module/Shared/Components/LanguageSelector.js +53 -0
- package/lib/module/Shared/Components/NativeCircularProgress.js +64 -0
- package/lib/module/Shared/Components/NativeProgressBar.js +53 -0
- package/lib/module/Shared/Components/NavigationManager.js +180 -0
- package/lib/module/Shared/Components/OTPCodeInput.js +74 -0
- package/lib/module/Shared/Components/QrCodeScannerCamera.js +262 -0
- package/lib/module/Shared/Contexts/AppContext.js +27 -0
- package/lib/module/Shared/EIDReader/abstractMRTDCardService.js +4 -0
- package/lib/module/Shared/EIDReader/accessKeySpec.js +1 -0
- package/lib/module/Shared/EIDReader/apduLevelBACCapable.js +1 -0
- package/lib/module/Shared/EIDReader/apduLevelReadBinaryCapable.js +3 -0
- package/lib/module/Shared/EIDReader/bacKey.js +112 -0
- package/lib/module/Shared/EIDReader/bacKeySpec.js +3 -0
- package/lib/module/Shared/EIDReader/cardFileInputStream.js +140 -0
- package/lib/module/Shared/EIDReader/cardService.js +31 -0
- package/lib/module/Shared/EIDReader/cbeff/biometricDataBlock.js +3 -0
- package/lib/module/Shared/EIDReader/cbeff/biometricDataBlockDecoder.js +3 -0
- package/lib/module/Shared/EIDReader/cbeff/biometricDataBlockEncoder.js +3 -0
- package/lib/module/Shared/EIDReader/cbeff/cbeffInfo.js +102 -0
- package/lib/module/Shared/EIDReader/cbeff/complexCBEFFInfo.js +46 -0
- package/lib/module/Shared/EIDReader/cbeff/faceDataBlockDecoder.js +8 -0
- package/lib/module/Shared/EIDReader/cbeff/iso781611.js +79 -0
- package/lib/module/Shared/EIDReader/cbeff/iso781611Decoder.js +141 -0
- package/lib/module/Shared/EIDReader/cbeff/iso781611Encoder.js +53 -0
- package/lib/module/Shared/EIDReader/cbeff/simpleCBEFFInfo.js +21 -0
- package/lib/module/Shared/EIDReader/cbeff/standardBiometricHeader.js +97 -0
- package/lib/module/Shared/EIDReader/cert/cvcPrincipal.js +48 -0
- package/lib/module/Shared/EIDReader/data/country.js +66 -0
- package/lib/module/Shared/EIDReader/data/gender.js +29 -0
- package/lib/module/Shared/EIDReader/data/isoCountry.js +283 -0
- package/lib/module/Shared/EIDReader/data/unicodeCountry.js +278 -0
- package/lib/module/Shared/EIDReader/defaultFileInfo.js +29 -0
- package/lib/module/Shared/EIDReader/defaultFileSystem.js +171 -0
- package/lib/module/Shared/EIDReader/eidReader.js +90 -0
- package/lib/module/Shared/EIDReader/eidService.js +280 -0
- package/lib/module/Shared/EIDReader/fileInfo.js +3 -0
- package/lib/module/Shared/EIDReader/fileSystemCardService.js +4 -0
- package/lib/module/Shared/EIDReader/fragment.js +17 -0
- package/lib/module/Shared/EIDReader/fragmentBuffer.js +130 -0
- package/lib/module/Shared/EIDReader/java/byteArrayInputStream.js +73 -0
- package/lib/module/Shared/EIDReader/java/byteArrayOutputStream.js +55 -0
- package/lib/module/Shared/EIDReader/java/dataInput.js +1 -0
- package/lib/module/Shared/EIDReader/java/dataInputStream.js +167 -0
- package/lib/module/Shared/EIDReader/java/dataOutputStream.js +91 -0
- package/lib/module/Shared/EIDReader/java/filterInputStream.js +134 -0
- package/lib/module/Shared/EIDReader/java/filterOutputStream.js +124 -0
- package/lib/module/Shared/EIDReader/java/inputStream.js +139 -0
- package/lib/module/Shared/EIDReader/java/inputStreamBuffer.js +144 -0
- package/lib/module/Shared/EIDReader/java/objectInputStream.js +39 -0
- package/lib/module/Shared/EIDReader/java/outputStream.js +77 -0
- package/lib/module/Shared/EIDReader/java/positionInputStream.js +50 -0
- package/lib/module/Shared/EIDReader/java/splittableInputStream.js +54 -0
- package/lib/module/Shared/EIDReader/lds/abstractImageInfo.js +137 -0
- package/lib/module/Shared/EIDReader/lds/abstractLDSFile.js +101 -0
- package/lib/module/Shared/EIDReader/lds/abstractLDSInfo.js +29 -0
- package/lib/module/Shared/EIDReader/lds/abstractListInfo.js +66 -0
- package/lib/module/Shared/EIDReader/lds/abstractTaggedLDSFile.js +65 -0
- package/lib/module/Shared/EIDReader/lds/cbeffDataGroup.js +118 -0
- package/lib/module/Shared/EIDReader/lds/cvcaFile.js +89 -0
- package/lib/module/Shared/EIDReader/lds/dataGroup.js +10 -0
- package/lib/module/Shared/EIDReader/lds/icao/comFile.js +101 -0
- package/lib/module/Shared/EIDReader/lds/icao/dg1File.js +33 -0
- package/lib/module/Shared/EIDReader/lds/icao/dg2File.js +42 -0
- package/lib/module/Shared/EIDReader/lds/icao/icaoCountry.js +114 -0
- package/lib/module/Shared/EIDReader/lds/icao/mrzInfo.js +1418 -0
- package/lib/module/Shared/EIDReader/lds/imageInfo.js +3 -0
- package/lib/module/Shared/EIDReader/lds/iso19794/faceImageInfo.js +817 -0
- package/lib/module/Shared/EIDReader/lds/iso19794/faceInfo.js +116 -0
- package/lib/module/Shared/EIDReader/lds/ldsElement.js +1 -0
- package/lib/module/Shared/EIDReader/lds/ldsFile.js +3 -0
- package/lib/module/Shared/EIDReader/nfcManagerCardService.js +44 -0
- package/lib/module/Shared/EIDReader/protocol/bacAPDUSender.js +83 -0
- package/lib/module/Shared/EIDReader/protocol/bacProtocol.js +70 -0
- package/lib/module/Shared/EIDReader/protocol/bacResult.js +32 -0
- package/lib/module/Shared/EIDReader/protocol/readBinaryAPDUSender.js +126 -0
- package/lib/module/Shared/EIDReader/protocol/secureMessagingAPDUSender.js +102 -0
- package/lib/module/Shared/EIDReader/secureMessagingWrapper.js +218 -0
- package/lib/module/Shared/EIDReader/smartcards/apduEvent.js +23 -0
- package/lib/module/Shared/EIDReader/smartcards/apduListener.js +3 -0
- package/lib/module/Shared/EIDReader/smartcards/apduWrapper.js +3 -0
- package/lib/module/Shared/EIDReader/smartcards/commandAPDU.js +124 -0
- package/lib/module/Shared/EIDReader/smartcards/fileSystemStructured.js +3 -0
- package/lib/module/Shared/EIDReader/smartcards/iso7816.js +107 -0
- package/lib/module/Shared/EIDReader/smartcards/responseAPDU.js +35 -0
- package/lib/module/Shared/EIDReader/tlv/asn1Constants.js +48 -0
- package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +186 -0
- package/lib/module/Shared/EIDReader/tlv/tlvInputState.js +141 -0
- package/lib/module/Shared/EIDReader/tlv/tlvInputStream.js +180 -0
- package/lib/module/Shared/EIDReader/tlv/tlvOutputState.js +186 -0
- package/lib/module/Shared/EIDReader/tlv/tlvOutputStream.js +85 -0
- package/lib/module/Shared/EIDReader/tripleDesSecureMessagingWrapper.js +37 -0
- package/lib/module/Shared/EIDReader/utils/crypto.utils.js +218 -0
- package/lib/module/Shared/EIDReader/utils/random.js +166 -0
- package/lib/module/Shared/EIDReader/wrappedAPDUEvent.js +16 -0
- package/lib/module/Shared/Libs/camera.utils.js +32 -0
- package/lib/module/Shared/Libs/contains.js +40 -0
- package/lib/module/Shared/Libs/crypto.utils.js +35 -0
- package/lib/module/Shared/Libs/debounce.utils.js +35 -0
- package/lib/module/Shared/Libs/deeplink.utils.js +20 -0
- package/lib/module/Shared/Libs/demo.utils.js +57 -0
- package/lib/module/Shared/Libs/http-client.js +104 -0
- package/lib/module/Shared/Libs/mrz.utils.js +99 -0
- package/lib/module/Shared/Libs/native-device-info.utils.js +44 -0
- package/lib/module/Shared/Libs/native-keep-awake.utils.js +85 -0
- package/lib/module/Shared/Libs/opencv.utils.js +21 -0
- package/lib/module/Shared/Libs/promise.utils.js +17 -0
- package/lib/module/Shared/Libs/tts.utils.js +31 -0
- package/lib/module/Shared/Types/identificationInfo.js +3 -0
- package/lib/module/Shared/Types/instruction.js +1 -0
- package/lib/module/Shared/Types/livenessIntructionType.js +1 -0
- package/lib/module/Shared/Types/verificationSession.js +3 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.js +66 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.js +46 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.js +34 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/index.js +21 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.js +24 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/types.js +3 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.js +197 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.js +101 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.js +60 -0
- package/lib/module/Shared/VisionCameraPlugins/Cropper/index.js +47 -0
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/Camera.js +42 -0
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/detectFaces.js +35 -0
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/index.js +4 -0
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/types.js +3 -0
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/Camera.js +56 -0
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.js +20 -0
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.js +9 -0
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/index.js +6 -0
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/scanText.js +20 -0
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/translateText.js +19 -0
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/types.js +3 -0
- package/lib/module/Translation/Resources/en.js +109 -0
- package/lib/module/Translation/Resources/index.js +4 -0
- package/lib/module/Translation/Resources/tr.js +112 -0
- package/lib/module/Translation/index.js +27 -0
- package/lib/module/Trustchex.js +149 -0
- package/lib/module/index.js +5 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeTrustchexSDK.d.ts +8 -0
- package/lib/typescript/src/NativeTrustchexSDK.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts +12 -0
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/FaceCamera.d.ts +9 -0
- package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts +58 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/LanguageSelector.d.ts +3 -0
- package/lib/typescript/src/Shared/Components/LanguageSelector.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/NativeCircularProgress.d.ts +13 -0
- package/lib/typescript/src/Shared/Components/NativeCircularProgress.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/NativeProgressBar.d.ts +12 -0
- package/lib/typescript/src/Shared/Components/NativeProgressBar.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/NavigationManager.d.ts +11 -0
- package/lib/typescript/src/Shared/Components/NavigationManager.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/OTPCodeInput.d.ts +10 -0
- package/lib/typescript/src/Shared/Components/OTPCodeInput.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts +6 -0
- package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts +20 -0
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/abstractMRTDCardService.d.ts +50 -0
- package/lib/typescript/src/Shared/EIDReader/abstractMRTDCardService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/accessKeySpec.d.ts +16 -0
- package/lib/typescript/src/Shared/EIDReader/accessKeySpec.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/apduLevelBACCapable.d.ts +5 -0
- package/lib/typescript/src/Shared/EIDReader/apduLevelBACCapable.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/apduLevelReadBinaryCapable.d.ts +8 -0
- package/lib/typescript/src/Shared/EIDReader/apduLevelReadBinaryCapable.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts +65 -0
- package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/bacKeySpec.d.ts +24 -0
- package/lib/typescript/src/Shared/EIDReader/bacKeySpec.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cardFileInputStream.d.ts +26 -0
- package/lib/typescript/src/Shared/EIDReader/cardFileInputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cardService.d.ts +22 -0
- package/lib/typescript/src/Shared/EIDReader/cardService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlock.d.ts +5 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlock.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlockDecoder.d.ts +7 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlockDecoder.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlockEncoder.d.ts +6 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlockEncoder.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/cbeffInfo.d.ts +61 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/cbeffInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/complexCBEFFInfo.d.ts +33 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/complexCBEFFInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/faceDataBlockDecoder.d.ts +8 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/faceDataBlockDecoder.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611.d.ts +60 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611Decoder.d.ts +19 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611Decoder.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611Encoder.d.ts +15 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611Encoder.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/simpleCBEFFInfo.d.ts +18 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/simpleCBEFFInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/standardBiometricHeader.d.ts +43 -0
- package/lib/typescript/src/Shared/EIDReader/cbeff/standardBiometricHeader.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/cert/cvcPrincipal.d.ts +14 -0
- package/lib/typescript/src/Shared/EIDReader/cert/cvcPrincipal.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/data/country.d.ts +14 -0
- package/lib/typescript/src/Shared/EIDReader/data/country.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/data/gender.d.ts +14 -0
- package/lib/typescript/src/Shared/EIDReader/data/gender.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/data/isoCountry.d.ts +268 -0
- package/lib/typescript/src/Shared/EIDReader/data/isoCountry.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/data/unicodeCountry.d.ts +263 -0
- package/lib/typescript/src/Shared/EIDReader/data/unicodeCountry.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/defaultFileInfo.d.ts +14 -0
- package/lib/typescript/src/Shared/EIDReader/defaultFileInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/defaultFileSystem.d.ts +30 -0
- package/lib/typescript/src/Shared/EIDReader/defaultFileSystem.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts +8 -0
- package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/eidService.d.ts +150 -0
- package/lib/typescript/src/Shared/EIDReader/eidService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/fileInfo.d.ts +5 -0
- package/lib/typescript/src/Shared/EIDReader/fileInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/fileSystemCardService.d.ts +28 -0
- package/lib/typescript/src/Shared/EIDReader/fileSystemCardService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/fragment.d.ts +9 -0
- package/lib/typescript/src/Shared/EIDReader/fragment.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/fragmentBuffer.d.ts +22 -0
- package/lib/typescript/src/Shared/EIDReader/fragmentBuffer.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/byteArrayInputStream.d.ts +22 -0
- package/lib/typescript/src/Shared/EIDReader/java/byteArrayInputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/byteArrayOutputStream.d.ts +18 -0
- package/lib/typescript/src/Shared/EIDReader/java/byteArrayOutputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/dataInput.d.ts +17 -0
- package/lib/typescript/src/Shared/EIDReader/java/dataInput.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/dataInputStream.d.ts +28 -0
- package/lib/typescript/src/Shared/EIDReader/java/dataInputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/dataOutputStream.d.ts +18 -0
- package/lib/typescript/src/Shared/EIDReader/java/dataOutputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/filterInputStream.d.ts +103 -0
- package/lib/typescript/src/Shared/EIDReader/java/filterInputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/filterOutputStream.d.ts +83 -0
- package/lib/typescript/src/Shared/EIDReader/java/filterOutputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/inputStream.d.ts +21 -0
- package/lib/typescript/src/Shared/EIDReader/java/inputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/inputStreamBuffer.d.ts +32 -0
- package/lib/typescript/src/Shared/EIDReader/java/inputStreamBuffer.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/objectInputStream.d.ts +11 -0
- package/lib/typescript/src/Shared/EIDReader/java/objectInputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/outputStream.d.ts +64 -0
- package/lib/typescript/src/Shared/EIDReader/java/outputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/positionInputStream.d.ts +17 -0
- package/lib/typescript/src/Shared/EIDReader/java/positionInputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/java/splittableInputStream.d.ts +19 -0
- package/lib/typescript/src/Shared/EIDReader/java/splittableInputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractImageInfo.d.ts +50 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractImageInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractLDSFile.d.ts +71 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractLDSFile.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractLDSInfo.d.ts +19 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractLDSInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractListInfo.d.ts +45 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractListInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractTaggedLDSFile.d.ts +18 -0
- package/lib/typescript/src/Shared/EIDReader/lds/abstractTaggedLDSFile.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/cbeffDataGroup.d.ts +59 -0
- package/lib/typescript/src/Shared/EIDReader/lds/cbeffDataGroup.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/cvcaFile.d.ts +19 -0
- package/lib/typescript/src/Shared/EIDReader/lds/cvcaFile.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/dataGroup.d.ts +8 -0
- package/lib/typescript/src/Shared/EIDReader/lds/dataGroup.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/comFile.d.ts +22 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/comFile.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/dg1File.d.ts +13 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/dg1File.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/dg2File.d.ts +14 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/dg2File.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/icaoCountry.d.ts +80 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/icaoCountry.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/mrzInfo.d.ts +579 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/mrzInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/imageInfo.d.ts +52 -0
- package/lib/typescript/src/Shared/EIDReader/lds/imageInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/iso19794/faceImageInfo.d.ts +392 -0
- package/lib/typescript/src/Shared/EIDReader/lds/iso19794/faceImageInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/iso19794/faceInfo.d.ts +22 -0
- package/lib/typescript/src/Shared/EIDReader/lds/iso19794/faceInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/ldsElement.d.ts +9 -0
- package/lib/typescript/src/Shared/EIDReader/lds/ldsElement.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/lds/ldsFile.d.ts +10 -0
- package/lib/typescript/src/Shared/EIDReader/lds/ldsFile.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/nfcManagerCardService.d.ts +13 -0
- package/lib/typescript/src/Shared/EIDReader/nfcManagerCardService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/bacAPDUSender.d.ts +9 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/bacAPDUSender.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/bacProtocol.d.ts +17 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/bacProtocol.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/bacResult.d.ts +26 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/bacResult.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/readBinaryAPDUSender.d.ts +15 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/readBinaryAPDUSender.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/secureMessagingAPDUSender.d.ts +19 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/secureMessagingAPDUSender.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts +30 -0
- package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/apduEvent.d.ts +15 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/apduEvent.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/apduListener.d.ts +5 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/apduListener.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/apduWrapper.d.ts +8 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/apduWrapper.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/commandAPDU.d.ts +20 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/commandAPDU.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/fileSystemStructured.d.ts +7 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/fileSystemStructured.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/iso7816.d.ts +101 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/iso7816.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/responseAPDU.d.ts +13 -0
- package/lib/typescript/src/Shared/EIDReader/smartcards/responseAPDU.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/asn1Constants.d.ts +36 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/asn1Constants.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts +44 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvInputState.d.ts +34 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvInputState.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvInputStream.d.ts +23 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvInputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputState.d.ts +24 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputState.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputStream.d.ts +16 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputStream.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tripleDesSecureMessagingWrapper.d.ts +10 -0
- package/lib/typescript/src/Shared/EIDReader/tripleDesSecureMessagingWrapper.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/utils/crypto.utils.d.ts +16 -0
- package/lib/typescript/src/Shared/EIDReader/utils/crypto.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/utils/random.d.ts +25 -0
- package/lib/typescript/src/Shared/EIDReader/utils/random.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/wrappedAPDUEvent.d.ts +11 -0
- package/lib/typescript/src/Shared/EIDReader/wrappedAPDUEvent.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/camera.utils.d.ts +5 -0
- package/lib/typescript/src/Shared/Libs/camera.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/contains.d.ts +14 -0
- package/lib/typescript/src/Shared/Libs/contains.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/crypto.utils.d.ts +9 -0
- package/lib/typescript/src/Shared/Libs/crypto.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/debounce.utils.d.ts +10 -0
- package/lib/typescript/src/Shared/Libs/debounce.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts +5 -0
- package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/demo.utils.d.ts +5 -0
- package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/http-client.d.ts +27 -0
- package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts +9 -0
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts +14 -0
- package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/native-keep-awake.utils.d.ts +31 -0
- package/lib/typescript/src/Shared/Libs/native-keep-awake.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts +3 -0
- package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/promise.utils.d.ts +3 -0
- package/lib/typescript/src/Shared/Libs/promise.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/tts.utils.d.ts +6 -0
- package/lib/typescript/src/Shared/Libs/tts.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +57 -0
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/instruction.d.ts +5 -0
- package/lib/typescript/src/Shared/Types/instruction.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/livenessIntructionType.d.ts +2 -0
- package/lib/typescript/src/Shared/Types/livenessIntructionType.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/verificationSession.d.ts +16 -0
- package/lib/typescript/src/Shared/Types/verificationSession.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.d.ts +13 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts +13 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts +6 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts +14 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts +3 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts +52 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts +62 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts +34 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts +32 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts +23 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts +9 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts +3 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts +3 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts +79 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts +6 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts +3 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts +3 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts +5 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts +3 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts +3 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts.map +1 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts +67 -0
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts.map +1 -0
- package/lib/typescript/src/Translation/Resources/en.d.ts +109 -0
- package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -0
- package/lib/typescript/src/Translation/Resources/index.d.ts +3 -0
- package/lib/typescript/src/Translation/Resources/index.d.ts.map +1 -0
- package/lib/typescript/src/Translation/Resources/tr.d.ts +112 -0
- package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -0
- package/lib/typescript/src/Translation/index.d.ts +3 -0
- package/lib/typescript/src/Translation/index.d.ts.map +1 -0
- package/lib/typescript/src/Trustchex.d.ts +18 -0
- package/lib/typescript/src/Trustchex.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +288 -0
- package/src/NativeTrustchexSDK.ts +9 -0
- package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +165 -0
- package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +205 -0
- package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +152 -0
- package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +699 -0
- package/src/Screens/Static/QrCodeScanningScreen.tsx +37 -0
- package/src/Screens/Static/ResultScreen.tsx +877 -0
- package/src/Screens/Static/VerificationSessionCheckScreen.tsx +524 -0
- package/src/Shared/Animations/face-scan.json +1 -0
- package/src/Shared/Animations/hole.json +76 -0
- package/src/Shared/Animations/hologram-scan.json +1 -0
- package/src/Shared/Animations/id-or-passport.json +1 -0
- package/src/Shared/Animations/light.json +1 -0
- package/src/Shared/Animations/loading.json +1 -0
- package/src/Shared/Animations/nfc-scan.json +1 -0
- package/src/Shared/Animations/nfc.json +1 -0
- package/src/Shared/Animations/scanning.json +1 -0
- package/src/Shared/Animations/success.json +1 -0
- package/src/Shared/Assets/trustchex-logo-black.png +0 -0
- package/src/Shared/Components/EIDScanner.tsx +472 -0
- package/src/Shared/Components/FaceCamera.tsx +267 -0
- package/src/Shared/Components/IdentityDocumentCamera.tsx +1377 -0
- package/src/Shared/Components/LanguageSelector.tsx +62 -0
- package/src/Shared/Components/NativeCircularProgress.tsx +76 -0
- package/src/Shared/Components/NativeProgressBar.tsx +74 -0
- package/src/Shared/Components/NavigationManager.tsx +275 -0
- package/src/Shared/Components/OTPCodeInput.tsx +93 -0
- package/src/Shared/Components/QrCodeScannerCamera.tsx +306 -0
- package/src/Shared/Contexts/AppContext.ts +47 -0
- package/src/Shared/EIDReader/abstractMRTDCardService.ts +195 -0
- package/src/Shared/EIDReader/accessKeySpec.ts +16 -0
- package/src/Shared/EIDReader/apduLevelBACCapable.ts +10 -0
- package/src/Shared/EIDReader/apduLevelReadBinaryCapable.ts +15 -0
- package/src/Shared/EIDReader/bacKey.ts +132 -0
- package/src/Shared/EIDReader/bacKeySpec.ts +26 -0
- package/src/Shared/EIDReader/cardFileInputStream.ts +188 -0
- package/src/Shared/EIDReader/cardService.ts +51 -0
- package/src/Shared/EIDReader/cbeff/biometricDataBlock.ts +5 -0
- package/src/Shared/EIDReader/cbeff/biometricDataBlockDecoder.ts +12 -0
- package/src/Shared/EIDReader/cbeff/biometricDataBlockEncoder.ts +6 -0
- package/src/Shared/EIDReader/cbeff/cbeffInfo.ts +100 -0
- package/src/Shared/EIDReader/cbeff/complexCBEFFInfo.ts +48 -0
- package/src/Shared/EIDReader/cbeff/faceDataBlockDecoder.ts +17 -0
- package/src/Shared/EIDReader/cbeff/iso781611.ts +79 -0
- package/src/Shared/EIDReader/cbeff/iso781611Decoder.ts +242 -0
- package/src/Shared/EIDReader/cbeff/iso781611Encoder.ts +91 -0
- package/src/Shared/EIDReader/cbeff/simpleCBEFFInfo.ts +26 -0
- package/src/Shared/EIDReader/cbeff/standardBiometricHeader.ts +116 -0
- package/src/Shared/EIDReader/cert/cvcPrincipal.ts +63 -0
- package/src/Shared/EIDReader/data/country.ts +76 -0
- package/src/Shared/EIDReader/data/gender.ts +36 -0
- package/src/Shared/EIDReader/data/isoCountry.ts +1251 -0
- package/src/Shared/EIDReader/data/unicodeCountry.ts +1516 -0
- package/src/Shared/EIDReader/defaultFileInfo.ts +41 -0
- package/src/Shared/EIDReader/defaultFileSystem.ts +287 -0
- package/src/Shared/EIDReader/eidReader.ts +113 -0
- package/src/Shared/EIDReader/eidService.ts +349 -0
- package/src/Shared/EIDReader/fileInfo.ts +5 -0
- package/src/Shared/EIDReader/fileSystemCardService.ts +32 -0
- package/src/Shared/EIDReader/fragment.ts +21 -0
- package/src/Shared/EIDReader/fragmentBuffer.ts +191 -0
- package/src/Shared/EIDReader/java/byteArrayInputStream.ts +103 -0
- package/src/Shared/EIDReader/java/byteArrayOutputStream.ts +67 -0
- package/src/Shared/EIDReader/java/dataInput.ts +16 -0
- package/src/Shared/EIDReader/java/dataInputStream.ts +203 -0
- package/src/Shared/EIDReader/java/dataOutputStream.ts +107 -0
- package/src/Shared/EIDReader/java/filterInputStream.ts +138 -0
- package/src/Shared/EIDReader/java/filterOutputStream.ts +126 -0
- package/src/Shared/EIDReader/java/inputStream.ts +186 -0
- package/src/Shared/EIDReader/java/inputStreamBuffer.ts +200 -0
- package/src/Shared/EIDReader/java/objectInputStream.ts +45 -0
- package/src/Shared/EIDReader/java/outputStream.ts +76 -0
- package/src/Shared/EIDReader/java/positionInputStream.ts +64 -0
- package/src/Shared/EIDReader/java/splittableInputStream.ts +69 -0
- package/src/Shared/EIDReader/lds/abstractImageInfo.ts +191 -0
- package/src/Shared/EIDReader/lds/abstractLDSFile.ts +106 -0
- package/src/Shared/EIDReader/lds/abstractLDSInfo.ts +31 -0
- package/src/Shared/EIDReader/lds/abstractListInfo.ts +72 -0
- package/src/Shared/EIDReader/lds/abstractTaggedLDSFile.ts +85 -0
- package/src/Shared/EIDReader/lds/cbeffDataGroup.ts +128 -0
- package/src/Shared/EIDReader/lds/cvcaFile.ts +112 -0
- package/src/Shared/EIDReader/lds/dataGroup.ts +11 -0
- package/src/Shared/EIDReader/lds/icao/comFile.ts +166 -0
- package/src/Shared/EIDReader/lds/icao/dg1File.ts +45 -0
- package/src/Shared/EIDReader/lds/icao/dg2File.ts +54 -0
- package/src/Shared/EIDReader/lds/icao/icaoCountry.ts +253 -0
- package/src/Shared/EIDReader/lds/icao/mrzInfo.ts +1669 -0
- package/src/Shared/EIDReader/lds/imageInfo.ts +58 -0
- package/src/Shared/EIDReader/lds/iso19794/faceImageInfo.ts +948 -0
- package/src/Shared/EIDReader/lds/iso19794/faceInfo.ts +198 -0
- package/src/Shared/EIDReader/lds/ldsElement.ts +8 -0
- package/src/Shared/EIDReader/lds/ldsFile.ts +14 -0
- package/src/Shared/EIDReader/nfcManagerCardService.ts +58 -0
- package/src/Shared/EIDReader/protocol/bacAPDUSender.ts +146 -0
- package/src/Shared/EIDReader/protocol/bacProtocol.ts +121 -0
- package/src/Shared/EIDReader/protocol/bacResult.ts +36 -0
- package/src/Shared/EIDReader/protocol/readBinaryAPDUSender.ts +251 -0
- package/src/Shared/EIDReader/protocol/secureMessagingAPDUSender.ts +170 -0
- package/src/Shared/EIDReader/secureMessagingWrapper.ts +361 -0
- package/src/Shared/EIDReader/smartcards/apduEvent.ts +38 -0
- package/src/Shared/EIDReader/smartcards/apduListener.ts +5 -0
- package/src/Shared/EIDReader/smartcards/apduWrapper.ts +10 -0
- package/src/Shared/EIDReader/smartcards/commandAPDU.ts +172 -0
- package/src/Shared/EIDReader/smartcards/fileSystemStructured.ts +7 -0
- package/src/Shared/EIDReader/smartcards/iso7816.ts +104 -0
- package/src/Shared/EIDReader/smartcards/responseAPDU.ts +44 -0
- package/src/Shared/EIDReader/tlv/asn1Constants.ts +46 -0
- package/src/Shared/EIDReader/tlv/tlv.utils.ts +201 -0
- package/src/Shared/EIDReader/tlv/tlvInputState.ts +186 -0
- package/src/Shared/EIDReader/tlv/tlvInputStream.ts +207 -0
- package/src/Shared/EIDReader/tlv/tlvOutputState.ts +244 -0
- package/src/Shared/EIDReader/tlv/tlvOutputStream.ts +112 -0
- package/src/Shared/EIDReader/tripleDesSecureMessagingWrapper.ts +48 -0
- package/src/Shared/EIDReader/utils/crypto.utils.ts +273 -0
- package/src/Shared/EIDReader/utils/random.ts +198 -0
- package/src/Shared/EIDReader/wrappedAPDUEvent.ts +36 -0
- package/src/Shared/Libs/camera.utils.ts +34 -0
- package/src/Shared/Libs/contains.ts +59 -0
- package/src/Shared/Libs/crypto.utils.ts +47 -0
- package/src/Shared/Libs/debounce.utils.ts +38 -0
- package/src/Shared/Libs/deeplink.utils.ts +19 -0
- package/src/Shared/Libs/demo.utils.ts +82 -0
- package/src/Shared/Libs/http-client.ts +148 -0
- package/src/Shared/Libs/mrz.utils.ts +110 -0
- package/src/Shared/Libs/native-device-info.utils.ts +50 -0
- package/src/Shared/Libs/native-keep-awake.utils.ts +104 -0
- package/src/Shared/Libs/opencv.utils.ts +40 -0
- package/src/Shared/Libs/promise.utils.ts +20 -0
- package/src/Shared/Libs/tts.utils.ts +40 -0
- package/src/Shared/Types/identificationInfo.ts +62 -0
- package/src/Shared/Types/instruction.ts +4 -0
- package/src/Shared/Types/livenessIntructionType.ts +8 -0
- package/src/Shared/Types/verificationSession.ts +17 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.tsx +85 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.ts +79 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.ts +45 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/index.ts +64 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.ts +30 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/types.ts +82 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.ts +195 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.ts +135 -0
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.ts +84 -0
- package/src/Shared/VisionCameraPlugins/Cropper/index.ts +78 -0
- package/src/Shared/VisionCameraPlugins/FaceDetector/Camera.tsx +63 -0
- package/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.ts +44 -0
- package/src/Shared/VisionCameraPlugins/FaceDetector/index.ts +3 -0
- package/src/Shared/VisionCameraPlugins/FaceDetector/types.ts +99 -0
- package/src/Shared/VisionCameraPlugins/TextRecognition/Camera.tsx +76 -0
- package/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.ts +18 -0
- package/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.ts +7 -0
- package/src/Shared/VisionCameraPlugins/TextRecognition/index.ts +7 -0
- package/src/Shared/VisionCameraPlugins/TextRecognition/scanText.ts +27 -0
- package/src/Shared/VisionCameraPlugins/TextRecognition/translateText.ts +21 -0
- package/src/Shared/VisionCameraPlugins/TextRecognition/types.ts +141 -0
- package/src/Translation/Resources/en.ts +151 -0
- package/src/Translation/Resources/index.ts +2 -0
- package/src/Translation/Resources/tr.ts +152 -0
- package/src/Translation/index.ts +37 -0
- package/src/Trustchex.tsx +171 -0
- package/src/index.tsx +5 -0
|
@@ -0,0 +1,1377 @@
|
|
|
1
|
+
/* eslint-disable react-native/no-inline-styles */
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
View,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Text as TextView,
|
|
7
|
+
Platform,
|
|
8
|
+
Vibration,
|
|
9
|
+
TouchableOpacity,
|
|
10
|
+
type GestureResponderEvent,
|
|
11
|
+
Text,
|
|
12
|
+
Linking,
|
|
13
|
+
Image,
|
|
14
|
+
} from 'react-native';
|
|
15
|
+
import {
|
|
16
|
+
Camera,
|
|
17
|
+
type Frame,
|
|
18
|
+
runAsync,
|
|
19
|
+
runAtTargetFps,
|
|
20
|
+
useCameraDevice,
|
|
21
|
+
useCameraFormat,
|
|
22
|
+
useCameraPermission,
|
|
23
|
+
useFrameProcessor,
|
|
24
|
+
} from 'react-native-vision-camera';
|
|
25
|
+
import { useRunOnJS, useSharedValue } from 'react-native-worklets-core';
|
|
26
|
+
import { useTextRecognition } from '../VisionCameraPlugins/TextRecognition';
|
|
27
|
+
import type { FieldRecords } from 'mrz';
|
|
28
|
+
import {
|
|
29
|
+
type Face,
|
|
30
|
+
useFaceDetector,
|
|
31
|
+
} from '../VisionCameraPlugins/FaceDetector';
|
|
32
|
+
import mrzUtils from '../Libs/mrz.utils';
|
|
33
|
+
import { crop, type CropResult } from '../VisionCameraPlugins/Cropper';
|
|
34
|
+
import { useKeepAwake } from '../Libs/native-keep-awake.utils';
|
|
35
|
+
import ImageEditor from '@react-native-community/image-editor';
|
|
36
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
37
|
+
import {
|
|
38
|
+
AdaptiveThresholdTypes,
|
|
39
|
+
ColorConversionCodes,
|
|
40
|
+
DataTypes,
|
|
41
|
+
type Mat,
|
|
42
|
+
ObjectType,
|
|
43
|
+
OpenCV,
|
|
44
|
+
ThresholdTypes,
|
|
45
|
+
} from 'react-native-fast-opencv';
|
|
46
|
+
import { getAverageBrightness } from '../Libs/camera.utils';
|
|
47
|
+
import { useTranslation } from 'react-i18next';
|
|
48
|
+
import LottieView from 'lottie-react-native';
|
|
49
|
+
import { ActivityIndicator, Button } from 'react-native-paper';
|
|
50
|
+
import { type Barcode, scanCodes } from '../VisionCameraPlugins/BarcodeScanner';
|
|
51
|
+
import { speakWithDebounce } from '../Libs/tts.utils';
|
|
52
|
+
import AppContext from '../Contexts/AppContext';
|
|
53
|
+
|
|
54
|
+
export type DocumentScannedData = {
|
|
55
|
+
documentType: 'ID_FRONT' | 'ID_BACK' | 'PASSPORT' | 'UNKNOWN';
|
|
56
|
+
image: string;
|
|
57
|
+
faceImage?: string;
|
|
58
|
+
secondaryFaceImage?: string;
|
|
59
|
+
hologramImage?: string;
|
|
60
|
+
barcodeValue?: string;
|
|
61
|
+
mrzText?: string;
|
|
62
|
+
mrzFields?: FieldRecords;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type BlockText = {
|
|
66
|
+
blocks: BlocksData[];
|
|
67
|
+
resultText: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type BlocksData = {
|
|
71
|
+
blockFrame: FrameType;
|
|
72
|
+
blockCornerPoints: CornerPointsType;
|
|
73
|
+
lines: LinesData;
|
|
74
|
+
blockLanguages: string[] | [];
|
|
75
|
+
blockText: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type CornerPointsType = [{ x: number; y: number }];
|
|
79
|
+
|
|
80
|
+
type FrameType = {
|
|
81
|
+
boundingCenterX: number;
|
|
82
|
+
boundingCenterY: number;
|
|
83
|
+
height: number;
|
|
84
|
+
width: number;
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type LinesData = [
|
|
90
|
+
lineCornerPoints: CornerPointsType,
|
|
91
|
+
elements: ElementsData,
|
|
92
|
+
lineFrame: FrameType,
|
|
93
|
+
lineLanguages: string[] | [],
|
|
94
|
+
lineText: string,
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
type ElementsData = [
|
|
98
|
+
elementCornerPoints: CornerPointsType,
|
|
99
|
+
elementFrame: FrameType,
|
|
100
|
+
elementText: string,
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
export type PhotoOptions = {
|
|
104
|
+
uri: string;
|
|
105
|
+
orientation?:
|
|
106
|
+
| 'landscapeRight'
|
|
107
|
+
| 'portrait'
|
|
108
|
+
| 'portraitUpsideDown'
|
|
109
|
+
| 'landscapeLeft';
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export interface IdentityDocumentCameraProps {
|
|
113
|
+
onlyMRZScan: boolean;
|
|
114
|
+
onIdentityDocumentScanned: (scannedData: DocumentScannedData) => void;
|
|
115
|
+
showDebugImages?: boolean; // For development: show detected face and other images
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// const windowWidth = Dimensions.get('window').width;
|
|
119
|
+
// const windowHeight = Dimensions.get('window').height;
|
|
120
|
+
|
|
121
|
+
const HOLOGRAM_IMAGE_COUNT = 7;
|
|
122
|
+
const HOLOGRAM_DETECTION_THRESHOLD = 3500;
|
|
123
|
+
const HOLOGRAM_DETECTION_RETRY_COUNT = 3;
|
|
124
|
+
const SECOND_FACE_DETECTION_RETRY_COUNT = 10;
|
|
125
|
+
const MRZ_VALIDATION_RETRY_COUNT = 3;
|
|
126
|
+
|
|
127
|
+
let faceImages: string[] = [];
|
|
128
|
+
|
|
129
|
+
const IdentityDocumentCamera = ({
|
|
130
|
+
onlyMRZScan,
|
|
131
|
+
onIdentityDocumentScanned,
|
|
132
|
+
showDebugImages = false,
|
|
133
|
+
}: IdentityDocumentCameraProps) => {
|
|
134
|
+
useKeepAwake();
|
|
135
|
+
const appContext = React.useContext(AppContext);
|
|
136
|
+
const cameraRef = React.useRef<Camera>(null);
|
|
137
|
+
const cameraPermission = useCameraPermission();
|
|
138
|
+
const [permissionsRequested, setPermissionsRequested] = React.useState(false);
|
|
139
|
+
const [isActive, setIsActive] = React.useState(false);
|
|
140
|
+
const isFocused = useIsFocused();
|
|
141
|
+
const [isTorchOn, setIsTorchOn] = React.useState(false);
|
|
142
|
+
const exposureValue = useSharedValue(0);
|
|
143
|
+
const [exposure, setExposure] = React.useState(0);
|
|
144
|
+
const device = useCameraDevice('back', {
|
|
145
|
+
physicalDevices: ['wide-angle-camera'],
|
|
146
|
+
});
|
|
147
|
+
const format = useCameraFormat(device, [
|
|
148
|
+
{
|
|
149
|
+
videoResolution: {
|
|
150
|
+
width: 1920,
|
|
151
|
+
height: 1080,
|
|
152
|
+
},
|
|
153
|
+
iso: 'max',
|
|
154
|
+
photoHdr: false,
|
|
155
|
+
videoHdr: false,
|
|
156
|
+
videoStabilizationMode: 'standard',
|
|
157
|
+
autoFocusSystem: 'phase-detection',
|
|
158
|
+
},
|
|
159
|
+
]);
|
|
160
|
+
const isCameraInitialized = useSharedValue(false);
|
|
161
|
+
const [currentFaceImage, setCurrentFaceImage] = useState<string | undefined>(
|
|
162
|
+
undefined
|
|
163
|
+
);
|
|
164
|
+
const [_currentHologramMaskImage, setCurrentHologramMaskImage] = useState<
|
|
165
|
+
string | undefined
|
|
166
|
+
>(undefined);
|
|
167
|
+
const [currentHologramImage, setCurrentHologramImage] = useState<
|
|
168
|
+
string | undefined
|
|
169
|
+
>(undefined);
|
|
170
|
+
const [currentSecondaryFaceImage, setCurrentSecondaryFaceImage] = useState<
|
|
171
|
+
string | undefined
|
|
172
|
+
>(undefined);
|
|
173
|
+
const [isBrightnessLow, setIsBrightnessLow] = useState(false);
|
|
174
|
+
const [hasGuideShown, setHasGuideShown] = useState(false);
|
|
175
|
+
const [status, setStatus] = useState<
|
|
176
|
+
'SEARCHING' | 'SCANNING' | 'SCANNED' | 'INCORRECT'
|
|
177
|
+
>('SEARCHING');
|
|
178
|
+
const [nextStep, setNextStep] = useState<
|
|
179
|
+
'SCAN_ID_FRONT_OR_PASSPORT' | 'SCAN_ID_BACK' | 'SCAN_HOLOGRAM' | 'COMPLETED'
|
|
180
|
+
>('SCAN_ID_FRONT_OR_PASSPORT');
|
|
181
|
+
const hologramDetectionCurrentRetryCount = useSharedValue(0);
|
|
182
|
+
const secondaryFaceDetectionCurrentRetryCount = useSharedValue(0);
|
|
183
|
+
const mrzDetectionCurrentRetryCount = useSharedValue(0);
|
|
184
|
+
const faceDetectionErrorCount = useSharedValue(0);
|
|
185
|
+
const [faceDetectionEnabled, setFaceDetectionEnabled] = useState(true);
|
|
186
|
+
const { t } = useTranslation();
|
|
187
|
+
// const [boundingBox, setBoundingBox] = useState<Bounds>({
|
|
188
|
+
// x: 0,
|
|
189
|
+
// y: 0,
|
|
190
|
+
// width: 0,
|
|
191
|
+
// height: 0,
|
|
192
|
+
// });
|
|
193
|
+
|
|
194
|
+
const { scanText } = useTextRecognition({
|
|
195
|
+
language: 'latin',
|
|
196
|
+
});
|
|
197
|
+
const { detectFaces } = useFaceDetector({
|
|
198
|
+
contourMode: 'none',
|
|
199
|
+
landmarkMode: 'none',
|
|
200
|
+
classificationMode: 'all',
|
|
201
|
+
performanceMode: 'accurate',
|
|
202
|
+
trackingEnabled: false,
|
|
203
|
+
minFaceSize: 0.1,
|
|
204
|
+
autoScale: false,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
const requestPermissions = async () => {
|
|
209
|
+
if (!cameraPermission.hasPermission) {
|
|
210
|
+
await cameraPermission.requestPermission();
|
|
211
|
+
}
|
|
212
|
+
setPermissionsRequested(true);
|
|
213
|
+
};
|
|
214
|
+
requestPermissions();
|
|
215
|
+
}, [cameraPermission]);
|
|
216
|
+
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
if (!!device && !!format && isFocused) {
|
|
219
|
+
setIsActive(true);
|
|
220
|
+
} else {
|
|
221
|
+
setIsActive(false);
|
|
222
|
+
// Clear any pending OpenCV operations when camera becomes inactive
|
|
223
|
+
try {
|
|
224
|
+
OpenCV.clearBuffers();
|
|
225
|
+
} catch (error) {
|
|
226
|
+
// Ignore cleanup errors
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Reset face images array to free memory
|
|
230
|
+
faceImages = [];
|
|
231
|
+
|
|
232
|
+
// Reset retry counters
|
|
233
|
+
hologramDetectionCurrentRetryCount.value = 0;
|
|
234
|
+
secondaryFaceDetectionCurrentRetryCount.value = 0;
|
|
235
|
+
mrzDetectionCurrentRetryCount.value = 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return () => {
|
|
239
|
+
setIsActive(false);
|
|
240
|
+
// Cleanup on unmount
|
|
241
|
+
try {
|
|
242
|
+
OpenCV.clearBuffers();
|
|
243
|
+
} catch (error) {
|
|
244
|
+
// Ignore cleanup errors
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Clear face images array
|
|
248
|
+
faceImages = [];
|
|
249
|
+
};
|
|
250
|
+
}, [
|
|
251
|
+
device,
|
|
252
|
+
format,
|
|
253
|
+
isFocused,
|
|
254
|
+
hologramDetectionCurrentRetryCount,
|
|
255
|
+
secondaryFaceDetectionCurrentRetryCount,
|
|
256
|
+
mrzDetectionCurrentRetryCount,
|
|
257
|
+
faceDetectionErrorCount,
|
|
258
|
+
]);
|
|
259
|
+
|
|
260
|
+
useEffect(() => {
|
|
261
|
+
if (hasGuideShown) {
|
|
262
|
+
const message = isBrightnessLow
|
|
263
|
+
? t('identityDocumentCamera.lowBrightness')
|
|
264
|
+
: nextStep === 'SCAN_ID_FRONT_OR_PASSPORT'
|
|
265
|
+
? t('identityDocumentCamera.alignPhotoSide')
|
|
266
|
+
: nextStep === 'SCAN_HOLOGRAM'
|
|
267
|
+
? t('identityDocumentCamera.alignHologram')
|
|
268
|
+
: nextStep === 'SCAN_ID_BACK'
|
|
269
|
+
? t('identityDocumentCamera.alignIDBackSide')
|
|
270
|
+
: nextStep === 'COMPLETED'
|
|
271
|
+
? t('identityDocumentCamera.scanCompleted')
|
|
272
|
+
: '';
|
|
273
|
+
|
|
274
|
+
if (
|
|
275
|
+
appContext.currentWorkflowStep?.data?.voiceGuidanceActive &&
|
|
276
|
+
message
|
|
277
|
+
) {
|
|
278
|
+
speakWithDebounce(message);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}, [
|
|
282
|
+
appContext.currentWorkflowStep?.data?.voiceGuidanceActive,
|
|
283
|
+
hasGuideShown,
|
|
284
|
+
isBrightnessLow,
|
|
285
|
+
nextStep,
|
|
286
|
+
t,
|
|
287
|
+
]);
|
|
288
|
+
|
|
289
|
+
const detectDocumentType = (
|
|
290
|
+
faces: Face[],
|
|
291
|
+
ocrText: string,
|
|
292
|
+
mrzFields?: FieldRecords
|
|
293
|
+
) => {
|
|
294
|
+
if (
|
|
295
|
+
faces.length > 0 &&
|
|
296
|
+
!mrzFields &&
|
|
297
|
+
ocrText?.includes('Signature')
|
|
298
|
+
// ocrText?.includes('Surname') &&
|
|
299
|
+
// ocrText?.includes('Given Name(s)') &&
|
|
300
|
+
// ocrText?.includes('Date of Birth') &&
|
|
301
|
+
// ocrText?.includes('Document No') &&
|
|
302
|
+
// ocrText?.includes('Valid Until')
|
|
303
|
+
) {
|
|
304
|
+
return 'ID_FRONT';
|
|
305
|
+
} else if (
|
|
306
|
+
faces.length === 0 &&
|
|
307
|
+
mrzFields?.documentCode === 'I'
|
|
308
|
+
// ocrText?.includes("Father's Name") &&
|
|
309
|
+
// ocrText?.includes("Mother's Name") &&
|
|
310
|
+
// ocrText?.includes('Issued By')
|
|
311
|
+
) {
|
|
312
|
+
return 'ID_BACK';
|
|
313
|
+
} else if (faces.length > 0 && mrzFields?.documentCode === 'P') {
|
|
314
|
+
return 'PASSPORT';
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return 'UNKNOWN';
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// const setBoundingBoxInJS = useRunOnJS(
|
|
321
|
+
// (bounds: Bounds) => {
|
|
322
|
+
// setBoundingBox(bounds);
|
|
323
|
+
// },
|
|
324
|
+
// [setBoundingBox],
|
|
325
|
+
// );
|
|
326
|
+
|
|
327
|
+
// const isBlockInFrame = (block: BlocksData) => {
|
|
328
|
+
// 'worklet';
|
|
329
|
+
// const scanningFrame = {
|
|
330
|
+
// x: 0.03 * 1080,
|
|
331
|
+
// y: 0.35 * 1920,
|
|
332
|
+
// width: 0.94 * 1080,
|
|
333
|
+
// height: 0.3 * 1920,
|
|
334
|
+
// } as Bounds;
|
|
335
|
+
// const bounds = {
|
|
336
|
+
// x: block.blockFrame.x,
|
|
337
|
+
// y: block.blockFrame.y,
|
|
338
|
+
// width: block.blockFrame.width,
|
|
339
|
+
// height: block.blockFrame.height,
|
|
340
|
+
// } as Bounds;
|
|
341
|
+
|
|
342
|
+
// if (
|
|
343
|
+
// bounds.x >= scanningFrame.x &&
|
|
344
|
+
// bounds.y >= scanningFrame.y &&
|
|
345
|
+
// bounds.x + bounds.width <= scanningFrame.x + scanningFrame.width &&
|
|
346
|
+
// bounds.y + bounds.height <= scanningFrame.y + scanningFrame.height
|
|
347
|
+
// ) {
|
|
348
|
+
// return true;
|
|
349
|
+
// }
|
|
350
|
+
|
|
351
|
+
// setBoundingBoxInJS({
|
|
352
|
+
// x: (bounds.x / 1080) * windowWidth,
|
|
353
|
+
// y: (bounds.y / 1920) * windowHeight,
|
|
354
|
+
// width: (bounds.width / 1080) * windowWidth,
|
|
355
|
+
// height: (bounds.height / 1920) * windowHeight,
|
|
356
|
+
// });
|
|
357
|
+
|
|
358
|
+
// return false;
|
|
359
|
+
// };
|
|
360
|
+
|
|
361
|
+
const applyThreshold = (image: Mat) => {
|
|
362
|
+
const gray = OpenCV.createObject(ObjectType.Mat, 0, 0, DataTypes.CV_8U);
|
|
363
|
+
|
|
364
|
+
// Convert to grayscale
|
|
365
|
+
OpenCV.invoke('cvtColor', image, gray, ColorConversionCodes.COLOR_RGB2GRAY);
|
|
366
|
+
|
|
367
|
+
// Apply GaussianBlur to reduce noise
|
|
368
|
+
const kSize = OpenCV.createObject(ObjectType.Size, 5, 5);
|
|
369
|
+
OpenCV.invoke('GaussianBlur', gray, gray, kSize, 0);
|
|
370
|
+
|
|
371
|
+
// Apply Otsu's thresholding
|
|
372
|
+
OpenCV.invoke(
|
|
373
|
+
'threshold',
|
|
374
|
+
gray,
|
|
375
|
+
gray,
|
|
376
|
+
0,
|
|
377
|
+
255,
|
|
378
|
+
ThresholdTypes.THRESH_BINARY + ThresholdTypes.THRESH_OTSU
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
return gray;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
const areImagesSimilar = (
|
|
385
|
+
image1: string,
|
|
386
|
+
image2: string,
|
|
387
|
+
threshold = 15000
|
|
388
|
+
) => {
|
|
389
|
+
try {
|
|
390
|
+
if (!image1 || !image2) {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
const mat1 = OpenCV.base64ToMat(image1);
|
|
394
|
+
const mat2 = OpenCV.base64ToMat(image2);
|
|
395
|
+
const diff = OpenCV.createObject(ObjectType.Mat, 0, 0, DataTypes.CV_8U);
|
|
396
|
+
OpenCV.invoke(
|
|
397
|
+
'absdiff',
|
|
398
|
+
applyThreshold(mat1),
|
|
399
|
+
applyThreshold(mat2),
|
|
400
|
+
diff
|
|
401
|
+
);
|
|
402
|
+
const count = OpenCV.invoke('countNonZero', diff);
|
|
403
|
+
|
|
404
|
+
return count.value < threshold;
|
|
405
|
+
} catch (error) {
|
|
406
|
+
// console.log('Error while comparing images:', error);
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
const detectHologram = (images: string[]) => {
|
|
412
|
+
try {
|
|
413
|
+
const lowerBound = OpenCV.createObject(ObjectType.Scalar, 40, 90, 90);
|
|
414
|
+
const upperBound = OpenCV.createObject(ObjectType.Scalar, 179, 255, 255);
|
|
415
|
+
const diffs = [];
|
|
416
|
+
const hologram = OpenCV.base64ToMat(images[0]);
|
|
417
|
+
for (let i = 0; i < images.length - 1; i++) {
|
|
418
|
+
const mat1 = OpenCV.base64ToMat(images[i]);
|
|
419
|
+
const mat2 = OpenCV.base64ToMat(images[i + 1]);
|
|
420
|
+
let diff = OpenCV.createObject(ObjectType.Mat, 0, 0, DataTypes.CV_8U);
|
|
421
|
+
OpenCV.invoke('absdiff', mat1, mat2, diff);
|
|
422
|
+
OpenCV.invoke(
|
|
423
|
+
'cvtColor',
|
|
424
|
+
diff,
|
|
425
|
+
diff,
|
|
426
|
+
ColorConversionCodes.COLOR_RGB2HSV
|
|
427
|
+
);
|
|
428
|
+
OpenCV.invoke('inRange', diff, lowerBound, upperBound, diff);
|
|
429
|
+
if (OpenCV.invoke('countNonZero', diff).value > 500) {
|
|
430
|
+
OpenCV.invoke('addWeighted', hologram, 0.5, mat2, 0.5, 0, hologram);
|
|
431
|
+
diffs.push(diff);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const hologramMask = diffs[0];
|
|
436
|
+
for (let i = 1; i < diffs.length; i++) {
|
|
437
|
+
OpenCV.invoke(
|
|
438
|
+
'addWeighted',
|
|
439
|
+
hologramMask,
|
|
440
|
+
0.5,
|
|
441
|
+
diffs[i],
|
|
442
|
+
0.5,
|
|
443
|
+
0,
|
|
444
|
+
hologramMask
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
OpenCV.invoke(
|
|
448
|
+
'adaptiveThreshold',
|
|
449
|
+
hologramMask,
|
|
450
|
+
hologramMask,
|
|
451
|
+
255,
|
|
452
|
+
AdaptiveThresholdTypes.ADAPTIVE_THRESH_GAUSSIAN_C,
|
|
453
|
+
ThresholdTypes.THRESH_BINARY_INV,
|
|
454
|
+
21,
|
|
455
|
+
2
|
|
456
|
+
);
|
|
457
|
+
const count = OpenCV.invoke('countNonZero', hologramMask);
|
|
458
|
+
if (count.value > HOLOGRAM_DETECTION_THRESHOLD) {
|
|
459
|
+
const hologramMaskJs = OpenCV.toJSValue(hologramMask);
|
|
460
|
+
const hologramJs = OpenCV.toJSValue(hologram);
|
|
461
|
+
return [hologramMaskJs.base64, hologramJs.base64];
|
|
462
|
+
}
|
|
463
|
+
} catch (error) {
|
|
464
|
+
// console.log('Error while detecting hologram:', error);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return [];
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
const getFaceImagesOrderedByLocation = (faces: Face[]) => {
|
|
471
|
+
return faces.sort((a, b) => {
|
|
472
|
+
if (a.bounds.x < b.bounds.x) {
|
|
473
|
+
return -1;
|
|
474
|
+
} else if (a.bounds.x > b.bounds.x) {
|
|
475
|
+
return 1;
|
|
476
|
+
}
|
|
477
|
+
return 0;
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
const getFaceImages = async (
|
|
482
|
+
faces: Face[],
|
|
483
|
+
image: string,
|
|
484
|
+
width: number,
|
|
485
|
+
height: number
|
|
486
|
+
) => {
|
|
487
|
+
if (!faces.length || !image || width <= 0 || height <= 0) {
|
|
488
|
+
return [];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
const croppedFaces = [];
|
|
492
|
+
|
|
493
|
+
try {
|
|
494
|
+
for (const face of getFaceImagesOrderedByLocation(faces)) {
|
|
495
|
+
const uri = `data:image/jpeg;base64,${image}`;
|
|
496
|
+
|
|
497
|
+
// Add validation for face bounds to prevent invalid crop operations
|
|
498
|
+
if (
|
|
499
|
+
face.bounds.x < 0 ||
|
|
500
|
+
face.bounds.y < 0 ||
|
|
501
|
+
face.bounds.width <= 0 ||
|
|
502
|
+
face.bounds.height <= 0 ||
|
|
503
|
+
face.bounds.x >= width ||
|
|
504
|
+
face.bounds.y >= height
|
|
505
|
+
) {
|
|
506
|
+
console.warn(
|
|
507
|
+
'Invalid face bounds detected, skipping face:',
|
|
508
|
+
face.bounds
|
|
509
|
+
);
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// Calculate crop area with bounds checking
|
|
514
|
+
const expandedWidth = face.bounds.width * 1.5;
|
|
515
|
+
const expandedHeight = face.bounds.height * 1.5;
|
|
516
|
+
const offsetX = Math.max(0, face.bounds.x - expandedWidth / 6);
|
|
517
|
+
const offsetY =
|
|
518
|
+
Platform.OS === 'ios'
|
|
519
|
+
? Math.max(0, face.bounds.y - expandedHeight / 6)
|
|
520
|
+
: Math.max(0, width - face.bounds.y - expandedHeight / 1.2);
|
|
521
|
+
|
|
522
|
+
const croppedFace = await ImageEditor.cropImage(uri, {
|
|
523
|
+
offset: {
|
|
524
|
+
x: offsetX,
|
|
525
|
+
y: offsetY,
|
|
526
|
+
},
|
|
527
|
+
size: {
|
|
528
|
+
width: expandedWidth,
|
|
529
|
+
height: expandedHeight,
|
|
530
|
+
},
|
|
531
|
+
displaySize: {
|
|
532
|
+
width: 240,
|
|
533
|
+
height: 320,
|
|
534
|
+
},
|
|
535
|
+
includeBase64: true,
|
|
536
|
+
quality: 1,
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
if (croppedFace.width !== 240 || croppedFace.height !== 320) {
|
|
540
|
+
try {
|
|
541
|
+
const croppedFaceMat = OpenCV.base64ToMat(croppedFace.base64);
|
|
542
|
+
|
|
543
|
+
// Ensure crop dimensions are valid for the matrix
|
|
544
|
+
const matCropWidth = Math.min(240, croppedFace.width);
|
|
545
|
+
const matCropHeight = Math.min(320, croppedFace.height);
|
|
546
|
+
|
|
547
|
+
// Only crop if we have valid dimensions
|
|
548
|
+
if (matCropWidth > 0 && matCropHeight > 0) {
|
|
549
|
+
OpenCV.invoke(
|
|
550
|
+
'crop',
|
|
551
|
+
croppedFaceMat,
|
|
552
|
+
croppedFaceMat,
|
|
553
|
+
OpenCV.createObject(
|
|
554
|
+
ObjectType.Rect,
|
|
555
|
+
0,
|
|
556
|
+
0,
|
|
557
|
+
matCropWidth,
|
|
558
|
+
matCropHeight
|
|
559
|
+
)
|
|
560
|
+
);
|
|
561
|
+
croppedFaces.push(OpenCV.toJSValue(croppedFaceMat).base64);
|
|
562
|
+
} else {
|
|
563
|
+
// Fallback to original base64 if crop dimensions are invalid
|
|
564
|
+
croppedFaces.push(croppedFace.base64);
|
|
565
|
+
}
|
|
566
|
+
} catch (cropError) {
|
|
567
|
+
console.warn('OpenCV crop operation failed:', cropError);
|
|
568
|
+
// Fallback to original image if OpenCV crop fails
|
|
569
|
+
croppedFaces.push(croppedFace.base64);
|
|
570
|
+
}
|
|
571
|
+
} else {
|
|
572
|
+
croppedFaces.push(croppedFace.base64);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
} catch (error) {
|
|
576
|
+
console.warn('Error while cropping face:', error);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
return croppedFaces;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
const setNextStepAndVibrate = (
|
|
583
|
+
nextStepType:
|
|
584
|
+
| 'SCAN_ID_FRONT_OR_PASSPORT'
|
|
585
|
+
| 'SCAN_ID_BACK'
|
|
586
|
+
| 'SCAN_HOLOGRAM'
|
|
587
|
+
| 'COMPLETED'
|
|
588
|
+
) => {
|
|
589
|
+
setNextStep(nextStepType);
|
|
590
|
+
Vibration.vibrate(100);
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
const handleBrightness = useRunOnJS(
|
|
594
|
+
(isBright: boolean) => {
|
|
595
|
+
setIsBrightnessLow(!isBright);
|
|
596
|
+
},
|
|
597
|
+
[setIsBrightnessLow]
|
|
598
|
+
);
|
|
599
|
+
|
|
600
|
+
const handleFaceAndText = useRunOnJS(
|
|
601
|
+
async (
|
|
602
|
+
text: string,
|
|
603
|
+
faces: Face[],
|
|
604
|
+
frameWidth: number,
|
|
605
|
+
frameHeight: number,
|
|
606
|
+
barcode?: Barcode,
|
|
607
|
+
image?: string
|
|
608
|
+
) => {
|
|
609
|
+
if (
|
|
610
|
+
device?.hasTorch &&
|
|
611
|
+
isTorchOn &&
|
|
612
|
+
(currentHologramImage ||
|
|
613
|
+
hologramDetectionCurrentRetryCount.value >=
|
|
614
|
+
HOLOGRAM_DETECTION_RETRY_COUNT)
|
|
615
|
+
) {
|
|
616
|
+
setIsTorchOn(false);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
if (nextStep === 'COMPLETED') {
|
|
620
|
+
setStatus('SCANNED');
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (!text || text.length < 10 || !image) {
|
|
625
|
+
setStatus('SEARCHING');
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
const { mrzText, parsedResult: parsedMRZData } =
|
|
630
|
+
mrzUtils.getMRZData(text);
|
|
631
|
+
const croppedFaces = await getFaceImages(
|
|
632
|
+
faces,
|
|
633
|
+
image,
|
|
634
|
+
frameWidth,
|
|
635
|
+
frameHeight
|
|
636
|
+
);
|
|
637
|
+
const documentType = detectDocumentType(
|
|
638
|
+
faces,
|
|
639
|
+
text,
|
|
640
|
+
parsedMRZData?.fields
|
|
641
|
+
);
|
|
642
|
+
const scannedData: DocumentScannedData = {
|
|
643
|
+
image,
|
|
644
|
+
documentType,
|
|
645
|
+
mrzText: mrzText ?? undefined,
|
|
646
|
+
mrzFields: parsedMRZData?.fields,
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
scannedData.faceImage = croppedFaces[0];
|
|
650
|
+
setCurrentFaceImage(croppedFaces[0]);
|
|
651
|
+
|
|
652
|
+
if (!onlyMRZScan) {
|
|
653
|
+
if (
|
|
654
|
+
(nextStep === 'SCAN_ID_FRONT_OR_PASSPORT' &&
|
|
655
|
+
!(documentType === 'ID_FRONT' || documentType === 'PASSPORT')) ||
|
|
656
|
+
(nextStep === 'SCAN_ID_BACK' && documentType !== 'ID_BACK')
|
|
657
|
+
) {
|
|
658
|
+
setStatus('INCORRECT');
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if (croppedFaces.length > 0 && croppedFaces[0]) {
|
|
663
|
+
if (currentFaceImage) {
|
|
664
|
+
scannedData.faceImage = currentFaceImage;
|
|
665
|
+
} else {
|
|
666
|
+
scannedData.faceImage = croppedFaces[0];
|
|
667
|
+
setCurrentFaceImage(croppedFaces[0]);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
if (currentHologramImage) {
|
|
671
|
+
scannedData.hologramImage = currentHologramImage;
|
|
672
|
+
} else if (faceImages.length <= HOLOGRAM_IMAGE_COUNT) {
|
|
673
|
+
if (device?.hasTorch) {
|
|
674
|
+
setIsTorchOn(true);
|
|
675
|
+
}
|
|
676
|
+
faceImages.push(croppedFaces[0]);
|
|
677
|
+
} else {
|
|
678
|
+
const [hologramMask, hologram] = detectHologram(faceImages);
|
|
679
|
+
if (
|
|
680
|
+
!!currentFaceImage &&
|
|
681
|
+
areImagesSimilar(currentFaceImage, hologram, 25000)
|
|
682
|
+
) {
|
|
683
|
+
setCurrentHologramMaskImage(hologramMask);
|
|
684
|
+
scannedData.hologramImage = hologram;
|
|
685
|
+
setCurrentHologramImage(hologram);
|
|
686
|
+
}
|
|
687
|
+
faceImages = [];
|
|
688
|
+
hologramDetectionCurrentRetryCount.value++;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (currentSecondaryFaceImage) {
|
|
692
|
+
scannedData.secondaryFaceImage = currentSecondaryFaceImage;
|
|
693
|
+
} else if (
|
|
694
|
+
!!scannedData.faceImage &&
|
|
695
|
+
croppedFaces.length > 1 &&
|
|
696
|
+
!!croppedFaces[1] &&
|
|
697
|
+
areImagesSimilar(scannedData.faceImage, croppedFaces[1])
|
|
698
|
+
) {
|
|
699
|
+
scannedData.secondaryFaceImage = croppedFaces[1];
|
|
700
|
+
setCurrentSecondaryFaceImage(scannedData.secondaryFaceImage);
|
|
701
|
+
} else {
|
|
702
|
+
secondaryFaceDetectionCurrentRetryCount.value++;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
if (documentType === 'ID_FRONT') {
|
|
708
|
+
if (nextStep === 'SCAN_ID_FRONT_OR_PASSPORT') {
|
|
709
|
+
setStatus('SCANNED');
|
|
710
|
+
if (onlyMRZScan) {
|
|
711
|
+
setNextStepAndVibrate('SCAN_ID_BACK');
|
|
712
|
+
onIdentityDocumentScanned(scannedData);
|
|
713
|
+
} else {
|
|
714
|
+
setNextStepAndVibrate('SCAN_HOLOGRAM');
|
|
715
|
+
}
|
|
716
|
+
} else if (
|
|
717
|
+
nextStep === 'SCAN_HOLOGRAM' &&
|
|
718
|
+
(!!scannedData.hologramImage ||
|
|
719
|
+
hologramDetectionCurrentRetryCount.value >=
|
|
720
|
+
HOLOGRAM_DETECTION_RETRY_COUNT) &&
|
|
721
|
+
(!!scannedData.secondaryFaceImage ||
|
|
722
|
+
secondaryFaceDetectionCurrentRetryCount.value >=
|
|
723
|
+
SECOND_FACE_DETECTION_RETRY_COUNT)
|
|
724
|
+
) {
|
|
725
|
+
setStatus('SCANNED');
|
|
726
|
+
setNextStepAndVibrate('SCAN_ID_BACK');
|
|
727
|
+
onIdentityDocumentScanned(scannedData);
|
|
728
|
+
}
|
|
729
|
+
} else if (documentType === 'PASSPORT') {
|
|
730
|
+
if (
|
|
731
|
+
nextStep === 'SCAN_ID_FRONT_OR_PASSPORT' &&
|
|
732
|
+
!scannedData.hologramImage
|
|
733
|
+
) {
|
|
734
|
+
setStatus('SCANNED');
|
|
735
|
+
if (onlyMRZScan) {
|
|
736
|
+
setNextStepAndVibrate('COMPLETED');
|
|
737
|
+
onIdentityDocumentScanned(scannedData);
|
|
738
|
+
} else {
|
|
739
|
+
setNextStepAndVibrate('SCAN_HOLOGRAM');
|
|
740
|
+
}
|
|
741
|
+
} else if (
|
|
742
|
+
((nextStep === 'SCAN_HOLOGRAM' &&
|
|
743
|
+
(!!scannedData.hologramImage ||
|
|
744
|
+
hologramDetectionCurrentRetryCount.value >=
|
|
745
|
+
HOLOGRAM_DETECTION_RETRY_COUNT) &&
|
|
746
|
+
(!!scannedData.secondaryFaceImage ||
|
|
747
|
+
secondaryFaceDetectionCurrentRetryCount.value >=
|
|
748
|
+
SECOND_FACE_DETECTION_RETRY_COUNT)) ||
|
|
749
|
+
onlyMRZScan) &&
|
|
750
|
+
!!scannedData.mrzText &&
|
|
751
|
+
(parsedMRZData?.valid ||
|
|
752
|
+
mrzDetectionCurrentRetryCount.value >= MRZ_VALIDATION_RETRY_COUNT)
|
|
753
|
+
) {
|
|
754
|
+
setStatus('SCANNED');
|
|
755
|
+
setNextStepAndVibrate('COMPLETED');
|
|
756
|
+
onIdentityDocumentScanned(scannedData);
|
|
757
|
+
} else if (!parsedMRZData?.valid) {
|
|
758
|
+
mrzDetectionCurrentRetryCount.value++;
|
|
759
|
+
}
|
|
760
|
+
} else if (documentType === 'ID_BACK') {
|
|
761
|
+
if (
|
|
762
|
+
((parsedMRZData?.fields?.issuingState === 'TUR' &&
|
|
763
|
+
barcode?.value?.trim() ===
|
|
764
|
+
parsedMRZData?.fields?.optional1?.trim()) ||
|
|
765
|
+
parsedMRZData?.fields?.issuingState !== 'TUR' ||
|
|
766
|
+
onlyMRZScan) &&
|
|
767
|
+
nextStep === 'SCAN_ID_BACK' &&
|
|
768
|
+
!!scannedData.mrzText &&
|
|
769
|
+
(parsedMRZData?.valid ||
|
|
770
|
+
mrzDetectionCurrentRetryCount.value >= MRZ_VALIDATION_RETRY_COUNT)
|
|
771
|
+
) {
|
|
772
|
+
scannedData.barcodeValue = barcode?.value ?? undefined;
|
|
773
|
+
setStatus('SCANNED');
|
|
774
|
+
setNextStepAndVibrate('COMPLETED');
|
|
775
|
+
onIdentityDocumentScanned(scannedData);
|
|
776
|
+
} else if (!parsedMRZData?.valid) {
|
|
777
|
+
mrzDetectionCurrentRetryCount.value++;
|
|
778
|
+
}
|
|
779
|
+
} else {
|
|
780
|
+
setStatus('SCANNING');
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// Clear OpenCV buffers to prevent memory leaks
|
|
784
|
+
try {
|
|
785
|
+
OpenCV.clearBuffers();
|
|
786
|
+
} catch (bufferError) {
|
|
787
|
+
// Ignore buffer cleanup errors
|
|
788
|
+
console.warn('Buffer cleanup error:', bufferError);
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
[
|
|
792
|
+
currentFaceImage,
|
|
793
|
+
currentHologramImage,
|
|
794
|
+
currentSecondaryFaceImage,
|
|
795
|
+
device,
|
|
796
|
+
nextStep,
|
|
797
|
+
onlyMRZScan,
|
|
798
|
+
]
|
|
799
|
+
);
|
|
800
|
+
|
|
801
|
+
const handleExposureValue = useRunOnJS(
|
|
802
|
+
(value: number) => {
|
|
803
|
+
setExposure(value);
|
|
804
|
+
},
|
|
805
|
+
[exposure]
|
|
806
|
+
);
|
|
807
|
+
|
|
808
|
+
const handleExposureAndBrightness = (frame: Frame) => {
|
|
809
|
+
'worklet';
|
|
810
|
+
const averageBrightness = getAverageBrightness(frame);
|
|
811
|
+
const minExposure = device?.minExposure ?? 0;
|
|
812
|
+
const maxExposure = device?.maxExposure ?? 0;
|
|
813
|
+
const lowerBrightnessBound = 40;
|
|
814
|
+
const upperBrightnessBound = 120;
|
|
815
|
+
|
|
816
|
+
if (
|
|
817
|
+
averageBrightness < lowerBrightnessBound &&
|
|
818
|
+
exposureValue.value < maxExposure
|
|
819
|
+
) {
|
|
820
|
+
exposureValue.value = exposureValue.value + 1;
|
|
821
|
+
} else if (
|
|
822
|
+
averageBrightness > upperBrightnessBound &&
|
|
823
|
+
exposureValue.value > minExposure
|
|
824
|
+
) {
|
|
825
|
+
exposureValue.value = exposureValue.value - 1;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const isBright = averageBrightness > lowerBrightnessBound;
|
|
829
|
+
handleExposureValue(exposureValue.value);
|
|
830
|
+
handleBrightness(isBright);
|
|
831
|
+
|
|
832
|
+
return isBright;
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
const handleWorklet = (frame: Frame) => {
|
|
836
|
+
'worklet';
|
|
837
|
+
try {
|
|
838
|
+
const isBright = handleExposureAndBrightness(frame);
|
|
839
|
+
if (!isBright) {
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// Validate frame dimensions before processing
|
|
844
|
+
if (
|
|
845
|
+
!frame.width ||
|
|
846
|
+
!frame.height ||
|
|
847
|
+
frame.width <= 0 ||
|
|
848
|
+
frame.height <= 0
|
|
849
|
+
) {
|
|
850
|
+
console.warn('Invalid frame dimensions:', {
|
|
851
|
+
width: frame.width,
|
|
852
|
+
height: frame.height,
|
|
853
|
+
});
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// Detect faces first with error handling
|
|
858
|
+
let detectedFaces: Face[] = [];
|
|
859
|
+
try {
|
|
860
|
+
if (faceDetectionEnabled) {
|
|
861
|
+
detectedFaces = detectFaces(frame);
|
|
862
|
+
// Reset error count on successful detection
|
|
863
|
+
faceDetectionErrorCount.value = 0;
|
|
864
|
+
}
|
|
865
|
+
} catch (faceError) {
|
|
866
|
+
console.warn('Face detection failed:', faceError);
|
|
867
|
+
faceDetectionErrorCount.value += 1;
|
|
868
|
+
|
|
869
|
+
// Disable face detection temporarily after 5 consecutive errors
|
|
870
|
+
if (faceDetectionErrorCount.value >= 5) {
|
|
871
|
+
setFaceDetectionEnabled(false);
|
|
872
|
+
// Re-enable after 10 seconds
|
|
873
|
+
setTimeout(() => {
|
|
874
|
+
setFaceDetectionEnabled(true);
|
|
875
|
+
faceDetectionErrorCount.value = 0;
|
|
876
|
+
}, 10000);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
detectedFaces = []; // Continue without face detection
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// Create a copy of the frame for cropping to avoid buffer conflicts
|
|
883
|
+
let image: CropResult;
|
|
884
|
+
try {
|
|
885
|
+
image = crop(frame, {
|
|
886
|
+
cropRegion: {
|
|
887
|
+
top: 0,
|
|
888
|
+
left: 0,
|
|
889
|
+
width: 100,
|
|
890
|
+
height: 100,
|
|
891
|
+
},
|
|
892
|
+
includeImageBase64: true,
|
|
893
|
+
saveAsFile: false,
|
|
894
|
+
});
|
|
895
|
+
} catch (cropError) {
|
|
896
|
+
console.warn('Crop operation failed:', cropError);
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// Text recognition with error handling
|
|
901
|
+
let scannedText: BlockText;
|
|
902
|
+
try {
|
|
903
|
+
scannedText = scanText(frame) as any as BlockText;
|
|
904
|
+
} catch (textError) {
|
|
905
|
+
console.warn('Text recognition failed:', textError);
|
|
906
|
+
scannedText = { blocks: [], resultText: '' };
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// Barcode scanning with error handling
|
|
910
|
+
let barcodes: any[] = [];
|
|
911
|
+
try {
|
|
912
|
+
barcodes = scanCodes(frame, {
|
|
913
|
+
barcodeTypes: ['code-128', 'code-39', 'code-93', 'ean-13', 'qr'],
|
|
914
|
+
});
|
|
915
|
+
} catch (barcodeError) {
|
|
916
|
+
console.warn('Barcode scanning failed:', barcodeError);
|
|
917
|
+
barcodes = [];
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
handleFaceAndText(
|
|
921
|
+
scannedText.resultText ?? '',
|
|
922
|
+
detectedFaces,
|
|
923
|
+
frame.width,
|
|
924
|
+
frame.height,
|
|
925
|
+
barcodes.length ? barcodes[0] : undefined,
|
|
926
|
+
image?.base64
|
|
927
|
+
);
|
|
928
|
+
} catch (error) {
|
|
929
|
+
console.warn('Frame processing error:', error);
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
const frameProcessor = useFrameProcessor(
|
|
934
|
+
(frame) => {
|
|
935
|
+
'worklet';
|
|
936
|
+
|
|
937
|
+
if (!isCameraInitialized.value) {
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
if (Platform.OS === 'ios') {
|
|
942
|
+
// iOS: Run at target 6 FPS using runAtTargetFps
|
|
943
|
+
runAtTargetFps(6, () => {
|
|
944
|
+
'worklet';
|
|
945
|
+
try {
|
|
946
|
+
handleWorklet(frame);
|
|
947
|
+
} catch (error) {
|
|
948
|
+
console.warn('Frame processor error:', error);
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
} else {
|
|
952
|
+
// Android: Run async without throttling
|
|
953
|
+
try {
|
|
954
|
+
runAsync(frame, () => {
|
|
955
|
+
'worklet';
|
|
956
|
+
try {
|
|
957
|
+
handleWorklet(frame);
|
|
958
|
+
} catch (workletError) {
|
|
959
|
+
console.warn('Worklet execution error:', workletError);
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
} catch (error) {
|
|
963
|
+
console.warn('Frame processor error:', error);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
[handleFaceAndText, isCameraInitialized]
|
|
968
|
+
);
|
|
969
|
+
|
|
970
|
+
if (!permissionsRequested) {
|
|
971
|
+
return (
|
|
972
|
+
<View style={styles.permissionContainer}>
|
|
973
|
+
<ActivityIndicator size="large" />
|
|
974
|
+
</View>
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
if (!cameraPermission.hasPermission) {
|
|
979
|
+
return (
|
|
980
|
+
<View style={styles.permissionContainer}>
|
|
981
|
+
<Text style={styles.permissionText}>
|
|
982
|
+
{t('general.noCameraPermissionGiven')}
|
|
983
|
+
</Text>
|
|
984
|
+
<Button
|
|
985
|
+
mode="contained"
|
|
986
|
+
onPress={() => {
|
|
987
|
+
Linking.openSettings();
|
|
988
|
+
}}
|
|
989
|
+
>
|
|
990
|
+
{t('general.openSettings')}
|
|
991
|
+
</Button>
|
|
992
|
+
</View>
|
|
993
|
+
);
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
if (device == null) {
|
|
997
|
+
return (
|
|
998
|
+
<View style={styles.permissionContainer}>
|
|
999
|
+
<TextView style={styles.permissionText}>
|
|
1000
|
+
{t('general.noCameraDetected')}
|
|
1001
|
+
</TextView>
|
|
1002
|
+
</View>
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
const handleFocus = async (event: GestureResponderEvent) => {
|
|
1007
|
+
if (cameraRef.current && device.supportsFocus) {
|
|
1008
|
+
try {
|
|
1009
|
+
const { locationX, locationY } = event.nativeEvent;
|
|
1010
|
+
await cameraRef.current.focus({
|
|
1011
|
+
x: locationX,
|
|
1012
|
+
y: locationY,
|
|
1013
|
+
});
|
|
1014
|
+
} catch (error) {
|
|
1015
|
+
// console.log('Error while focusing:', error);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
return (
|
|
1021
|
+
<View style={StyleSheet.absoluteFill}>
|
|
1022
|
+
{!hasGuideShown ? (
|
|
1023
|
+
<View style={styles.guide}>
|
|
1024
|
+
<LottieView
|
|
1025
|
+
source={require('../../Shared/Animations/id-or-passport.json')}
|
|
1026
|
+
style={styles.guideAnimation}
|
|
1027
|
+
loop={true}
|
|
1028
|
+
autoPlay
|
|
1029
|
+
/>
|
|
1030
|
+
<TextView style={styles.guideHeader}>
|
|
1031
|
+
{t('identityDocumentCamera.guideHeader')}
|
|
1032
|
+
</TextView>
|
|
1033
|
+
<View style={styles.guidePoints}>
|
|
1034
|
+
<TextView style={styles.guideText}>
|
|
1035
|
+
{t('identityDocumentCamera.guideText')}
|
|
1036
|
+
</TextView>
|
|
1037
|
+
<TextView style={styles.guideText}>
|
|
1038
|
+
• {t('identityDocumentCamera.guidePoint1')}
|
|
1039
|
+
</TextView>
|
|
1040
|
+
<TextView style={styles.guideText}>
|
|
1041
|
+
• {t('identityDocumentCamera.guidePoint2')}
|
|
1042
|
+
</TextView>
|
|
1043
|
+
<TextView style={styles.guideText}>
|
|
1044
|
+
• {t('identityDocumentCamera.guidePoint3')}
|
|
1045
|
+
</TextView>
|
|
1046
|
+
</View>
|
|
1047
|
+
<Button
|
|
1048
|
+
mode="contained"
|
|
1049
|
+
onPress={() => {
|
|
1050
|
+
setHasGuideShown(true);
|
|
1051
|
+
}}
|
|
1052
|
+
>
|
|
1053
|
+
{t('general.letsGo')}
|
|
1054
|
+
</Button>
|
|
1055
|
+
</View>
|
|
1056
|
+
) : (
|
|
1057
|
+
<>
|
|
1058
|
+
<Camera
|
|
1059
|
+
ref={cameraRef}
|
|
1060
|
+
frameProcessor={frameProcessor}
|
|
1061
|
+
style={StyleSheet.absoluteFill}
|
|
1062
|
+
device={device}
|
|
1063
|
+
format={format}
|
|
1064
|
+
isActive={isActive}
|
|
1065
|
+
photo={false}
|
|
1066
|
+
video={false}
|
|
1067
|
+
audio={false}
|
|
1068
|
+
torch={isTorchOn ? 'on' : 'off'}
|
|
1069
|
+
fps={Math.max(format?.minFps ?? 0, 30)}
|
|
1070
|
+
exposure={exposure}
|
|
1071
|
+
onInitialized={() => {
|
|
1072
|
+
isCameraInitialized.value = true;
|
|
1073
|
+
}}
|
|
1074
|
+
/>
|
|
1075
|
+
<View style={styles.topZone}>
|
|
1076
|
+
<TextView style={styles.topZoneText}>
|
|
1077
|
+
{isBrightnessLow
|
|
1078
|
+
? t('identityDocumentCamera.lowBrightness')
|
|
1079
|
+
: nextStep === 'SCAN_ID_FRONT_OR_PASSPORT'
|
|
1080
|
+
? t('identityDocumentCamera.alignPhotoSide')
|
|
1081
|
+
: nextStep === 'SCAN_HOLOGRAM'
|
|
1082
|
+
? t('identityDocumentCamera.alignHologram')
|
|
1083
|
+
: nextStep === 'SCAN_ID_BACK'
|
|
1084
|
+
? t('identityDocumentCamera.alignIDBackSide')
|
|
1085
|
+
: nextStep === 'COMPLETED'
|
|
1086
|
+
? t('identityDocumentCamera.scanCompleted')
|
|
1087
|
+
: ''}
|
|
1088
|
+
</TextView>
|
|
1089
|
+
</View>
|
|
1090
|
+
<View style={styles.leftZone} />
|
|
1091
|
+
<View style={styles.rightZone} />
|
|
1092
|
+
<View style={styles.bottomZone}>
|
|
1093
|
+
{showDebugImages && currentFaceImage && (
|
|
1094
|
+
<View style={styles.imageContainer}>
|
|
1095
|
+
<Image
|
|
1096
|
+
source={{
|
|
1097
|
+
uri: `data:image/jpeg;base64,${currentFaceImage}`,
|
|
1098
|
+
}}
|
|
1099
|
+
style={styles.faceImage}
|
|
1100
|
+
/>
|
|
1101
|
+
<TextView style={styles.imageContainerText}>Face</TextView>
|
|
1102
|
+
</View>
|
|
1103
|
+
)}
|
|
1104
|
+
|
|
1105
|
+
{showDebugImages && currentSecondaryFaceImage && (
|
|
1106
|
+
<View style={styles.imageContainer}>
|
|
1107
|
+
<Image
|
|
1108
|
+
source={{
|
|
1109
|
+
uri: `data:image/jpeg;base64,${currentSecondaryFaceImage}`,
|
|
1110
|
+
}}
|
|
1111
|
+
style={styles.faceImage}
|
|
1112
|
+
/>
|
|
1113
|
+
<TextView style={styles.imageContainerText}>
|
|
1114
|
+
Secondary Face
|
|
1115
|
+
</TextView>
|
|
1116
|
+
</View>
|
|
1117
|
+
)}
|
|
1118
|
+
|
|
1119
|
+
{showDebugImages && _currentHologramMaskImage && (
|
|
1120
|
+
<View style={styles.imageContainer}>
|
|
1121
|
+
<Image
|
|
1122
|
+
source={{
|
|
1123
|
+
uri: `data:image/jpeg;base64,${_currentHologramMaskImage}`,
|
|
1124
|
+
}}
|
|
1125
|
+
style={styles.faceImage}
|
|
1126
|
+
/>
|
|
1127
|
+
<TextView style={styles.imageContainerText}>
|
|
1128
|
+
Hologram Mask
|
|
1129
|
+
</TextView>
|
|
1130
|
+
</View>
|
|
1131
|
+
)}
|
|
1132
|
+
|
|
1133
|
+
{showDebugImages && currentHologramImage && (
|
|
1134
|
+
<View style={styles.imageContainer}>
|
|
1135
|
+
<Image
|
|
1136
|
+
source={{
|
|
1137
|
+
uri: `data:image/jpeg;base64,${currentHologramImage}`,
|
|
1138
|
+
}}
|
|
1139
|
+
style={styles.faceImage}
|
|
1140
|
+
/>
|
|
1141
|
+
<TextView style={styles.imageContainerText}>Hologram</TextView>
|
|
1142
|
+
</View>
|
|
1143
|
+
)}
|
|
1144
|
+
|
|
1145
|
+
{showDebugImages && (
|
|
1146
|
+
<View style={styles.debugInfoContainer}>
|
|
1147
|
+
<TextView style={styles.debugInfoText}>
|
|
1148
|
+
Step: {nextStep}
|
|
1149
|
+
</TextView>
|
|
1150
|
+
<TextView style={styles.debugInfoText}>
|
|
1151
|
+
Status: {status}
|
|
1152
|
+
</TextView>
|
|
1153
|
+
<TextView style={styles.debugInfoText}>
|
|
1154
|
+
{`Face: ${currentFaceImage ? '✓' : '✗'} ${
|
|
1155
|
+
!faceDetectionEnabled ? '(DISABLED)' : ''
|
|
1156
|
+
}`}
|
|
1157
|
+
</TextView>
|
|
1158
|
+
<TextView style={styles.debugInfoText}>
|
|
1159
|
+
{`Hologram: ${currentHologramImage ? '✓' : '✗'} (${
|
|
1160
|
+
hologramDetectionCurrentRetryCount.value
|
|
1161
|
+
}/${HOLOGRAM_DETECTION_RETRY_COUNT})`}
|
|
1162
|
+
</TextView>
|
|
1163
|
+
<TextView style={styles.debugInfoText}>
|
|
1164
|
+
{`2nd Face: ${currentSecondaryFaceImage ? '✓' : '✗'} (${
|
|
1165
|
+
secondaryFaceDetectionCurrentRetryCount.value
|
|
1166
|
+
}/${SECOND_FACE_DETECTION_RETRY_COUNT})`}
|
|
1167
|
+
</TextView>
|
|
1168
|
+
</View>
|
|
1169
|
+
)}
|
|
1170
|
+
</View>
|
|
1171
|
+
<View
|
|
1172
|
+
style={[
|
|
1173
|
+
styles.scanArea,
|
|
1174
|
+
{
|
|
1175
|
+
borderColor:
|
|
1176
|
+
status === 'SCANNED' || nextStep === 'COMPLETED'
|
|
1177
|
+
? 'green'
|
|
1178
|
+
: status === 'INCORRECT'
|
|
1179
|
+
? 'red'
|
|
1180
|
+
: 'white',
|
|
1181
|
+
},
|
|
1182
|
+
]}
|
|
1183
|
+
>
|
|
1184
|
+
{nextStep === 'SCAN_HOLOGRAM' && isTorchOn && !isBrightnessLow && (
|
|
1185
|
+
<LottieView
|
|
1186
|
+
source={require('../../Shared/Animations/hologram-scan.json')}
|
|
1187
|
+
style={styles.animation}
|
|
1188
|
+
loop={true}
|
|
1189
|
+
autoPlay
|
|
1190
|
+
/>
|
|
1191
|
+
)}
|
|
1192
|
+
{nextStep !== 'COMPLETED' && isBrightnessLow && (
|
|
1193
|
+
<LottieView
|
|
1194
|
+
source={require('../../Shared/Animations/light.json')}
|
|
1195
|
+
style={styles.animation}
|
|
1196
|
+
loop={true}
|
|
1197
|
+
autoPlay
|
|
1198
|
+
/>
|
|
1199
|
+
)}
|
|
1200
|
+
{nextStep === 'COMPLETED' && (
|
|
1201
|
+
<LottieView
|
|
1202
|
+
source={require('../../Shared/Animations/success.json')}
|
|
1203
|
+
style={styles.animation}
|
|
1204
|
+
loop={false}
|
|
1205
|
+
autoPlay
|
|
1206
|
+
/>
|
|
1207
|
+
)}
|
|
1208
|
+
</View>
|
|
1209
|
+
{/* <View
|
|
1210
|
+
style={{
|
|
1211
|
+
borderColor: 'red',
|
|
1212
|
+
borderWidth: 1,
|
|
1213
|
+
position: 'absolute',
|
|
1214
|
+
top: boundingBox.y,
|
|
1215
|
+
left: boundingBox.x,
|
|
1216
|
+
width: boundingBox.width,
|
|
1217
|
+
height: boundingBox.height,
|
|
1218
|
+
zIndex: 3,
|
|
1219
|
+
}}
|
|
1220
|
+
/> */}
|
|
1221
|
+
<TouchableOpacity onPress={handleFocus} style={styles.focusArea} />
|
|
1222
|
+
</>
|
|
1223
|
+
)}
|
|
1224
|
+
</View>
|
|
1225
|
+
);
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
const styles = StyleSheet.create({
|
|
1229
|
+
container: {
|
|
1230
|
+
flex: 1,
|
|
1231
|
+
},
|
|
1232
|
+
permissionContainer: {
|
|
1233
|
+
flex: 1,
|
|
1234
|
+
justifyContent: 'center',
|
|
1235
|
+
alignItems: 'center',
|
|
1236
|
+
gap: 20,
|
|
1237
|
+
padding: 20,
|
|
1238
|
+
},
|
|
1239
|
+
permissionText: {
|
|
1240
|
+
color: 'black',
|
|
1241
|
+
fontSize: 20,
|
|
1242
|
+
textAlign: 'center',
|
|
1243
|
+
fontWeight: 'bold',
|
|
1244
|
+
},
|
|
1245
|
+
scanArea: {
|
|
1246
|
+
position: 'absolute',
|
|
1247
|
+
top: '36%',
|
|
1248
|
+
left: '5%',
|
|
1249
|
+
right: '5%',
|
|
1250
|
+
bottom: '36%',
|
|
1251
|
+
borderWidth: 5,
|
|
1252
|
+
zIndex: 1,
|
|
1253
|
+
display: 'flex',
|
|
1254
|
+
justifyContent: 'center',
|
|
1255
|
+
alignItems: 'center',
|
|
1256
|
+
paddingHorizontal: 5,
|
|
1257
|
+
},
|
|
1258
|
+
focusArea: {
|
|
1259
|
+
position: 'absolute',
|
|
1260
|
+
top: 0,
|
|
1261
|
+
left: 0,
|
|
1262
|
+
width: '100%',
|
|
1263
|
+
height: '100%',
|
|
1264
|
+
zIndex: 2,
|
|
1265
|
+
},
|
|
1266
|
+
animation: {
|
|
1267
|
+
width: '100%',
|
|
1268
|
+
height: '100%',
|
|
1269
|
+
opacity: 0.8,
|
|
1270
|
+
},
|
|
1271
|
+
topZone: {
|
|
1272
|
+
position: 'absolute',
|
|
1273
|
+
top: 0,
|
|
1274
|
+
left: 0,
|
|
1275
|
+
right: 0,
|
|
1276
|
+
bottom: '64%',
|
|
1277
|
+
backgroundColor: '#00000099',
|
|
1278
|
+
justifyContent: 'flex-end',
|
|
1279
|
+
alignItems: 'center',
|
|
1280
|
+
},
|
|
1281
|
+
topZoneText: {
|
|
1282
|
+
color: 'white',
|
|
1283
|
+
fontSize: 20,
|
|
1284
|
+
textAlign: 'center',
|
|
1285
|
+
fontWeight: 'bold',
|
|
1286
|
+
padding: 20,
|
|
1287
|
+
},
|
|
1288
|
+
leftZone: {
|
|
1289
|
+
position: 'absolute',
|
|
1290
|
+
top: '36%',
|
|
1291
|
+
left: 0,
|
|
1292
|
+
right: '95%',
|
|
1293
|
+
bottom: '36%',
|
|
1294
|
+
backgroundColor: '#00000099',
|
|
1295
|
+
},
|
|
1296
|
+
rightZone: {
|
|
1297
|
+
position: 'absolute',
|
|
1298
|
+
top: '36%',
|
|
1299
|
+
left: '95%',
|
|
1300
|
+
right: 0,
|
|
1301
|
+
bottom: '36%',
|
|
1302
|
+
backgroundColor: '#00000099',
|
|
1303
|
+
},
|
|
1304
|
+
bottomZone: {
|
|
1305
|
+
position: 'absolute',
|
|
1306
|
+
top: '64%',
|
|
1307
|
+
left: 0,
|
|
1308
|
+
right: 0,
|
|
1309
|
+
bottom: 0,
|
|
1310
|
+
backgroundColor: '#00000099',
|
|
1311
|
+
padding: 20,
|
|
1312
|
+
display: 'flex',
|
|
1313
|
+
flexDirection: 'row',
|
|
1314
|
+
gap: 10,
|
|
1315
|
+
justifyContent: 'flex-start',
|
|
1316
|
+
flexWrap: 'wrap',
|
|
1317
|
+
},
|
|
1318
|
+
imageContainer: {
|
|
1319
|
+
display: 'flex',
|
|
1320
|
+
flexDirection: 'column',
|
|
1321
|
+
alignItems: 'center',
|
|
1322
|
+
},
|
|
1323
|
+
imageContainerText: {
|
|
1324
|
+
color: 'white',
|
|
1325
|
+
fontSize: 8,
|
|
1326
|
+
textAlign: 'center',
|
|
1327
|
+
fontWeight: 'bold',
|
|
1328
|
+
marginTop: 2,
|
|
1329
|
+
},
|
|
1330
|
+
faceImage: {
|
|
1331
|
+
width: 60,
|
|
1332
|
+
height: 80,
|
|
1333
|
+
borderRadius: 4,
|
|
1334
|
+
borderWidth: 1,
|
|
1335
|
+
borderColor: 'white',
|
|
1336
|
+
},
|
|
1337
|
+
debugInfoContainer: {
|
|
1338
|
+
flex: 1,
|
|
1339
|
+
paddingLeft: 10,
|
|
1340
|
+
},
|
|
1341
|
+
debugInfoText: {
|
|
1342
|
+
color: 'white',
|
|
1343
|
+
fontSize: 8,
|
|
1344
|
+
fontWeight: 'bold',
|
|
1345
|
+
marginBottom: 2,
|
|
1346
|
+
},
|
|
1347
|
+
guide: {
|
|
1348
|
+
flex: 1,
|
|
1349
|
+
display: 'flex',
|
|
1350
|
+
justifyContent: 'center',
|
|
1351
|
+
paddingHorizontal: 20,
|
|
1352
|
+
gap: 10,
|
|
1353
|
+
backgroundColor: 'white',
|
|
1354
|
+
},
|
|
1355
|
+
guideAnimation: {
|
|
1356
|
+
width: 250,
|
|
1357
|
+
height: 250,
|
|
1358
|
+
alignSelf: 'center',
|
|
1359
|
+
},
|
|
1360
|
+
guideHeader: {
|
|
1361
|
+
color: 'black',
|
|
1362
|
+
fontSize: 18,
|
|
1363
|
+
textAlign: 'center',
|
|
1364
|
+
fontWeight: 'bold',
|
|
1365
|
+
},
|
|
1366
|
+
guidePoints: {
|
|
1367
|
+
display: 'flex',
|
|
1368
|
+
gap: 10,
|
|
1369
|
+
padding: 10,
|
|
1370
|
+
},
|
|
1371
|
+
guideText: {
|
|
1372
|
+
color: 'black',
|
|
1373
|
+
fontSize: 14,
|
|
1374
|
+
},
|
|
1375
|
+
});
|
|
1376
|
+
|
|
1377
|
+
export default IdentityDocumentCamera;
|