@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.
Files changed (650) hide show
  1. package/LICENSE +49 -0
  2. package/README.md +223 -0
  3. package/TrustchexSDK.podspec +26 -0
  4. package/android/build.gradle +103 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +11 -0
  7. package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKModule.kt +40 -0
  8. package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKPackage.kt +61 -0
  9. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/barcodescanner/BarcodeScannerFrameProcessorPlugin.kt +301 -0
  10. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/BitmapUtils.kt +205 -0
  11. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/CropperPlugin.kt +72 -0
  12. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/FrameMetadata.kt +4 -0
  13. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/facedetector/FaceDetectorFrameProcessorPlugin.kt +303 -0
  14. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/textrecognition/TextRecognitionFrameProcessorPlugin.kt +115 -0
  15. package/ios/TrustchexSDK.h +5 -0
  16. package/ios/TrustchexSDK.mm +28 -0
  17. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.mm +22 -0
  18. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.swift +172 -0
  19. package/ios/VisionCameraPlugins/Cropper/Cropper-Bridging-Header.h +13 -0
  20. package/ios/VisionCameraPlugins/Cropper/Cropper.h +20 -0
  21. package/ios/VisionCameraPlugins/Cropper/Cropper.mm +22 -0
  22. package/ios/VisionCameraPlugins/Cropper/Cropper.swift +145 -0
  23. package/ios/VisionCameraPlugins/Cropper/CropperUtils.swift +49 -0
  24. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin-Bridging-Header.h +4 -0
  25. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.mm +22 -0
  26. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.swift +320 -0
  27. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin-Bridging-Header.h +4 -0
  28. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.mm +27 -0
  29. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.swift +144 -0
  30. package/lib/module/NativeTrustchexSDK.js +4 -0
  31. package/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +141 -0
  32. package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +140 -0
  33. package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +100 -0
  34. package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +596 -0
  35. package/lib/module/Screens/Static/QrCodeScanningScreen.js +36 -0
  36. package/lib/module/Screens/Static/ResultScreen.js +627 -0
  37. package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +381 -0
  38. package/lib/module/Shared/Animations/face-scan.json +1 -0
  39. package/lib/module/Shared/Animations/hole.json +76 -0
  40. package/lib/module/Shared/Animations/hologram-scan.json +1 -0
  41. package/lib/module/Shared/Animations/id-or-passport.json +1 -0
  42. package/lib/module/Shared/Animations/light.json +1 -0
  43. package/lib/module/Shared/Animations/loading.json +1 -0
  44. package/lib/module/Shared/Animations/nfc-scan.json +1 -0
  45. package/lib/module/Shared/Animations/nfc.json +1 -0
  46. package/lib/module/Shared/Animations/scanning.json +1 -0
  47. package/lib/module/Shared/Animations/success.json +1 -0
  48. package/lib/module/Shared/Assets/trustchex-logo-black.png +0 -0
  49. package/lib/module/Shared/Components/EIDScanner.js +372 -0
  50. package/lib/module/Shared/Components/FaceCamera.js +223 -0
  51. package/lib/module/Shared/Components/IdentityDocumentCamera.js +968 -0
  52. package/lib/module/Shared/Components/LanguageSelector.js +53 -0
  53. package/lib/module/Shared/Components/NativeCircularProgress.js +64 -0
  54. package/lib/module/Shared/Components/NativeProgressBar.js +53 -0
  55. package/lib/module/Shared/Components/NavigationManager.js +180 -0
  56. package/lib/module/Shared/Components/OTPCodeInput.js +74 -0
  57. package/lib/module/Shared/Components/QrCodeScannerCamera.js +262 -0
  58. package/lib/module/Shared/Contexts/AppContext.js +27 -0
  59. package/lib/module/Shared/EIDReader/abstractMRTDCardService.js +4 -0
  60. package/lib/module/Shared/EIDReader/accessKeySpec.js +1 -0
  61. package/lib/module/Shared/EIDReader/apduLevelBACCapable.js +1 -0
  62. package/lib/module/Shared/EIDReader/apduLevelReadBinaryCapable.js +3 -0
  63. package/lib/module/Shared/EIDReader/bacKey.js +112 -0
  64. package/lib/module/Shared/EIDReader/bacKeySpec.js +3 -0
  65. package/lib/module/Shared/EIDReader/cardFileInputStream.js +140 -0
  66. package/lib/module/Shared/EIDReader/cardService.js +31 -0
  67. package/lib/module/Shared/EIDReader/cbeff/biometricDataBlock.js +3 -0
  68. package/lib/module/Shared/EIDReader/cbeff/biometricDataBlockDecoder.js +3 -0
  69. package/lib/module/Shared/EIDReader/cbeff/biometricDataBlockEncoder.js +3 -0
  70. package/lib/module/Shared/EIDReader/cbeff/cbeffInfo.js +102 -0
  71. package/lib/module/Shared/EIDReader/cbeff/complexCBEFFInfo.js +46 -0
  72. package/lib/module/Shared/EIDReader/cbeff/faceDataBlockDecoder.js +8 -0
  73. package/lib/module/Shared/EIDReader/cbeff/iso781611.js +79 -0
  74. package/lib/module/Shared/EIDReader/cbeff/iso781611Decoder.js +141 -0
  75. package/lib/module/Shared/EIDReader/cbeff/iso781611Encoder.js +53 -0
  76. package/lib/module/Shared/EIDReader/cbeff/simpleCBEFFInfo.js +21 -0
  77. package/lib/module/Shared/EIDReader/cbeff/standardBiometricHeader.js +97 -0
  78. package/lib/module/Shared/EIDReader/cert/cvcPrincipal.js +48 -0
  79. package/lib/module/Shared/EIDReader/data/country.js +66 -0
  80. package/lib/module/Shared/EIDReader/data/gender.js +29 -0
  81. package/lib/module/Shared/EIDReader/data/isoCountry.js +283 -0
  82. package/lib/module/Shared/EIDReader/data/unicodeCountry.js +278 -0
  83. package/lib/module/Shared/EIDReader/defaultFileInfo.js +29 -0
  84. package/lib/module/Shared/EIDReader/defaultFileSystem.js +171 -0
  85. package/lib/module/Shared/EIDReader/eidReader.js +90 -0
  86. package/lib/module/Shared/EIDReader/eidService.js +280 -0
  87. package/lib/module/Shared/EIDReader/fileInfo.js +3 -0
  88. package/lib/module/Shared/EIDReader/fileSystemCardService.js +4 -0
  89. package/lib/module/Shared/EIDReader/fragment.js +17 -0
  90. package/lib/module/Shared/EIDReader/fragmentBuffer.js +130 -0
  91. package/lib/module/Shared/EIDReader/java/byteArrayInputStream.js +73 -0
  92. package/lib/module/Shared/EIDReader/java/byteArrayOutputStream.js +55 -0
  93. package/lib/module/Shared/EIDReader/java/dataInput.js +1 -0
  94. package/lib/module/Shared/EIDReader/java/dataInputStream.js +167 -0
  95. package/lib/module/Shared/EIDReader/java/dataOutputStream.js +91 -0
  96. package/lib/module/Shared/EIDReader/java/filterInputStream.js +134 -0
  97. package/lib/module/Shared/EIDReader/java/filterOutputStream.js +124 -0
  98. package/lib/module/Shared/EIDReader/java/inputStream.js +139 -0
  99. package/lib/module/Shared/EIDReader/java/inputStreamBuffer.js +144 -0
  100. package/lib/module/Shared/EIDReader/java/objectInputStream.js +39 -0
  101. package/lib/module/Shared/EIDReader/java/outputStream.js +77 -0
  102. package/lib/module/Shared/EIDReader/java/positionInputStream.js +50 -0
  103. package/lib/module/Shared/EIDReader/java/splittableInputStream.js +54 -0
  104. package/lib/module/Shared/EIDReader/lds/abstractImageInfo.js +137 -0
  105. package/lib/module/Shared/EIDReader/lds/abstractLDSFile.js +101 -0
  106. package/lib/module/Shared/EIDReader/lds/abstractLDSInfo.js +29 -0
  107. package/lib/module/Shared/EIDReader/lds/abstractListInfo.js +66 -0
  108. package/lib/module/Shared/EIDReader/lds/abstractTaggedLDSFile.js +65 -0
  109. package/lib/module/Shared/EIDReader/lds/cbeffDataGroup.js +118 -0
  110. package/lib/module/Shared/EIDReader/lds/cvcaFile.js +89 -0
  111. package/lib/module/Shared/EIDReader/lds/dataGroup.js +10 -0
  112. package/lib/module/Shared/EIDReader/lds/icao/comFile.js +101 -0
  113. package/lib/module/Shared/EIDReader/lds/icao/dg1File.js +33 -0
  114. package/lib/module/Shared/EIDReader/lds/icao/dg2File.js +42 -0
  115. package/lib/module/Shared/EIDReader/lds/icao/icaoCountry.js +114 -0
  116. package/lib/module/Shared/EIDReader/lds/icao/mrzInfo.js +1418 -0
  117. package/lib/module/Shared/EIDReader/lds/imageInfo.js +3 -0
  118. package/lib/module/Shared/EIDReader/lds/iso19794/faceImageInfo.js +817 -0
  119. package/lib/module/Shared/EIDReader/lds/iso19794/faceInfo.js +116 -0
  120. package/lib/module/Shared/EIDReader/lds/ldsElement.js +1 -0
  121. package/lib/module/Shared/EIDReader/lds/ldsFile.js +3 -0
  122. package/lib/module/Shared/EIDReader/nfcManagerCardService.js +44 -0
  123. package/lib/module/Shared/EIDReader/protocol/bacAPDUSender.js +83 -0
  124. package/lib/module/Shared/EIDReader/protocol/bacProtocol.js +70 -0
  125. package/lib/module/Shared/EIDReader/protocol/bacResult.js +32 -0
  126. package/lib/module/Shared/EIDReader/protocol/readBinaryAPDUSender.js +126 -0
  127. package/lib/module/Shared/EIDReader/protocol/secureMessagingAPDUSender.js +102 -0
  128. package/lib/module/Shared/EIDReader/secureMessagingWrapper.js +218 -0
  129. package/lib/module/Shared/EIDReader/smartcards/apduEvent.js +23 -0
  130. package/lib/module/Shared/EIDReader/smartcards/apduListener.js +3 -0
  131. package/lib/module/Shared/EIDReader/smartcards/apduWrapper.js +3 -0
  132. package/lib/module/Shared/EIDReader/smartcards/commandAPDU.js +124 -0
  133. package/lib/module/Shared/EIDReader/smartcards/fileSystemStructured.js +3 -0
  134. package/lib/module/Shared/EIDReader/smartcards/iso7816.js +107 -0
  135. package/lib/module/Shared/EIDReader/smartcards/responseAPDU.js +35 -0
  136. package/lib/module/Shared/EIDReader/tlv/asn1Constants.js +48 -0
  137. package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +186 -0
  138. package/lib/module/Shared/EIDReader/tlv/tlvInputState.js +141 -0
  139. package/lib/module/Shared/EIDReader/tlv/tlvInputStream.js +180 -0
  140. package/lib/module/Shared/EIDReader/tlv/tlvOutputState.js +186 -0
  141. package/lib/module/Shared/EIDReader/tlv/tlvOutputStream.js +85 -0
  142. package/lib/module/Shared/EIDReader/tripleDesSecureMessagingWrapper.js +37 -0
  143. package/lib/module/Shared/EIDReader/utils/crypto.utils.js +218 -0
  144. package/lib/module/Shared/EIDReader/utils/random.js +166 -0
  145. package/lib/module/Shared/EIDReader/wrappedAPDUEvent.js +16 -0
  146. package/lib/module/Shared/Libs/camera.utils.js +32 -0
  147. package/lib/module/Shared/Libs/contains.js +40 -0
  148. package/lib/module/Shared/Libs/crypto.utils.js +35 -0
  149. package/lib/module/Shared/Libs/debounce.utils.js +35 -0
  150. package/lib/module/Shared/Libs/deeplink.utils.js +20 -0
  151. package/lib/module/Shared/Libs/demo.utils.js +57 -0
  152. package/lib/module/Shared/Libs/http-client.js +104 -0
  153. package/lib/module/Shared/Libs/mrz.utils.js +99 -0
  154. package/lib/module/Shared/Libs/native-device-info.utils.js +44 -0
  155. package/lib/module/Shared/Libs/native-keep-awake.utils.js +85 -0
  156. package/lib/module/Shared/Libs/opencv.utils.js +21 -0
  157. package/lib/module/Shared/Libs/promise.utils.js +17 -0
  158. package/lib/module/Shared/Libs/tts.utils.js +31 -0
  159. package/lib/module/Shared/Types/identificationInfo.js +3 -0
  160. package/lib/module/Shared/Types/instruction.js +1 -0
  161. package/lib/module/Shared/Types/livenessIntructionType.js +1 -0
  162. package/lib/module/Shared/Types/verificationSession.js +3 -0
  163. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.js +66 -0
  164. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.js +46 -0
  165. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.js +34 -0
  166. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/index.js +21 -0
  167. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.js +24 -0
  168. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/types.js +3 -0
  169. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.js +197 -0
  170. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.js +101 -0
  171. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.js +60 -0
  172. package/lib/module/Shared/VisionCameraPlugins/Cropper/index.js +47 -0
  173. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/Camera.js +42 -0
  174. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/detectFaces.js +35 -0
  175. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/index.js +4 -0
  176. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/types.js +3 -0
  177. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/Camera.js +56 -0
  178. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.js +20 -0
  179. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.js +9 -0
  180. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/index.js +6 -0
  181. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/scanText.js +20 -0
  182. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/translateText.js +19 -0
  183. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/types.js +3 -0
  184. package/lib/module/Translation/Resources/en.js +109 -0
  185. package/lib/module/Translation/Resources/index.js +4 -0
  186. package/lib/module/Translation/Resources/tr.js +112 -0
  187. package/lib/module/Translation/index.js +27 -0
  188. package/lib/module/Trustchex.js +149 -0
  189. package/lib/module/index.js +5 -0
  190. package/lib/module/package.json +1 -0
  191. package/lib/typescript/package.json +1 -0
  192. package/lib/typescript/src/NativeTrustchexSDK.d.ts +8 -0
  193. package/lib/typescript/src/NativeTrustchexSDK.d.ts.map +1 -0
  194. package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts +3 -0
  195. package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts.map +1 -0
  196. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts +3 -0
  197. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -0
  198. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts +3 -0
  199. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -0
  200. package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts +3 -0
  201. package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -0
  202. package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts +3 -0
  203. package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -0
  204. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts +3 -0
  205. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -0
  206. package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts +3 -0
  207. package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -0
  208. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts +12 -0
  209. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -0
  210. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts +9 -0
  211. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -0
  212. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts +58 -0
  213. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -0
  214. package/lib/typescript/src/Shared/Components/LanguageSelector.d.ts +3 -0
  215. package/lib/typescript/src/Shared/Components/LanguageSelector.d.ts.map +1 -0
  216. package/lib/typescript/src/Shared/Components/NativeCircularProgress.d.ts +13 -0
  217. package/lib/typescript/src/Shared/Components/NativeCircularProgress.d.ts.map +1 -0
  218. package/lib/typescript/src/Shared/Components/NativeProgressBar.d.ts +12 -0
  219. package/lib/typescript/src/Shared/Components/NativeProgressBar.d.ts.map +1 -0
  220. package/lib/typescript/src/Shared/Components/NavigationManager.d.ts +11 -0
  221. package/lib/typescript/src/Shared/Components/NavigationManager.d.ts.map +1 -0
  222. package/lib/typescript/src/Shared/Components/OTPCodeInput.d.ts +10 -0
  223. package/lib/typescript/src/Shared/Components/OTPCodeInput.d.ts.map +1 -0
  224. package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts +6 -0
  225. package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts.map +1 -0
  226. package/lib/typescript/src/Shared/Contexts/AppContext.d.ts +20 -0
  227. package/lib/typescript/src/Shared/Contexts/AppContext.d.ts.map +1 -0
  228. package/lib/typescript/src/Shared/EIDReader/abstractMRTDCardService.d.ts +50 -0
  229. package/lib/typescript/src/Shared/EIDReader/abstractMRTDCardService.d.ts.map +1 -0
  230. package/lib/typescript/src/Shared/EIDReader/accessKeySpec.d.ts +16 -0
  231. package/lib/typescript/src/Shared/EIDReader/accessKeySpec.d.ts.map +1 -0
  232. package/lib/typescript/src/Shared/EIDReader/apduLevelBACCapable.d.ts +5 -0
  233. package/lib/typescript/src/Shared/EIDReader/apduLevelBACCapable.d.ts.map +1 -0
  234. package/lib/typescript/src/Shared/EIDReader/apduLevelReadBinaryCapable.d.ts +8 -0
  235. package/lib/typescript/src/Shared/EIDReader/apduLevelReadBinaryCapable.d.ts.map +1 -0
  236. package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts +65 -0
  237. package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts.map +1 -0
  238. package/lib/typescript/src/Shared/EIDReader/bacKeySpec.d.ts +24 -0
  239. package/lib/typescript/src/Shared/EIDReader/bacKeySpec.d.ts.map +1 -0
  240. package/lib/typescript/src/Shared/EIDReader/cardFileInputStream.d.ts +26 -0
  241. package/lib/typescript/src/Shared/EIDReader/cardFileInputStream.d.ts.map +1 -0
  242. package/lib/typescript/src/Shared/EIDReader/cardService.d.ts +22 -0
  243. package/lib/typescript/src/Shared/EIDReader/cardService.d.ts.map +1 -0
  244. package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlock.d.ts +5 -0
  245. package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlock.d.ts.map +1 -0
  246. package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlockDecoder.d.ts +7 -0
  247. package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlockDecoder.d.ts.map +1 -0
  248. package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlockEncoder.d.ts +6 -0
  249. package/lib/typescript/src/Shared/EIDReader/cbeff/biometricDataBlockEncoder.d.ts.map +1 -0
  250. package/lib/typescript/src/Shared/EIDReader/cbeff/cbeffInfo.d.ts +61 -0
  251. package/lib/typescript/src/Shared/EIDReader/cbeff/cbeffInfo.d.ts.map +1 -0
  252. package/lib/typescript/src/Shared/EIDReader/cbeff/complexCBEFFInfo.d.ts +33 -0
  253. package/lib/typescript/src/Shared/EIDReader/cbeff/complexCBEFFInfo.d.ts.map +1 -0
  254. package/lib/typescript/src/Shared/EIDReader/cbeff/faceDataBlockDecoder.d.ts +8 -0
  255. package/lib/typescript/src/Shared/EIDReader/cbeff/faceDataBlockDecoder.d.ts.map +1 -0
  256. package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611.d.ts +60 -0
  257. package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611.d.ts.map +1 -0
  258. package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611Decoder.d.ts +19 -0
  259. package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611Decoder.d.ts.map +1 -0
  260. package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611Encoder.d.ts +15 -0
  261. package/lib/typescript/src/Shared/EIDReader/cbeff/iso781611Encoder.d.ts.map +1 -0
  262. package/lib/typescript/src/Shared/EIDReader/cbeff/simpleCBEFFInfo.d.ts +18 -0
  263. package/lib/typescript/src/Shared/EIDReader/cbeff/simpleCBEFFInfo.d.ts.map +1 -0
  264. package/lib/typescript/src/Shared/EIDReader/cbeff/standardBiometricHeader.d.ts +43 -0
  265. package/lib/typescript/src/Shared/EIDReader/cbeff/standardBiometricHeader.d.ts.map +1 -0
  266. package/lib/typescript/src/Shared/EIDReader/cert/cvcPrincipal.d.ts +14 -0
  267. package/lib/typescript/src/Shared/EIDReader/cert/cvcPrincipal.d.ts.map +1 -0
  268. package/lib/typescript/src/Shared/EIDReader/data/country.d.ts +14 -0
  269. package/lib/typescript/src/Shared/EIDReader/data/country.d.ts.map +1 -0
  270. package/lib/typescript/src/Shared/EIDReader/data/gender.d.ts +14 -0
  271. package/lib/typescript/src/Shared/EIDReader/data/gender.d.ts.map +1 -0
  272. package/lib/typescript/src/Shared/EIDReader/data/isoCountry.d.ts +268 -0
  273. package/lib/typescript/src/Shared/EIDReader/data/isoCountry.d.ts.map +1 -0
  274. package/lib/typescript/src/Shared/EIDReader/data/unicodeCountry.d.ts +263 -0
  275. package/lib/typescript/src/Shared/EIDReader/data/unicodeCountry.d.ts.map +1 -0
  276. package/lib/typescript/src/Shared/EIDReader/defaultFileInfo.d.ts +14 -0
  277. package/lib/typescript/src/Shared/EIDReader/defaultFileInfo.d.ts.map +1 -0
  278. package/lib/typescript/src/Shared/EIDReader/defaultFileSystem.d.ts +30 -0
  279. package/lib/typescript/src/Shared/EIDReader/defaultFileSystem.d.ts.map +1 -0
  280. package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts +8 -0
  281. package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts.map +1 -0
  282. package/lib/typescript/src/Shared/EIDReader/eidService.d.ts +150 -0
  283. package/lib/typescript/src/Shared/EIDReader/eidService.d.ts.map +1 -0
  284. package/lib/typescript/src/Shared/EIDReader/fileInfo.d.ts +5 -0
  285. package/lib/typescript/src/Shared/EIDReader/fileInfo.d.ts.map +1 -0
  286. package/lib/typescript/src/Shared/EIDReader/fileSystemCardService.d.ts +28 -0
  287. package/lib/typescript/src/Shared/EIDReader/fileSystemCardService.d.ts.map +1 -0
  288. package/lib/typescript/src/Shared/EIDReader/fragment.d.ts +9 -0
  289. package/lib/typescript/src/Shared/EIDReader/fragment.d.ts.map +1 -0
  290. package/lib/typescript/src/Shared/EIDReader/fragmentBuffer.d.ts +22 -0
  291. package/lib/typescript/src/Shared/EIDReader/fragmentBuffer.d.ts.map +1 -0
  292. package/lib/typescript/src/Shared/EIDReader/java/byteArrayInputStream.d.ts +22 -0
  293. package/lib/typescript/src/Shared/EIDReader/java/byteArrayInputStream.d.ts.map +1 -0
  294. package/lib/typescript/src/Shared/EIDReader/java/byteArrayOutputStream.d.ts +18 -0
  295. package/lib/typescript/src/Shared/EIDReader/java/byteArrayOutputStream.d.ts.map +1 -0
  296. package/lib/typescript/src/Shared/EIDReader/java/dataInput.d.ts +17 -0
  297. package/lib/typescript/src/Shared/EIDReader/java/dataInput.d.ts.map +1 -0
  298. package/lib/typescript/src/Shared/EIDReader/java/dataInputStream.d.ts +28 -0
  299. package/lib/typescript/src/Shared/EIDReader/java/dataInputStream.d.ts.map +1 -0
  300. package/lib/typescript/src/Shared/EIDReader/java/dataOutputStream.d.ts +18 -0
  301. package/lib/typescript/src/Shared/EIDReader/java/dataOutputStream.d.ts.map +1 -0
  302. package/lib/typescript/src/Shared/EIDReader/java/filterInputStream.d.ts +103 -0
  303. package/lib/typescript/src/Shared/EIDReader/java/filterInputStream.d.ts.map +1 -0
  304. package/lib/typescript/src/Shared/EIDReader/java/filterOutputStream.d.ts +83 -0
  305. package/lib/typescript/src/Shared/EIDReader/java/filterOutputStream.d.ts.map +1 -0
  306. package/lib/typescript/src/Shared/EIDReader/java/inputStream.d.ts +21 -0
  307. package/lib/typescript/src/Shared/EIDReader/java/inputStream.d.ts.map +1 -0
  308. package/lib/typescript/src/Shared/EIDReader/java/inputStreamBuffer.d.ts +32 -0
  309. package/lib/typescript/src/Shared/EIDReader/java/inputStreamBuffer.d.ts.map +1 -0
  310. package/lib/typescript/src/Shared/EIDReader/java/objectInputStream.d.ts +11 -0
  311. package/lib/typescript/src/Shared/EIDReader/java/objectInputStream.d.ts.map +1 -0
  312. package/lib/typescript/src/Shared/EIDReader/java/outputStream.d.ts +64 -0
  313. package/lib/typescript/src/Shared/EIDReader/java/outputStream.d.ts.map +1 -0
  314. package/lib/typescript/src/Shared/EIDReader/java/positionInputStream.d.ts +17 -0
  315. package/lib/typescript/src/Shared/EIDReader/java/positionInputStream.d.ts.map +1 -0
  316. package/lib/typescript/src/Shared/EIDReader/java/splittableInputStream.d.ts +19 -0
  317. package/lib/typescript/src/Shared/EIDReader/java/splittableInputStream.d.ts.map +1 -0
  318. package/lib/typescript/src/Shared/EIDReader/lds/abstractImageInfo.d.ts +50 -0
  319. package/lib/typescript/src/Shared/EIDReader/lds/abstractImageInfo.d.ts.map +1 -0
  320. package/lib/typescript/src/Shared/EIDReader/lds/abstractLDSFile.d.ts +71 -0
  321. package/lib/typescript/src/Shared/EIDReader/lds/abstractLDSFile.d.ts.map +1 -0
  322. package/lib/typescript/src/Shared/EIDReader/lds/abstractLDSInfo.d.ts +19 -0
  323. package/lib/typescript/src/Shared/EIDReader/lds/abstractLDSInfo.d.ts.map +1 -0
  324. package/lib/typescript/src/Shared/EIDReader/lds/abstractListInfo.d.ts +45 -0
  325. package/lib/typescript/src/Shared/EIDReader/lds/abstractListInfo.d.ts.map +1 -0
  326. package/lib/typescript/src/Shared/EIDReader/lds/abstractTaggedLDSFile.d.ts +18 -0
  327. package/lib/typescript/src/Shared/EIDReader/lds/abstractTaggedLDSFile.d.ts.map +1 -0
  328. package/lib/typescript/src/Shared/EIDReader/lds/cbeffDataGroup.d.ts +59 -0
  329. package/lib/typescript/src/Shared/EIDReader/lds/cbeffDataGroup.d.ts.map +1 -0
  330. package/lib/typescript/src/Shared/EIDReader/lds/cvcaFile.d.ts +19 -0
  331. package/lib/typescript/src/Shared/EIDReader/lds/cvcaFile.d.ts.map +1 -0
  332. package/lib/typescript/src/Shared/EIDReader/lds/dataGroup.d.ts +8 -0
  333. package/lib/typescript/src/Shared/EIDReader/lds/dataGroup.d.ts.map +1 -0
  334. package/lib/typescript/src/Shared/EIDReader/lds/icao/comFile.d.ts +22 -0
  335. package/lib/typescript/src/Shared/EIDReader/lds/icao/comFile.d.ts.map +1 -0
  336. package/lib/typescript/src/Shared/EIDReader/lds/icao/dg1File.d.ts +13 -0
  337. package/lib/typescript/src/Shared/EIDReader/lds/icao/dg1File.d.ts.map +1 -0
  338. package/lib/typescript/src/Shared/EIDReader/lds/icao/dg2File.d.ts +14 -0
  339. package/lib/typescript/src/Shared/EIDReader/lds/icao/dg2File.d.ts.map +1 -0
  340. package/lib/typescript/src/Shared/EIDReader/lds/icao/icaoCountry.d.ts +80 -0
  341. package/lib/typescript/src/Shared/EIDReader/lds/icao/icaoCountry.d.ts.map +1 -0
  342. package/lib/typescript/src/Shared/EIDReader/lds/icao/mrzInfo.d.ts +579 -0
  343. package/lib/typescript/src/Shared/EIDReader/lds/icao/mrzInfo.d.ts.map +1 -0
  344. package/lib/typescript/src/Shared/EIDReader/lds/imageInfo.d.ts +52 -0
  345. package/lib/typescript/src/Shared/EIDReader/lds/imageInfo.d.ts.map +1 -0
  346. package/lib/typescript/src/Shared/EIDReader/lds/iso19794/faceImageInfo.d.ts +392 -0
  347. package/lib/typescript/src/Shared/EIDReader/lds/iso19794/faceImageInfo.d.ts.map +1 -0
  348. package/lib/typescript/src/Shared/EIDReader/lds/iso19794/faceInfo.d.ts +22 -0
  349. package/lib/typescript/src/Shared/EIDReader/lds/iso19794/faceInfo.d.ts.map +1 -0
  350. package/lib/typescript/src/Shared/EIDReader/lds/ldsElement.d.ts +9 -0
  351. package/lib/typescript/src/Shared/EIDReader/lds/ldsElement.d.ts.map +1 -0
  352. package/lib/typescript/src/Shared/EIDReader/lds/ldsFile.d.ts +10 -0
  353. package/lib/typescript/src/Shared/EIDReader/lds/ldsFile.d.ts.map +1 -0
  354. package/lib/typescript/src/Shared/EIDReader/nfcManagerCardService.d.ts +13 -0
  355. package/lib/typescript/src/Shared/EIDReader/nfcManagerCardService.d.ts.map +1 -0
  356. package/lib/typescript/src/Shared/EIDReader/protocol/bacAPDUSender.d.ts +9 -0
  357. package/lib/typescript/src/Shared/EIDReader/protocol/bacAPDUSender.d.ts.map +1 -0
  358. package/lib/typescript/src/Shared/EIDReader/protocol/bacProtocol.d.ts +17 -0
  359. package/lib/typescript/src/Shared/EIDReader/protocol/bacProtocol.d.ts.map +1 -0
  360. package/lib/typescript/src/Shared/EIDReader/protocol/bacResult.d.ts +26 -0
  361. package/lib/typescript/src/Shared/EIDReader/protocol/bacResult.d.ts.map +1 -0
  362. package/lib/typescript/src/Shared/EIDReader/protocol/readBinaryAPDUSender.d.ts +15 -0
  363. package/lib/typescript/src/Shared/EIDReader/protocol/readBinaryAPDUSender.d.ts.map +1 -0
  364. package/lib/typescript/src/Shared/EIDReader/protocol/secureMessagingAPDUSender.d.ts +19 -0
  365. package/lib/typescript/src/Shared/EIDReader/protocol/secureMessagingAPDUSender.d.ts.map +1 -0
  366. package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts +30 -0
  367. package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts.map +1 -0
  368. package/lib/typescript/src/Shared/EIDReader/smartcards/apduEvent.d.ts +15 -0
  369. package/lib/typescript/src/Shared/EIDReader/smartcards/apduEvent.d.ts.map +1 -0
  370. package/lib/typescript/src/Shared/EIDReader/smartcards/apduListener.d.ts +5 -0
  371. package/lib/typescript/src/Shared/EIDReader/smartcards/apduListener.d.ts.map +1 -0
  372. package/lib/typescript/src/Shared/EIDReader/smartcards/apduWrapper.d.ts +8 -0
  373. package/lib/typescript/src/Shared/EIDReader/smartcards/apduWrapper.d.ts.map +1 -0
  374. package/lib/typescript/src/Shared/EIDReader/smartcards/commandAPDU.d.ts +20 -0
  375. package/lib/typescript/src/Shared/EIDReader/smartcards/commandAPDU.d.ts.map +1 -0
  376. package/lib/typescript/src/Shared/EIDReader/smartcards/fileSystemStructured.d.ts +7 -0
  377. package/lib/typescript/src/Shared/EIDReader/smartcards/fileSystemStructured.d.ts.map +1 -0
  378. package/lib/typescript/src/Shared/EIDReader/smartcards/iso7816.d.ts +101 -0
  379. package/lib/typescript/src/Shared/EIDReader/smartcards/iso7816.d.ts.map +1 -0
  380. package/lib/typescript/src/Shared/EIDReader/smartcards/responseAPDU.d.ts +13 -0
  381. package/lib/typescript/src/Shared/EIDReader/smartcards/responseAPDU.d.ts.map +1 -0
  382. package/lib/typescript/src/Shared/EIDReader/tlv/asn1Constants.d.ts +36 -0
  383. package/lib/typescript/src/Shared/EIDReader/tlv/asn1Constants.d.ts.map +1 -0
  384. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts +44 -0
  385. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -0
  386. package/lib/typescript/src/Shared/EIDReader/tlv/tlvInputState.d.ts +34 -0
  387. package/lib/typescript/src/Shared/EIDReader/tlv/tlvInputState.d.ts.map +1 -0
  388. package/lib/typescript/src/Shared/EIDReader/tlv/tlvInputStream.d.ts +23 -0
  389. package/lib/typescript/src/Shared/EIDReader/tlv/tlvInputStream.d.ts.map +1 -0
  390. package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputState.d.ts +24 -0
  391. package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputState.d.ts.map +1 -0
  392. package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputStream.d.ts +16 -0
  393. package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputStream.d.ts.map +1 -0
  394. package/lib/typescript/src/Shared/EIDReader/tripleDesSecureMessagingWrapper.d.ts +10 -0
  395. package/lib/typescript/src/Shared/EIDReader/tripleDesSecureMessagingWrapper.d.ts.map +1 -0
  396. package/lib/typescript/src/Shared/EIDReader/utils/crypto.utils.d.ts +16 -0
  397. package/lib/typescript/src/Shared/EIDReader/utils/crypto.utils.d.ts.map +1 -0
  398. package/lib/typescript/src/Shared/EIDReader/utils/random.d.ts +25 -0
  399. package/lib/typescript/src/Shared/EIDReader/utils/random.d.ts.map +1 -0
  400. package/lib/typescript/src/Shared/EIDReader/wrappedAPDUEvent.d.ts +11 -0
  401. package/lib/typescript/src/Shared/EIDReader/wrappedAPDUEvent.d.ts.map +1 -0
  402. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts +5 -0
  403. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts.map +1 -0
  404. package/lib/typescript/src/Shared/Libs/contains.d.ts +14 -0
  405. package/lib/typescript/src/Shared/Libs/contains.d.ts.map +1 -0
  406. package/lib/typescript/src/Shared/Libs/crypto.utils.d.ts +9 -0
  407. package/lib/typescript/src/Shared/Libs/crypto.utils.d.ts.map +1 -0
  408. package/lib/typescript/src/Shared/Libs/debounce.utils.d.ts +10 -0
  409. package/lib/typescript/src/Shared/Libs/debounce.utils.d.ts.map +1 -0
  410. package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts +5 -0
  411. package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -0
  412. package/lib/typescript/src/Shared/Libs/demo.utils.d.ts +5 -0
  413. package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -0
  414. package/lib/typescript/src/Shared/Libs/http-client.d.ts +27 -0
  415. package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -0
  416. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts +9 -0
  417. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -0
  418. package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts +14 -0
  419. package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -0
  420. package/lib/typescript/src/Shared/Libs/native-keep-awake.utils.d.ts +31 -0
  421. package/lib/typescript/src/Shared/Libs/native-keep-awake.utils.d.ts.map +1 -0
  422. package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts +3 -0
  423. package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts.map +1 -0
  424. package/lib/typescript/src/Shared/Libs/promise.utils.d.ts +3 -0
  425. package/lib/typescript/src/Shared/Libs/promise.utils.d.ts.map +1 -0
  426. package/lib/typescript/src/Shared/Libs/tts.utils.d.ts +6 -0
  427. package/lib/typescript/src/Shared/Libs/tts.utils.d.ts.map +1 -0
  428. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +57 -0
  429. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -0
  430. package/lib/typescript/src/Shared/Types/instruction.d.ts +5 -0
  431. package/lib/typescript/src/Shared/Types/instruction.d.ts.map +1 -0
  432. package/lib/typescript/src/Shared/Types/livenessIntructionType.d.ts +2 -0
  433. package/lib/typescript/src/Shared/Types/livenessIntructionType.d.ts.map +1 -0
  434. package/lib/typescript/src/Shared/Types/verificationSession.d.ts +16 -0
  435. package/lib/typescript/src/Shared/Types/verificationSession.d.ts.map +1 -0
  436. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.d.ts +13 -0
  437. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.d.ts.map +1 -0
  438. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts +13 -0
  439. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts.map +1 -0
  440. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts +6 -0
  441. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts.map +1 -0
  442. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts +14 -0
  443. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts.map +1 -0
  444. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts +3 -0
  445. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts.map +1 -0
  446. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts +52 -0
  447. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts.map +1 -0
  448. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts +62 -0
  449. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts.map +1 -0
  450. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts +34 -0
  451. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts.map +1 -0
  452. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts +32 -0
  453. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts.map +1 -0
  454. package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts +23 -0
  455. package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts.map +1 -0
  456. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts +9 -0
  457. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts.map +1 -0
  458. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts +3 -0
  459. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts.map +1 -0
  460. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts +3 -0
  461. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts.map +1 -0
  462. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts +79 -0
  463. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts.map +1 -0
  464. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts +6 -0
  465. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts.map +1 -0
  466. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts +3 -0
  467. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts.map +1 -0
  468. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts +3 -0
  469. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts.map +1 -0
  470. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts +5 -0
  471. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts.map +1 -0
  472. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts +3 -0
  473. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts.map +1 -0
  474. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts +3 -0
  475. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts.map +1 -0
  476. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts +67 -0
  477. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts.map +1 -0
  478. package/lib/typescript/src/Translation/Resources/en.d.ts +109 -0
  479. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -0
  480. package/lib/typescript/src/Translation/Resources/index.d.ts +3 -0
  481. package/lib/typescript/src/Translation/Resources/index.d.ts.map +1 -0
  482. package/lib/typescript/src/Translation/Resources/tr.d.ts +112 -0
  483. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -0
  484. package/lib/typescript/src/Translation/index.d.ts +3 -0
  485. package/lib/typescript/src/Translation/index.d.ts.map +1 -0
  486. package/lib/typescript/src/Trustchex.d.ts +18 -0
  487. package/lib/typescript/src/Trustchex.d.ts.map +1 -0
  488. package/lib/typescript/src/index.d.ts +4 -0
  489. package/lib/typescript/src/index.d.ts.map +1 -0
  490. package/package.json +288 -0
  491. package/src/NativeTrustchexSDK.ts +9 -0
  492. package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +165 -0
  493. package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +205 -0
  494. package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +152 -0
  495. package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +699 -0
  496. package/src/Screens/Static/QrCodeScanningScreen.tsx +37 -0
  497. package/src/Screens/Static/ResultScreen.tsx +877 -0
  498. package/src/Screens/Static/VerificationSessionCheckScreen.tsx +524 -0
  499. package/src/Shared/Animations/face-scan.json +1 -0
  500. package/src/Shared/Animations/hole.json +76 -0
  501. package/src/Shared/Animations/hologram-scan.json +1 -0
  502. package/src/Shared/Animations/id-or-passport.json +1 -0
  503. package/src/Shared/Animations/light.json +1 -0
  504. package/src/Shared/Animations/loading.json +1 -0
  505. package/src/Shared/Animations/nfc-scan.json +1 -0
  506. package/src/Shared/Animations/nfc.json +1 -0
  507. package/src/Shared/Animations/scanning.json +1 -0
  508. package/src/Shared/Animations/success.json +1 -0
  509. package/src/Shared/Assets/trustchex-logo-black.png +0 -0
  510. package/src/Shared/Components/EIDScanner.tsx +472 -0
  511. package/src/Shared/Components/FaceCamera.tsx +267 -0
  512. package/src/Shared/Components/IdentityDocumentCamera.tsx +1377 -0
  513. package/src/Shared/Components/LanguageSelector.tsx +62 -0
  514. package/src/Shared/Components/NativeCircularProgress.tsx +76 -0
  515. package/src/Shared/Components/NativeProgressBar.tsx +74 -0
  516. package/src/Shared/Components/NavigationManager.tsx +275 -0
  517. package/src/Shared/Components/OTPCodeInput.tsx +93 -0
  518. package/src/Shared/Components/QrCodeScannerCamera.tsx +306 -0
  519. package/src/Shared/Contexts/AppContext.ts +47 -0
  520. package/src/Shared/EIDReader/abstractMRTDCardService.ts +195 -0
  521. package/src/Shared/EIDReader/accessKeySpec.ts +16 -0
  522. package/src/Shared/EIDReader/apduLevelBACCapable.ts +10 -0
  523. package/src/Shared/EIDReader/apduLevelReadBinaryCapable.ts +15 -0
  524. package/src/Shared/EIDReader/bacKey.ts +132 -0
  525. package/src/Shared/EIDReader/bacKeySpec.ts +26 -0
  526. package/src/Shared/EIDReader/cardFileInputStream.ts +188 -0
  527. package/src/Shared/EIDReader/cardService.ts +51 -0
  528. package/src/Shared/EIDReader/cbeff/biometricDataBlock.ts +5 -0
  529. package/src/Shared/EIDReader/cbeff/biometricDataBlockDecoder.ts +12 -0
  530. package/src/Shared/EIDReader/cbeff/biometricDataBlockEncoder.ts +6 -0
  531. package/src/Shared/EIDReader/cbeff/cbeffInfo.ts +100 -0
  532. package/src/Shared/EIDReader/cbeff/complexCBEFFInfo.ts +48 -0
  533. package/src/Shared/EIDReader/cbeff/faceDataBlockDecoder.ts +17 -0
  534. package/src/Shared/EIDReader/cbeff/iso781611.ts +79 -0
  535. package/src/Shared/EIDReader/cbeff/iso781611Decoder.ts +242 -0
  536. package/src/Shared/EIDReader/cbeff/iso781611Encoder.ts +91 -0
  537. package/src/Shared/EIDReader/cbeff/simpleCBEFFInfo.ts +26 -0
  538. package/src/Shared/EIDReader/cbeff/standardBiometricHeader.ts +116 -0
  539. package/src/Shared/EIDReader/cert/cvcPrincipal.ts +63 -0
  540. package/src/Shared/EIDReader/data/country.ts +76 -0
  541. package/src/Shared/EIDReader/data/gender.ts +36 -0
  542. package/src/Shared/EIDReader/data/isoCountry.ts +1251 -0
  543. package/src/Shared/EIDReader/data/unicodeCountry.ts +1516 -0
  544. package/src/Shared/EIDReader/defaultFileInfo.ts +41 -0
  545. package/src/Shared/EIDReader/defaultFileSystem.ts +287 -0
  546. package/src/Shared/EIDReader/eidReader.ts +113 -0
  547. package/src/Shared/EIDReader/eidService.ts +349 -0
  548. package/src/Shared/EIDReader/fileInfo.ts +5 -0
  549. package/src/Shared/EIDReader/fileSystemCardService.ts +32 -0
  550. package/src/Shared/EIDReader/fragment.ts +21 -0
  551. package/src/Shared/EIDReader/fragmentBuffer.ts +191 -0
  552. package/src/Shared/EIDReader/java/byteArrayInputStream.ts +103 -0
  553. package/src/Shared/EIDReader/java/byteArrayOutputStream.ts +67 -0
  554. package/src/Shared/EIDReader/java/dataInput.ts +16 -0
  555. package/src/Shared/EIDReader/java/dataInputStream.ts +203 -0
  556. package/src/Shared/EIDReader/java/dataOutputStream.ts +107 -0
  557. package/src/Shared/EIDReader/java/filterInputStream.ts +138 -0
  558. package/src/Shared/EIDReader/java/filterOutputStream.ts +126 -0
  559. package/src/Shared/EIDReader/java/inputStream.ts +186 -0
  560. package/src/Shared/EIDReader/java/inputStreamBuffer.ts +200 -0
  561. package/src/Shared/EIDReader/java/objectInputStream.ts +45 -0
  562. package/src/Shared/EIDReader/java/outputStream.ts +76 -0
  563. package/src/Shared/EIDReader/java/positionInputStream.ts +64 -0
  564. package/src/Shared/EIDReader/java/splittableInputStream.ts +69 -0
  565. package/src/Shared/EIDReader/lds/abstractImageInfo.ts +191 -0
  566. package/src/Shared/EIDReader/lds/abstractLDSFile.ts +106 -0
  567. package/src/Shared/EIDReader/lds/abstractLDSInfo.ts +31 -0
  568. package/src/Shared/EIDReader/lds/abstractListInfo.ts +72 -0
  569. package/src/Shared/EIDReader/lds/abstractTaggedLDSFile.ts +85 -0
  570. package/src/Shared/EIDReader/lds/cbeffDataGroup.ts +128 -0
  571. package/src/Shared/EIDReader/lds/cvcaFile.ts +112 -0
  572. package/src/Shared/EIDReader/lds/dataGroup.ts +11 -0
  573. package/src/Shared/EIDReader/lds/icao/comFile.ts +166 -0
  574. package/src/Shared/EIDReader/lds/icao/dg1File.ts +45 -0
  575. package/src/Shared/EIDReader/lds/icao/dg2File.ts +54 -0
  576. package/src/Shared/EIDReader/lds/icao/icaoCountry.ts +253 -0
  577. package/src/Shared/EIDReader/lds/icao/mrzInfo.ts +1669 -0
  578. package/src/Shared/EIDReader/lds/imageInfo.ts +58 -0
  579. package/src/Shared/EIDReader/lds/iso19794/faceImageInfo.ts +948 -0
  580. package/src/Shared/EIDReader/lds/iso19794/faceInfo.ts +198 -0
  581. package/src/Shared/EIDReader/lds/ldsElement.ts +8 -0
  582. package/src/Shared/EIDReader/lds/ldsFile.ts +14 -0
  583. package/src/Shared/EIDReader/nfcManagerCardService.ts +58 -0
  584. package/src/Shared/EIDReader/protocol/bacAPDUSender.ts +146 -0
  585. package/src/Shared/EIDReader/protocol/bacProtocol.ts +121 -0
  586. package/src/Shared/EIDReader/protocol/bacResult.ts +36 -0
  587. package/src/Shared/EIDReader/protocol/readBinaryAPDUSender.ts +251 -0
  588. package/src/Shared/EIDReader/protocol/secureMessagingAPDUSender.ts +170 -0
  589. package/src/Shared/EIDReader/secureMessagingWrapper.ts +361 -0
  590. package/src/Shared/EIDReader/smartcards/apduEvent.ts +38 -0
  591. package/src/Shared/EIDReader/smartcards/apduListener.ts +5 -0
  592. package/src/Shared/EIDReader/smartcards/apduWrapper.ts +10 -0
  593. package/src/Shared/EIDReader/smartcards/commandAPDU.ts +172 -0
  594. package/src/Shared/EIDReader/smartcards/fileSystemStructured.ts +7 -0
  595. package/src/Shared/EIDReader/smartcards/iso7816.ts +104 -0
  596. package/src/Shared/EIDReader/smartcards/responseAPDU.ts +44 -0
  597. package/src/Shared/EIDReader/tlv/asn1Constants.ts +46 -0
  598. package/src/Shared/EIDReader/tlv/tlv.utils.ts +201 -0
  599. package/src/Shared/EIDReader/tlv/tlvInputState.ts +186 -0
  600. package/src/Shared/EIDReader/tlv/tlvInputStream.ts +207 -0
  601. package/src/Shared/EIDReader/tlv/tlvOutputState.ts +244 -0
  602. package/src/Shared/EIDReader/tlv/tlvOutputStream.ts +112 -0
  603. package/src/Shared/EIDReader/tripleDesSecureMessagingWrapper.ts +48 -0
  604. package/src/Shared/EIDReader/utils/crypto.utils.ts +273 -0
  605. package/src/Shared/EIDReader/utils/random.ts +198 -0
  606. package/src/Shared/EIDReader/wrappedAPDUEvent.ts +36 -0
  607. package/src/Shared/Libs/camera.utils.ts +34 -0
  608. package/src/Shared/Libs/contains.ts +59 -0
  609. package/src/Shared/Libs/crypto.utils.ts +47 -0
  610. package/src/Shared/Libs/debounce.utils.ts +38 -0
  611. package/src/Shared/Libs/deeplink.utils.ts +19 -0
  612. package/src/Shared/Libs/demo.utils.ts +82 -0
  613. package/src/Shared/Libs/http-client.ts +148 -0
  614. package/src/Shared/Libs/mrz.utils.ts +110 -0
  615. package/src/Shared/Libs/native-device-info.utils.ts +50 -0
  616. package/src/Shared/Libs/native-keep-awake.utils.ts +104 -0
  617. package/src/Shared/Libs/opencv.utils.ts +40 -0
  618. package/src/Shared/Libs/promise.utils.ts +20 -0
  619. package/src/Shared/Libs/tts.utils.ts +40 -0
  620. package/src/Shared/Types/identificationInfo.ts +62 -0
  621. package/src/Shared/Types/instruction.ts +4 -0
  622. package/src/Shared/Types/livenessIntructionType.ts +8 -0
  623. package/src/Shared/Types/verificationSession.ts +17 -0
  624. package/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.tsx +85 -0
  625. package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.ts +79 -0
  626. package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.ts +45 -0
  627. package/src/Shared/VisionCameraPlugins/BarcodeScanner/index.ts +64 -0
  628. package/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.ts +30 -0
  629. package/src/Shared/VisionCameraPlugins/BarcodeScanner/types.ts +82 -0
  630. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.ts +195 -0
  631. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.ts +135 -0
  632. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.ts +84 -0
  633. package/src/Shared/VisionCameraPlugins/Cropper/index.ts +78 -0
  634. package/src/Shared/VisionCameraPlugins/FaceDetector/Camera.tsx +63 -0
  635. package/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.ts +44 -0
  636. package/src/Shared/VisionCameraPlugins/FaceDetector/index.ts +3 -0
  637. package/src/Shared/VisionCameraPlugins/FaceDetector/types.ts +99 -0
  638. package/src/Shared/VisionCameraPlugins/TextRecognition/Camera.tsx +76 -0
  639. package/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.ts +18 -0
  640. package/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.ts +7 -0
  641. package/src/Shared/VisionCameraPlugins/TextRecognition/index.ts +7 -0
  642. package/src/Shared/VisionCameraPlugins/TextRecognition/scanText.ts +27 -0
  643. package/src/Shared/VisionCameraPlugins/TextRecognition/translateText.ts +21 -0
  644. package/src/Shared/VisionCameraPlugins/TextRecognition/types.ts +141 -0
  645. package/src/Translation/Resources/en.ts +151 -0
  646. package/src/Translation/Resources/index.ts +2 -0
  647. package/src/Translation/Resources/tr.ts +152 -0
  648. package/src/Translation/index.ts +37 -0
  649. package/src/Trustchex.tsx +171 -0
  650. package/src/index.tsx +5 -0
@@ -0,0 +1,1669 @@
1
+ import { Gender } from '../../data/gender';
2
+ import { ByteArrayInputStream } from '../../java/byteArrayInputStream';
3
+ import { DataInputStream } from '../../java/dataInputStream';
4
+ import { DataOutputStream } from '../../java/dataOutputStream';
5
+ import { InputStream } from '../../java/inputStream';
6
+ import { OutputStream } from '../../java/outputStream';
7
+ import { AbstractLDSInfo } from '../abstractLDSInfo';
8
+ import { Buffer } from 'buffer';
9
+
10
+ /**
11
+ * The type of document (MRZ), determining the number of lines,
12
+ * number of characters per line, and positions and lengths of fields,
13
+ * and check-digits.
14
+ */
15
+ export class DocumentType {
16
+ /** Unspecified document type (do not use, choose ID1 or ID3). */
17
+ public static UNKNOWN = new DocumentType(0, 'UNKNOWN');
18
+
19
+ /** MROTD 3 lines of 30 characters, as per part 5. */
20
+ public static TD1 = new DocumentType(1, 'TD1');
21
+
22
+ /** MROTD 2 lines of 36 characters, as per part 6. */
23
+ public static TD2 = new DocumentType(2, 'TD2');
24
+
25
+ /** MRP 2 lines of 44 characters, as per part 4. */
26
+ public static TD3 = new DocumentType(3, 'TD3');
27
+
28
+ /** MRV type A. */
29
+ public static MRVA = new DocumentType(4, 'MRVA');
30
+
31
+ /** MRV type B. */
32
+ public static MRVB = new DocumentType(5, 'MRVB');
33
+
34
+ /** The code representing the document type. */
35
+ public code: number;
36
+
37
+ /** The string representation of the document type. */
38
+ public strCode: string;
39
+
40
+ /**
41
+ * Creates a new DocumentType instance.
42
+ *
43
+ * @param code The code representing the document type.
44
+ * @param strCode The string representation of the document type.
45
+ */
46
+ constructor(code: number, strCode: string) {
47
+ this.code = code;
48
+ this.strCode = strCode;
49
+ }
50
+
51
+ /**
52
+ * Returns the code representing the document type.
53
+ *
54
+ * @return the code representing the document type
55
+ */
56
+ getCode(): number {
57
+ return this.code;
58
+ }
59
+
60
+ /**
61
+ * Returns the string representation of the document type.
62
+ *
63
+ * @return the string representation of the document type
64
+ */
65
+ getStrCode(): string {
66
+ return this.strCode;
67
+ }
68
+ }
69
+
70
+ export class MRZInfo extends AbstractLDSInfo {
71
+ /** All valid characters in MRZ. */
72
+ private static MRZ_CHARS = '<0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
73
+
74
+ private documentType!: DocumentType;
75
+ private documentCode!: string;
76
+ private issuingState!: string;
77
+ private primaryIdentifier!: string;
78
+ private secondaryIdentifier!: string;
79
+ private nationality!: string;
80
+ private documentNumber!: string;
81
+ private dateOfBirth!: string;
82
+ private gender!: Gender;
83
+ private dateOfExpiry!: string;
84
+ private documentNumberCheckDigit!: string;
85
+ private dateOfBirthCheckDigit!: string;
86
+ private dateOfExpiryCheckDigit!: string;
87
+ private personalNumberCheckDigit!: string; /* NOTE: Over optionalData1, but only for TD3. When empty we prefer '<' over '0'. */
88
+ private compositeCheckDigit!: string;
89
+ private optionalData1!: string; /* NOTE: For TD1 holds personal number for some issuing states (e.g. NL), but is used to hold (part of) document number for others. */
90
+ private optionalData2!: string;
91
+
92
+ /**
93
+ * Creates a new MRZ based on an input stream.
94
+ *
95
+ * @param inputStream contains the contents (value) of DG1 (without the tag and length)
96
+ * @param length the length of the MRZInfo structure
97
+ */
98
+ static async fromStream(inputStream: InputStream, length: number) {
99
+ const mrzInfo = new MRZInfo();
100
+ try {
101
+ await mrzInfo.readObject(inputStream, length);
102
+ } catch (error) {
103
+ throw new Error(`Error reading MRZ: ${error}`);
104
+ }
105
+ return mrzInfo;
106
+ }
107
+
108
+ /**
109
+ * Creates a new MRZ based on the text input.
110
+ * The text input may contain newlines, which will be ignored.
111
+ *
112
+ * @param str input text
113
+ */
114
+ static async fromString(str?: string) {
115
+ const mrzInfo = new MRZInfo();
116
+ if (str == null) {
117
+ throw new Error('Null string');
118
+ }
119
+ str = str.trim().replace('\n', '');
120
+ try {
121
+ await mrzInfo.readObject(
122
+ new ByteArrayInputStream(Buffer.from(str, 'utf-8')),
123
+ str.length
124
+ );
125
+ } catch (error) {
126
+ throw new Error(`Error reading MRZ: ${error}`);
127
+ }
128
+
129
+ return mrzInfo;
130
+ }
131
+
132
+ /**
133
+ * Returns the date of birth of the passport holder.
134
+ *
135
+ * @return date of birth
136
+ */
137
+ public getDateOfBirth(): string {
138
+ return this.dateOfBirth;
139
+ }
140
+
141
+ /**
142
+ * Returns the date of expiry.
143
+ *
144
+ * @return the date of expiry
145
+ */
146
+ getDateOfExpiry(): string {
147
+ return this.dateOfExpiry;
148
+ }
149
+
150
+ /**
151
+ * Returns the document number.
152
+ *
153
+ * @return document number
154
+ */
155
+ public getDocumentNumber(): string {
156
+ return this.documentNumber;
157
+ }
158
+
159
+ /**
160
+ * Returns the document type.
161
+ *
162
+ * @return document type
163
+ *
164
+ * @deprecated Clients should determine type based on {@link #getDocumentCode()}
165
+ */
166
+ public getDocumentType(): DocumentType {
167
+ return this.documentType;
168
+ }
169
+
170
+ /**
171
+ * Returns the document code.
172
+ *
173
+ * @return document type
174
+ */
175
+ getDocumentCode(): string {
176
+ return this.documentCode;
177
+ }
178
+
179
+ /**
180
+ * Returns the issuing state as a 3 letter code.
181
+ *
182
+ * @return the issuing state
183
+ */
184
+ public getIssuingState(): string {
185
+ return MRZInfo.mrzFormat(this.issuingState, 3);
186
+ }
187
+
188
+ /**
189
+ * Returns the passport holder's last name.
190
+ *
191
+ * @return name
192
+ */
193
+ getPrimaryIdentifier(): string {
194
+ return this.primaryIdentifier;
195
+ }
196
+
197
+ /**
198
+ * Returns the document holder's first names.
199
+ *
200
+ * @return the secondary identifier
201
+ */
202
+ getSecondaryIdentifier(): string {
203
+ return this.secondaryIdentifier;
204
+ }
205
+
206
+ /**
207
+ * Returns the document holder's first names.
208
+ *
209
+ * @return first names
210
+ */
211
+ public getSecondaryIdentifierComponents(): string[] {
212
+ return this.secondaryIdentifier.split(' |<');
213
+ }
214
+
215
+ /**
216
+ * Returns the passport holder's nationality as a 3 digit code.
217
+ *
218
+ * @return a country
219
+ */
220
+ public getNationality(): string {
221
+ return MRZInfo.mrzFormat(this.nationality, 3);
222
+ }
223
+
224
+ /**
225
+ * Returns the personal number (if a personal number is encoded in optional data 1).
226
+ *
227
+ * @return personal number
228
+ */
229
+ public getPersonalNumber(): string | null {
230
+ if (this.optionalData1 == null) {
231
+ return null;
232
+ }
233
+ if (this.optionalData1.length > 14) {
234
+ return MRZInfo.trimTrailingFillerChars(
235
+ this.optionalData1.substring(0, 14)
236
+ );
237
+ } else {
238
+ return MRZInfo.trimTrailingFillerChars(this.optionalData1);
239
+ }
240
+ }
241
+
242
+ /**
243
+ * Returns the passport holder's gender.
244
+ *
245
+ * @return gender
246
+ */
247
+ public getGender(): Gender {
248
+ return this.gender;
249
+ }
250
+
251
+ /**
252
+ * Returns the contents of the first optional data field for ID-1 and ID-3 style MRZs.
253
+ *
254
+ * @return optional data 1
255
+ */
256
+ getOptionalData1(): string {
257
+ return this.optionalData1;
258
+ }
259
+
260
+ /**
261
+ * Returns the contents of the second optional data field for ID-1 style MRZs.
262
+ *
263
+ * @return optional data 2
264
+ */
265
+ getOptionalData2(): string {
266
+ return this.optionalData2;
267
+ }
268
+
269
+ /**
270
+ * Sets the document code.
271
+ *
272
+ * @param documentCode the new document code
273
+ *
274
+ * @deprecated Class will become immutable
275
+ */
276
+ public setDocumentCode(documentCode: string): void {
277
+ this.documentCode = documentCode;
278
+ this.documentType = MRZInfo.getDocumentTypeFromDocumentCode(documentCode);
279
+ if (this.documentType === DocumentType.TD1 && this.optionalData2 === null) {
280
+ this.optionalData2 = '';
281
+ }
282
+ /* FIXME: need to adjust some other lengths if we go from ID1 to ID3 or back... */
283
+ }
284
+
285
+ /**
286
+ * Sets the document number.
287
+ *
288
+ * @param documentNumber new document number
289
+ *
290
+ * @deprecated Class will become immutable
291
+ */
292
+ public setDocumentNumber(documentNumber: string): void {
293
+ this.documentNumber = documentNumber.trim();
294
+ this.checkDigit();
295
+ }
296
+
297
+ /**
298
+ * Sets the passport holder's last name.
299
+ *
300
+ * @param primaryIdentifier new primary identifier
301
+ *
302
+ * @deprecated Class will become immutable
303
+ */
304
+ public setPrimaryIdentifier(primaryIdentifier: string): void {
305
+ this.primaryIdentifier = MRZInfo.trimTrailingFillerChars(
306
+ primaryIdentifier
307
+ ).replace('<', ' ');
308
+ this.checkDigit();
309
+ }
310
+
311
+ /**
312
+ * Sets the passport holder's first names.
313
+ *
314
+ * @param secondaryIdentifiers new secondary identifiers
315
+ *
316
+ * @deprecated Class will become immutable
317
+ */
318
+ public setSecondaryIdentifierComponents(
319
+ secondaryIdentifiers: string[]
320
+ ): void {
321
+ if (secondaryIdentifiers == null) {
322
+ this.secondaryIdentifier = '';
323
+ } else {
324
+ let stringBuilder = '';
325
+ for (let i = 0; i < secondaryIdentifiers.length; i++) {
326
+ stringBuilder += secondaryIdentifiers[i];
327
+ if (i < secondaryIdentifiers.length - 1) {
328
+ stringBuilder += '<';
329
+ }
330
+ }
331
+ this.secondaryIdentifier = stringBuilder;
332
+ }
333
+ this.checkDigit();
334
+ }
335
+
336
+ /**
337
+ * Sets the passport holder's first names.
338
+ *
339
+ * @param secondaryIdentifiers new secondary identifiers
340
+ *
341
+ * @deprecated Class will become immutable
342
+ */
343
+ public setSecondaryIdentifiers(secondaryIdentifiers: string): void {
344
+ this.readSecondaryIdentifiers(secondaryIdentifiers.trim());
345
+ this.checkDigit();
346
+ }
347
+
348
+ /**
349
+ * Sets the date of birth.
350
+ *
351
+ * @param dateOfBirth new date of birth
352
+ *
353
+ * @deprecated Class will become immutable
354
+ */
355
+ public setDateOfBirth(dateOfBirth: string): void {
356
+ this.dateOfBirth = dateOfBirth;
357
+ this.checkDigit();
358
+ }
359
+
360
+ /**
361
+ * Sets the date of expiry.
362
+ *
363
+ * @param dateOfExpiry new date of expiry
364
+ *
365
+ * @deprecated Class will become immutable
366
+ */
367
+ public setDateOfExpiry(dateOfExpiry: string): void {
368
+ this.dateOfExpiry = dateOfExpiry;
369
+ this.checkDigit();
370
+ }
371
+
372
+ /**
373
+ * Sets the issuing state.
374
+ *
375
+ * @param issuingState new issuing state
376
+ *
377
+ * @deprecated Class will become immutable
378
+ */
379
+ public setIssuingState(issuingState: string): void {
380
+ this.issuingState = issuingState;
381
+ this.checkDigit();
382
+ }
383
+
384
+ /**
385
+ * Sets the personal number. Replacing any optional data 1.
386
+ *
387
+ * @param personalNumber new personal number
388
+ *
389
+ * @deprecated Class will become immutable
390
+ */
391
+ public setPersonalNumber(personalNumber: string): void {
392
+ if (personalNumber == null || personalNumber.length > 14) {
393
+ throw new Error('Wrong personal number');
394
+ }
395
+ this.optionalData1 = MRZInfo.mrzFormat(personalNumber, 14);
396
+ this.personalNumberCheckDigit = MRZInfo.checkDigit(this.optionalData1);
397
+ }
398
+
399
+ /**
400
+ * Sets the passport holder's nationality.
401
+ *
402
+ * @param nationality new nationality
403
+ *
404
+ * @deprecated Class will become immutable
405
+ */
406
+ public setNationality(nationality: string): void {
407
+ this.nationality = nationality;
408
+ this.checkDigit();
409
+ }
410
+
411
+ /**
412
+ * Sets the contents for the second optional data field for ID-1 style MRZs.
413
+ *
414
+ * @param optionalData2 optional data 2
415
+ *
416
+ * @deprecated Class will become immutable
417
+ */
418
+ public setOptionalData2(optionalData2: string): void {
419
+ this.optionalData2 = MRZInfo.trimTrailingFillerChars(optionalData2);
420
+ this.checkDigit();
421
+ }
422
+
423
+ /**
424
+ * Sets the gender.
425
+ *
426
+ * @param gender new gender
427
+ *
428
+ * @deprecated Class will become immutable
429
+ */
430
+ public setGender(gender: Gender): void {
431
+ if (gender == null) {
432
+ throw new Error('Gender must not be null');
433
+ }
434
+ this.gender = gender;
435
+ this.checkDigit();
436
+ }
437
+
438
+ /* ONLY PRIVATE METHODS BELOW */
439
+
440
+ /**
441
+ * Reads the object value from a stream.
442
+ *
443
+ * @param inputStream the stream to read from
444
+ * @param length the length of the value
445
+ *
446
+ * @throws IOException on error reading from the stream
447
+ */
448
+ private async readObject(
449
+ inputStream: InputStream,
450
+ length: number
451
+ ): Promise<void> {
452
+ const dataIn: DataInputStream =
453
+ inputStream instanceof DataInputStream
454
+ ? (inputStream as DataInputStream)
455
+ : new DataInputStream(inputStream);
456
+
457
+ /* line 1, pos 1 to 2, Document code, all types. */
458
+ this.documentCode = MRZInfo.trimTrailingFillerChars(
459
+ await MRZInfo.readString(dataIn, 2)
460
+ );
461
+ this.documentType = MRZInfo.getDocumentType(this.documentCode, length);
462
+ switch (this.documentType) {
463
+ case DocumentType.TD1:
464
+ await this.readObjectTD1(dataIn);
465
+ break;
466
+ case DocumentType.TD2:
467
+ /* Fall through... */
468
+ case DocumentType.MRVB:
469
+ await this.readObjectTD2orMRVB(dataIn);
470
+ break;
471
+ case DocumentType.MRVA:
472
+ /* Fall through... */
473
+ case DocumentType.TD3:
474
+ /* Fall through... */
475
+ default:
476
+ /* Assume it's a ID3 document, i.e. 2-line MRZ. */
477
+ await this.readObjectTD3OrMRVA(dataIn);
478
+ break;
479
+ }
480
+ }
481
+
482
+ /**
483
+ * Reads the object value from a stream after document-code has already
484
+ * been read, and it is determined that we are dealing with a TD1 style MRZ.
485
+ *
486
+ * @param inputStream the stream to read from
487
+ *
488
+ * @throws IOException on error reading from the stream
489
+ */
490
+ private async readObjectTD1(inputStream: InputStream): Promise<void> {
491
+ const dataIn: DataInputStream =
492
+ inputStream instanceof DataInputStream
493
+ ? (inputStream as DataInputStream)
494
+ : new DataInputStream(inputStream);
495
+
496
+ /* line 1, pos 3 to 5 Issuing State or organization */
497
+ this.issuingState = await MRZInfo.readCountryCode(dataIn);
498
+
499
+ /* line 1, pos 6 to 14 Document number */
500
+ this.documentNumber = await MRZInfo.readString(dataIn, 9);
501
+
502
+ /* line 1, pos 15 Check digit */
503
+ this.documentNumberCheckDigit = String.fromCharCode(
504
+ await dataIn.readUnsignedByte()
505
+ );
506
+
507
+ /* line 1, pos 16 to 30, Optional data elements */
508
+ const rawOptionalData1 = await MRZInfo.readString(dataIn, 15);
509
+ this.optionalData1 = MRZInfo.trimTrailingFillerChars(rawOptionalData1);
510
+
511
+ if (this.documentNumberCheckDigit === '<' && this.optionalData1 !== '') {
512
+ /* Interpret personal number as part of document number, see note j. */
513
+ let extendedDocumentNumberEnd: number = this.optionalData1.indexOf('<');
514
+ if (extendedDocumentNumberEnd < 0) {
515
+ extendedDocumentNumberEnd = this.optionalData1.length;
516
+ }
517
+
518
+ const documentNumberRemainder: string = this.optionalData1.substring(
519
+ 0,
520
+ extendedDocumentNumberEnd - 1
521
+ );
522
+ this.documentNumber += documentNumberRemainder;
523
+ this.documentNumberCheckDigit = this.optionalData1.charAt(
524
+ extendedDocumentNumberEnd - 1
525
+ );
526
+
527
+ this.optionalData1 = this.optionalData1.substring(
528
+ Math.min(extendedDocumentNumberEnd + 1, this.optionalData1.length)
529
+ );
530
+ }
531
+ this.documentNumber = MRZInfo.trimTrailingFillerChars(this.documentNumber);
532
+
533
+ /* line 2, pos 1 to 6, Date of birth */
534
+ this.dateOfBirth = await this.readDate(dataIn);
535
+
536
+ /* line 2, pos 7, Check digit */
537
+ this.dateOfBirthCheckDigit = String.fromCharCode(
538
+ await dataIn.readUnsignedByte()
539
+ );
540
+
541
+ /* line 2, pos 8, Sex */
542
+ this.gender = await this.readGender(dataIn);
543
+
544
+ /* line 2, Pos 9 to 14, Date of expiry */
545
+ this.dateOfExpiry = await this.readDate(dataIn);
546
+
547
+ /* line 2, pos 15, Check digit */
548
+ this.dateOfExpiryCheckDigit = String.fromCharCode(
549
+ await dataIn.readUnsignedByte()
550
+ );
551
+
552
+ /* line 2, pos 16 to 18, Nationality */
553
+ this.nationality = await MRZInfo.readCountryCode(dataIn);
554
+
555
+ /* line 2, pos 19 to 29, Optional data elements */
556
+ this.optionalData2 = MRZInfo.trimTrailingFillerChars(
557
+ await MRZInfo.readString(dataIn, 11)
558
+ );
559
+
560
+ /* line 2, pos 30, Overall check digit */
561
+ this.compositeCheckDigit = String.fromCharCode(
562
+ await dataIn.readUnsignedByte()
563
+ );
564
+
565
+ /* line 3 */
566
+ this.readNameIdentifiers(await MRZInfo.readString(dataIn, 30));
567
+ }
568
+
569
+ /**
570
+ * Reads the object value from a stream after document-code has already
571
+ * been read, and it is determined that we are dealing with a TD2 or MRV-B style MRZ.
572
+ *
573
+ * @param inputStream the stream to read from
574
+ *
575
+ * @throws IOException on error reading from the stream
576
+ */
577
+ private async readObjectTD2orMRVB(inputStream: InputStream): Promise<void> {
578
+ const dataIn: DataInputStream =
579
+ inputStream instanceof DataInputStream
580
+ ? (inputStream as DataInputStream)
581
+ : new DataInputStream(inputStream);
582
+
583
+ /* line 1, pos 3 to 5 */
584
+ this.issuingState = await MRZInfo.readCountryCode(dataIn);
585
+
586
+ /* line 1, pos 6 to 36 */
587
+ this.readNameIdentifiers(await MRZInfo.readString(dataIn, 31));
588
+
589
+ /* line 2 */
590
+ this.documentNumber = MRZInfo.trimTrailingFillerChars(
591
+ await MRZInfo.readString(dataIn, 9)
592
+ );
593
+ this.documentNumberCheckDigit = String.fromCharCode(
594
+ await dataIn.readUnsignedByte()
595
+ );
596
+ this.nationality = await MRZInfo.readCountryCode(dataIn);
597
+ this.dateOfBirth = await this.readDate(dataIn);
598
+ this.dateOfBirthCheckDigit = String.fromCharCode(
599
+ await dataIn.readUnsignedByte()
600
+ );
601
+ this.gender = await this.readGender(dataIn);
602
+ this.dateOfExpiry = await this.readDate(dataIn);
603
+ this.dateOfExpiryCheckDigit = String.fromCharCode(
604
+ await dataIn.readUnsignedByte()
605
+ );
606
+ if (this.documentType === DocumentType.MRVB) {
607
+ this.optionalData1 = MRZInfo.trimTrailingFillerChars(
608
+ await MRZInfo.readString(dataIn, 8)
609
+ );
610
+ } else if (this.documentType === DocumentType.TD2) {
611
+ this.optionalData1 = MRZInfo.trimTrailingFillerChars(
612
+ await MRZInfo.readString(dataIn, 7)
613
+ );
614
+
615
+ if (
616
+ this.documentNumberCheckDigit === '<' &&
617
+ this.optionalData1.length > 0
618
+ ) {
619
+ /* Interpret optional data as part of document number, see note j. */
620
+ this.documentNumber += this.optionalData1.substring(
621
+ 0,
622
+ this.optionalData1.length - 1
623
+ );
624
+ this.documentNumberCheckDigit = this.optionalData1.charAt(
625
+ this.optionalData1.length - 1
626
+ );
627
+ this.optionalData1 = '';
628
+ }
629
+ }
630
+ this.documentNumber = MRZInfo.trimTrailingFillerChars(this.documentNumber);
631
+
632
+ if (this.documentType === DocumentType.TD2) {
633
+ this.compositeCheckDigit = String.fromCharCode(
634
+ await dataIn.readUnsignedByte()
635
+ );
636
+ }
637
+ }
638
+
639
+ /**
640
+ * Reads the object value from a stream after document-code has already
641
+ * been read, and it is determined that we are dealing with a TD3 or MRV-A style MRZ.
642
+ *
643
+ * @param inputStream the stream to read from
644
+ *
645
+ * @throws IOException on error reading from the stream
646
+ */
647
+ private async readObjectTD3OrMRVA(inputStream: InputStream): Promise<void> {
648
+ const dataIn: DataInputStream =
649
+ inputStream instanceof DataInputStream
650
+ ? inputStream
651
+ : new DataInputStream(inputStream);
652
+
653
+ /* line 1, pos 3 to 5 */
654
+ this.issuingState = await MRZInfo.readCountryCode(dataIn);
655
+
656
+ /* line 1, pos 6 to 44 */
657
+ this.readNameIdentifiers(await MRZInfo.readString(dataIn, 39));
658
+
659
+ /* line 2 */
660
+ this.documentNumber = MRZInfo.trimTrailingFillerChars(
661
+ await MRZInfo.readString(dataIn, 9)
662
+ );
663
+ this.documentNumberCheckDigit = String.fromCharCode(
664
+ await dataIn.readUnsignedByte()
665
+ );
666
+ this.nationality = await MRZInfo.readCountryCode(dataIn);
667
+ this.dateOfBirth = await this.readDate(dataIn);
668
+ this.dateOfBirthCheckDigit = String.fromCharCode(
669
+ await dataIn.readUnsignedByte()
670
+ );
671
+ this.gender = await this.readGender(dataIn);
672
+ this.dateOfExpiry = await this.readDate(dataIn);
673
+ this.dateOfExpiryCheckDigit = String.fromCharCode(
674
+ await dataIn.readUnsignedByte()
675
+ );
676
+ if (this.documentType === DocumentType.MRVA) {
677
+ this.optionalData1 = MRZInfo.trimTrailingFillerChars(
678
+ await MRZInfo.readString(dataIn, 16)
679
+ );
680
+ } else {
681
+ this.optionalData1 = MRZInfo.trimTrailingFillerChars(
682
+ await MRZInfo.readString(dataIn, 14)
683
+ );
684
+ this.personalNumberCheckDigit = String.fromCharCode(
685
+ await dataIn.readUnsignedByte()
686
+ );
687
+ this.compositeCheckDigit = String.fromCharCode(
688
+ await dataIn.readUnsignedByte()
689
+ );
690
+ }
691
+ }
692
+
693
+ /**
694
+ * Writes the MRZ to an output stream.
695
+ * This just outputs the MRZ characters, and does not add newlines.
696
+ *
697
+ * @param outputStream the output stream to write to
698
+ */
699
+ public writeObject(outputStream: OutputStream): void {
700
+ switch (this.documentType) {
701
+ case DocumentType.TD1:
702
+ this.writeObjectTD1(outputStream);
703
+ break;
704
+ case DocumentType.TD2:
705
+ /* Fall through. */
706
+ case DocumentType.MRVB:
707
+ this.writeObjectTD2OrMRVB(outputStream);
708
+ break;
709
+ case DocumentType.TD3:
710
+ /* Fall through. */
711
+ case DocumentType.MRVA:
712
+ this.writeObjectTD3OrMRVA(outputStream);
713
+ break;
714
+ default:
715
+ throw new Error('Unsupported document type');
716
+ }
717
+ }
718
+
719
+ /**
720
+ * Tests equality of two MRZ string while ignoring extra filler characters.
721
+ *
722
+ * @param str1 an MRZ string
723
+ * @param str2 another MRZ string
724
+ *
725
+ * @return a boolean indicating whether the strings are equal modulo filler characters
726
+ */
727
+ static equalsModuloFillerChars(str1: string, str2: string): boolean {
728
+ if (str1 === str2) {
729
+ return true;
730
+ }
731
+ if (str1 === null) {
732
+ str1 = '';
733
+ }
734
+ if (str2 === null) {
735
+ str2 = '';
736
+ }
737
+
738
+ const length = Math.max(str1.length, str2.length);
739
+ return MRZInfo.mrzFormat(str1, length) === MRZInfo.mrzFormat(str2, length);
740
+ }
741
+
742
+ /**
743
+ * Writes this MRZ to stream.
744
+ *
745
+ * @param outputStream the stream to write to
746
+ *
747
+ * @throws IOException on error writing to the stream
748
+ */
749
+ private writeObjectTD1(outputStream: OutputStream): void {
750
+ const dataOut: DataOutputStream =
751
+ outputStream instanceof DataOutputStream
752
+ ? outputStream
753
+ : new DataOutputStream(outputStream);
754
+
755
+ /* top line */
756
+ this.writeDocumentType(dataOut);
757
+ MRZInfo.writeCountryCode(this.issuingState, dataOut);
758
+
759
+ const isExtendedDocumentNumber: boolean = this.documentNumber.length > 9;
760
+ if (isExtendedDocumentNumber) {
761
+ /*
762
+ * If document number has more than 9 character, the 9 principal
763
+ * character shall be shown in the MRZ in character positions 1 to 9.
764
+ * They shall be followed by a filler character instead of a check
765
+ * digit to indicate a truncated number. The remaining character of
766
+ * the document number shall be shown at the beginning of the field
767
+ * reserved of optional data element (character position 29 to 35 of
768
+ * the lower machine readable line) followed by a check digit and a
769
+ * filler character.
770
+ *
771
+ * Corresponds to Doc 9303 (pre-seventh edition) pt 3 vol 1 page V-10 (note j) (FIXED by Paulo Assumcao)
772
+ *
773
+ * Also see R3-p1_v2_sIV_0041 in Supplement to Doc 9303, release 11.
774
+ */
775
+ this.writeString(this.documentNumber.substring(0, 9), dataOut, 9);
776
+ dataOut.writeUTF('<'); /* NOTE: instead of check digit */
777
+ this.writeString(
778
+ this.documentNumber.substring(9) +
779
+ this.documentNumberCheckDigit +
780
+ '<' +
781
+ this.optionalData1,
782
+ dataOut,
783
+ 15
784
+ );
785
+ } else {
786
+ this.writeString(
787
+ this.documentNumber,
788
+ dataOut,
789
+ 9
790
+ ); /* FIXME: max size of field */
791
+ dataOut.writeUTF(this.documentNumberCheckDigit);
792
+ this.writeString(
793
+ this.optionalData1,
794
+ dataOut,
795
+ 15
796
+ ); /* FIXME: max size of field */
797
+ }
798
+
799
+ /* middle line */
800
+ this.writeDateOfBirth(dataOut);
801
+ dataOut.writeUTF(this.dateOfBirthCheckDigit);
802
+ this.writeGender(dataOut);
803
+ this.writeDateOfExpiry(dataOut);
804
+ dataOut.writeUTF(this.dateOfExpiryCheckDigit);
805
+ MRZInfo.writeCountryCode(this.nationality, dataOut);
806
+ this.writeString(this.optionalData2, dataOut, 11);
807
+ dataOut.writeUTF(this.compositeCheckDigit);
808
+
809
+ /* bottom line */
810
+ this.writeName(dataOut, 30);
811
+ }
812
+
813
+ /**
814
+ * Writes this MRZ to stream.
815
+ *
816
+ * @param outputStream the stream to write to
817
+ *
818
+ * @throws IOException on error writing to the stream
819
+ */
820
+ private writeObjectTD2OrMRVB(outputStream: OutputStream): void {
821
+ const dataOut: DataOutputStream =
822
+ outputStream instanceof DataOutputStream
823
+ ? outputStream
824
+ : new DataOutputStream(outputStream);
825
+
826
+ /* top line */
827
+ this.writeDocumentType(dataOut);
828
+ MRZInfo.writeCountryCode(this.issuingState, dataOut);
829
+ this.writeName(dataOut, 31);
830
+
831
+ /* bottom line */
832
+
833
+ const isExtendedDocumentNumber: boolean =
834
+ this.documentType === DocumentType.TD2 &&
835
+ this.documentNumber.length > 9 &&
836
+ MRZInfo.equalsModuloFillerChars(this.optionalData1, '');
837
+ if (isExtendedDocumentNumber) {
838
+ this.writeString(this.documentNumber.substring(0, 9), dataOut, 9);
839
+ dataOut.writeUTF('<'); /* NOTE: instead of check digit */
840
+ } else {
841
+ this.writeString(
842
+ this.documentNumber,
843
+ dataOut,
844
+ 9
845
+ ); /* FIXME: max size of field */
846
+ dataOut.writeUTF(this.documentNumberCheckDigit);
847
+ }
848
+
849
+ MRZInfo.writeCountryCode(this.nationality, dataOut);
850
+ this.writeDateOfBirth(dataOut);
851
+ dataOut.writeUTF(this.dateOfBirthCheckDigit);
852
+ this.writeGender(dataOut);
853
+ this.writeDateOfExpiry(dataOut);
854
+ dataOut.writeUTF(this.dateOfExpiryCheckDigit);
855
+ if (this.documentType === DocumentType.MRVB) {
856
+ this.writeString(this.optionalData1, dataOut, 8);
857
+ } else if (isExtendedDocumentNumber) {
858
+ this.writeString(
859
+ this.documentNumber.substring(9) + this.documentNumberCheckDigit + '<',
860
+ dataOut,
861
+ 7
862
+ );
863
+ dataOut.writeUTF(this.compositeCheckDigit);
864
+ } else {
865
+ this.writeString(this.optionalData1, dataOut, 7);
866
+ dataOut.writeUTF(this.compositeCheckDigit);
867
+ }
868
+ }
869
+
870
+ /**
871
+ * Writes this MRZ to stream.
872
+ *
873
+ * @param outputStream the stream to write to
874
+ *
875
+ * @throws IOException on error writing to the stream
876
+ */
877
+ private writeObjectTD3OrMRVA(outputStream: OutputStream): void {
878
+ const dataOut: DataOutputStream =
879
+ outputStream instanceof DataOutputStream
880
+ ? outputStream
881
+ : new DataOutputStream(outputStream);
882
+
883
+ /* top line */
884
+ this.writeDocumentType(dataOut);
885
+ MRZInfo.writeCountryCode(this.issuingState, dataOut);
886
+ this.writeName(dataOut, 39);
887
+
888
+ /* bottom line */
889
+ this.writeString(this.documentNumber, dataOut, 9);
890
+ dataOut.writeUTF(this.documentNumberCheckDigit);
891
+ MRZInfo.writeCountryCode(this.nationality, dataOut);
892
+ this.writeDateOfBirth(dataOut);
893
+ dataOut.writeUTF(this.dateOfBirthCheckDigit);
894
+ this.writeGender(dataOut);
895
+ this.writeDateOfExpiry(dataOut);
896
+ dataOut.writeUTF(this.dateOfExpiryCheckDigit);
897
+ if (this.documentType === DocumentType.MRVA) {
898
+ this.writeString(this.optionalData1, dataOut, 16);
899
+ } else {
900
+ // Must be TD3.
901
+ this.writeString(this.optionalData1, dataOut, 14);
902
+ dataOut.writeUTF(this.personalNumberCheckDigit);
903
+ dataOut.writeUTF(this.compositeCheckDigit);
904
+ }
905
+ }
906
+
907
+ /**
908
+ * Sets the name identifiers (primary and secondary identifier) based on
909
+ * the name in the MRZ.
910
+ *
911
+ * @param mrzNameString the name field as it occurs in the MRZ
912
+ */
913
+ private readNameIdentifiers(mrzNameString: string): void {
914
+ const delimIndex = mrzNameString.indexOf('<<');
915
+ if (delimIndex < 0) {
916
+ /* Only a primary identifier. */
917
+ this.primaryIdentifier = MRZInfo.trimTrailingFillerChars(
918
+ mrzNameString
919
+ ).replace('<', ' ');
920
+ this.secondaryIdentifier = '';
921
+ return;
922
+ }
923
+ this.primaryIdentifier = MRZInfo.trimTrailingFillerChars(
924
+ mrzNameString.substring(0, delimIndex)
925
+ ).replace('<', ' ');
926
+ const rest = mrzNameString.substring(delimIndex + 2);
927
+ this.readSecondaryIdentifiers(rest);
928
+ }
929
+
930
+ /**
931
+ * Sets the secondary identifier.
932
+ *
933
+ * @param secondaryIdentifier the new secondary identifier
934
+ */
935
+ private readSecondaryIdentifiers(secondaryIdentifier: string): void {
936
+ this.secondaryIdentifier = MRZInfo.trimTrailingFillerChars(
937
+ secondaryIdentifier
938
+ ).replace('<', ' ');
939
+ }
940
+
941
+ /**
942
+ * Writes a MRZ string to a stream, optionally formatting the MRZ string.
943
+ *
944
+ * @param str the string to write
945
+ * @param dataOutputStream the stream to write to
946
+ * @param width the width of the MRZ field (the string will be augmented with trailing fillers)
947
+ *
948
+ * @throws IOException on error writing to the stream
949
+ */
950
+ private writeString(
951
+ str: string,
952
+ dataOutputStream: DataOutputStream,
953
+ width: number
954
+ ): void {
955
+ dataOutputStream.writeUTF(MRZInfo.mrzFormat(str, width));
956
+ }
957
+
958
+ /**
959
+ * Writes the issuing state to a stream.
960
+ *
961
+ * @param dataOutputStream the stream to write to
962
+ *
963
+ * @throws IOException on error writing to the stream
964
+ */
965
+ private static writeCountryCode(
966
+ countryCode: string,
967
+ dataOutputStream: DataOutputStream
968
+ ): void {
969
+ dataOutputStream.writeUTF(MRZInfo.mrzFormat(countryCode, 3));
970
+ }
971
+
972
+ /**
973
+ * Writes the date of expiry to a stream.
974
+ *
975
+ * @param dateOutputStream the stream to write to
976
+ *
977
+ * @throws IOException on error writing to the stream
978
+ */
979
+ private writeDateOfExpiry(dateOutputStream: DataOutputStream): void {
980
+ dateOutputStream.writeUTF(this.dateOfExpiry);
981
+ }
982
+
983
+ /**
984
+ * Writes the gender to a stream.
985
+ *
986
+ * @param dataOutputStream the stream to write to
987
+ *
988
+ * @throws IOException on error writing to the stream
989
+ */
990
+ private writeGender(dataOutputStream: DataOutputStream): void {
991
+ dataOutputStream.writeUTF(this.gender.getStrCode());
992
+ }
993
+
994
+ /**
995
+ * Writes the data of birth to a stream.
996
+ *
997
+ * @param dataOutputStream the stream to write to
998
+ *
999
+ * @throws IOException on error writing to the stream
1000
+ */
1001
+ private writeDateOfBirth(dataOutputStream: DataOutputStream): void {
1002
+ dataOutputStream.writeUTF(this.dateOfBirth);
1003
+ }
1004
+
1005
+ /**
1006
+ * Writes the name to a stream.
1007
+ *
1008
+ * @param dataOutputStream the stream to write to
1009
+ * @param width the width of the field
1010
+ *
1011
+ * @throws IOException on error writing to the stream
1012
+ */
1013
+ private writeName(dataOutputStream: DataOutputStream, width: number): void {
1014
+ dataOutputStream.writeUTF(
1015
+ MRZInfo.nameToString(
1016
+ this.primaryIdentifier,
1017
+ this.secondaryIdentifier,
1018
+ width
1019
+ )
1020
+ );
1021
+ }
1022
+
1023
+ /**
1024
+ * Write the document type to a stream.
1025
+ *
1026
+ * @param dataOutputStream the stream to write to
1027
+ *
1028
+ * @throws IOException on error writing to the stream
1029
+ */
1030
+ private writeDocumentType(dataOutputStream: DataOutputStream): void {
1031
+ this.writeString(this.documentCode, dataOutputStream, 2);
1032
+ }
1033
+
1034
+ /**
1035
+ * Encodes the personal number as optional data in case of TD3 style MRZ.
1036
+ * If the number does not yet include a check-digit it will be added.
1037
+ *
1038
+ * @param personalNumber the personal number (or optional data)
1039
+ *
1040
+ * @return the optional data to include in the MRZ
1041
+ */
1042
+ private static personalNumberToOptionalData(personalNumber: string): string {
1043
+ if (
1044
+ personalNumber == null ||
1045
+ MRZInfo.equalsModuloFillerChars(personalNumber, '')
1046
+ ) {
1047
+ /* optional data field is not used */
1048
+ return '';
1049
+ } else if (personalNumber.length === 15) {
1050
+ /* it's either a personalNumber with check digit included, or some other optional data. FIXME: Is this case possible? */
1051
+ return personalNumber;
1052
+ } else if (personalNumber.length <= 14) {
1053
+ /* we'll assume it's a personalNumber without check digit, and we add the check digit ourselves */
1054
+ return MRZInfo.mrzFormat(personalNumber, 14);
1055
+ } else {
1056
+ throw new Error(`Wrong personal number${personalNumber}`);
1057
+ }
1058
+ }
1059
+
1060
+ /**
1061
+ * Converts the name (primary and secondary identifier) to a single MRZ formatted name
1062
+ * field of the given length.
1063
+ *
1064
+ * @param primaryIdentifier the primary identifier part of the name
1065
+ * @param secondaryIdentifier the secondary identifier part of the name
1066
+ * @param width the width of the resulting MRZ formatted string
1067
+ *
1068
+ * @return the string containing the MRZ formatted name field
1069
+ */
1070
+ private static nameToString(
1071
+ primaryIdentifier: string,
1072
+ secondaryIdentifier: string,
1073
+ width: number
1074
+ ): string {
1075
+ const primaryComponents: string[] = primaryIdentifier.split(' |<');
1076
+ const secondaryComponents: string[] =
1077
+ secondaryIdentifier == null || secondaryIdentifier.trim().length === 0
1078
+ ? []
1079
+ : secondaryIdentifier.split(' |<');
1080
+
1081
+ const name: string[] = [];
1082
+ let isFirstPrimaryComponent: boolean = true;
1083
+ for (const primaryComponent of primaryComponents) {
1084
+ if (isFirstPrimaryComponent) {
1085
+ isFirstPrimaryComponent = false;
1086
+ } else {
1087
+ name.push('<');
1088
+ }
1089
+ name.push(primaryComponent);
1090
+ }
1091
+
1092
+ if (
1093
+ secondaryIdentifier != null &&
1094
+ secondaryIdentifier.trim().length !== 0
1095
+ ) {
1096
+ name.push('<<');
1097
+ let isFirstSecondaryComponent: boolean = true;
1098
+ for (const secondaryComponent of secondaryComponents) {
1099
+ if (isFirstSecondaryComponent) {
1100
+ isFirstSecondaryComponent = false;
1101
+ } else {
1102
+ name.push('<');
1103
+ }
1104
+ name.push(secondaryComponent);
1105
+ }
1106
+ }
1107
+
1108
+ return MRZInfo.mrzFormat(name.join(''), width);
1109
+ }
1110
+
1111
+ /**
1112
+ * Reads the issuing state as a three letter string.
1113
+ *
1114
+ * @param inputStream the stream to read from
1115
+ *
1116
+ * @return a string of length 3 containing an abbreviation
1117
+ * of the issuing state or organization
1118
+ *
1119
+ * @throws IOException error reading from the stream
1120
+ */
1121
+ private static async readCountryCode(
1122
+ inputStream: DataInputStream
1123
+ ): Promise<string> {
1124
+ return MRZInfo.trimTrailingFillerChars(
1125
+ await MRZInfo.readString(inputStream, 3)
1126
+ );
1127
+ }
1128
+
1129
+ /**
1130
+ * Reads the 1 letter gender information.
1131
+ *
1132
+ * @param inputStream input source
1133
+ *
1134
+ * @return the gender of the passport holder
1135
+ *
1136
+ * @throws IOException if something goes wrong
1137
+ */
1138
+ private async readGender(inputStream: DataInputStream): Promise<Gender> {
1139
+ const genderStr = await MRZInfo.readString(inputStream, 1);
1140
+ if (genderStr.toUpperCase() === 'M') {
1141
+ return Gender.MALE;
1142
+ }
1143
+ if (genderStr.toUpperCase() === 'F') {
1144
+ return Gender.FEMALE;
1145
+ }
1146
+ return Gender.UNKNOWN;
1147
+ }
1148
+
1149
+ /**
1150
+ * Reads a date.
1151
+ * Result is typically in "yyMMdd" format.
1152
+ *
1153
+ * @param inputStream the stream to read from
1154
+ *
1155
+ * @return the date of birth
1156
+ *
1157
+ * @throws IOException if something goes wrong
1158
+ * @throws NumberFormatException if a data could not be constructed
1159
+ */
1160
+ private async readDate(inputStream: DataInputStream): Promise<string> {
1161
+ return await MRZInfo.readString(inputStream, 6);
1162
+ }
1163
+
1164
+ /**
1165
+ * Reads a fixed length string from a stream.
1166
+ *
1167
+ * @param inputStream the stream to read from
1168
+ * @param count the fixed length
1169
+ *
1170
+ * @return the string that was read
1171
+ *
1172
+ * @throws IOException on error reading from the stream
1173
+ */
1174
+ private static async readString(
1175
+ inputStream: DataInputStream,
1176
+ count: number
1177
+ ): Promise<string> {
1178
+ const data = Buffer.alloc(count);
1179
+ await inputStream.readFully(data);
1180
+ return Buffer.from(data).toString('utf8');
1181
+ }
1182
+
1183
+ /**
1184
+ * Returns the composite part over which the composite check digit is computed.
1185
+ *
1186
+ * @param documentType the type of document, either {@code DOC_TYPE_ID1} or {@code DOC_TYPE_ID3}
1187
+ *
1188
+ * @return a string with the composite part
1189
+ */
1190
+ private getComposite(documentType: DocumentType): string | null {
1191
+ const composite: string[] = [];
1192
+ const documentNumberLength: number = this.documentNumber.length;
1193
+
1194
+ switch (documentType) {
1195
+ case DocumentType.TD1:
1196
+ /*
1197
+ * Upper line:
1198
+ * 6-30, i.e., documentNumber, documentNumberCheckDigit, optionaldata1(15)
1199
+ *
1200
+ * Middle line:
1201
+ * 1-7, i.e., dateOfBirth, dateOfBirthCheckDigit
1202
+ * 9-15, i.e., dateOfExpiry, dateOfExpiryCheckDigit
1203
+ * 19-29, i.e., optionalData2(11)
1204
+ */
1205
+ if (documentNumberLength <= 9) {
1206
+ composite.push(MRZInfo.mrzFormat(this.documentNumber, 9));
1207
+ composite.push(this.documentNumberCheckDigit);
1208
+ composite.push(MRZInfo.mrzFormat(this.optionalData1, 15));
1209
+ } else {
1210
+ /* Document number, first 9 characters. */
1211
+ composite.push(this.documentNumber.substring(0, 9));
1212
+ composite.push('<'); /* Filler instead of check digit. */
1213
+
1214
+ /* Remainder of document number. */
1215
+ const documentNumberRemainder: string =
1216
+ this.documentNumber.substring(9);
1217
+ composite.push(documentNumberRemainder);
1218
+ composite.push(this.documentNumberCheckDigit);
1219
+ composite.push('<');
1220
+
1221
+ /* Remainder of optional data 1 (removing any prefix). */
1222
+ const optionalData1Remainder: string = MRZInfo.mrzFormat(
1223
+ this.optionalData1,
1224
+ 15 - 2 - documentNumberRemainder.length
1225
+ );
1226
+ composite.push(optionalData1Remainder);
1227
+ }
1228
+ composite.push(this.dateOfBirth);
1229
+ composite.push(this.dateOfBirthCheckDigit);
1230
+ composite.push(this.dateOfExpiry);
1231
+ composite.push(this.dateOfExpiryCheckDigit);
1232
+ composite.push(MRZInfo.mrzFormat(this.optionalData2, 11));
1233
+ return composite.join('');
1234
+ case DocumentType.TD2:
1235
+ /* Composite check digit lower line: 1-10, 14-20, 22-35. */
1236
+ composite.push(this.documentNumber);
1237
+ composite.push(this.documentNumberCheckDigit);
1238
+ composite.push(this.dateOfBirth);
1239
+ composite.push(this.dateOfBirthCheckDigit);
1240
+ composite.push(this.dateOfExpiry);
1241
+ composite.push(this.dateOfExpiryCheckDigit);
1242
+ composite.push(MRZInfo.mrzFormat(this.optionalData1, 7));
1243
+ return composite.join('');
1244
+ case DocumentType.MRVB:
1245
+ /* No composite checkdigit for MRV-B. */
1246
+ return null;
1247
+ case DocumentType.TD3:
1248
+ /* Composite check digit lower line: 1-10, 14-20, 22-43. */
1249
+ composite.push(MRZInfo.mrzFormat(this.documentNumber, 9));
1250
+ composite.push(this.documentNumberCheckDigit);
1251
+ composite.push(this.dateOfBirth);
1252
+ composite.push(this.dateOfBirthCheckDigit);
1253
+ composite.push(this.dateOfExpiry);
1254
+ composite.push(this.dateOfExpiryCheckDigit);
1255
+ composite.push(MRZInfo.mrzFormat(this.optionalData1, 14));
1256
+ composite.push(this.personalNumberCheckDigit);
1257
+ return composite.join('');
1258
+ case DocumentType.MRVA:
1259
+ /* No composite checkdigit for MRV-A. */
1260
+ return null;
1261
+ default:
1262
+ throw new Error('Unsupported document type');
1263
+ }
1264
+ }
1265
+
1266
+ /**
1267
+ * Updates the check digit fields for document number,
1268
+ * date of birth, date of expiry, and composite.
1269
+ */
1270
+ private checkDigit(): void {
1271
+ this.documentNumberCheckDigit = MRZInfo.checkDigit(this.documentNumber);
1272
+ this.dateOfBirthCheckDigit = MRZInfo.checkDigit(this.dateOfBirth);
1273
+ this.dateOfExpiryCheckDigit = MRZInfo.checkDigit(this.dateOfExpiry);
1274
+
1275
+ if (
1276
+ this.documentType === DocumentType.TD3 &&
1277
+ this.optionalData1.length < 15
1278
+ ) {
1279
+ this.personalNumberCheckDigit = MRZInfo.checkDigit(
1280
+ MRZInfo.mrzFormat(this.optionalData1, 14),
1281
+ true
1282
+ ); /* FIXME: Uses '<' over '0'. Where specified? */
1283
+ }
1284
+
1285
+ const composite: string | null = this.getComposite(this.documentType);
1286
+ if (composite != null) {
1287
+ this.compositeCheckDigit = MRZInfo.checkDigit(composite);
1288
+ }
1289
+ }
1290
+
1291
+ /**
1292
+ * Reformats the input string such that it
1293
+ * only contains ['A'-'Z'], ['0'-'9'], '<' characters
1294
+ * by replacing other characters with '<'.
1295
+ * Also extends to the given length by adding '<' to the right.
1296
+ *
1297
+ * @param str the input string
1298
+ * @param width the (minimal) width of the result
1299
+ *
1300
+ * @return the reformatted string
1301
+ */
1302
+ private static mrzFormat(str: string, width: number): string {
1303
+ if (str == null) {
1304
+ return '';
1305
+ }
1306
+ if (str.length > width) {
1307
+ throw new Error(`Argument too wide (${str.length} > ${width})`);
1308
+ }
1309
+ str = str.toUpperCase().trim();
1310
+ let result = '';
1311
+ for (let i = 0; i < str.length; i++) {
1312
+ const c = str.charAt(i);
1313
+ if (MRZInfo.MRZ_CHARS.indexOf(c) === -1) {
1314
+ result += '<';
1315
+ } else {
1316
+ result += c;
1317
+ }
1318
+ }
1319
+ while (result.length < width) {
1320
+ result += '<';
1321
+ }
1322
+ return result;
1323
+ }
1324
+
1325
+ /**
1326
+ * Determines the document-type.
1327
+ *
1328
+ * @param documentCode the document-code
1329
+ * @param length the length of the complete MRZ (excluding whitespace)
1330
+ *
1331
+ * @return the document-type enum value
1332
+ */
1333
+ private static getDocumentType(
1334
+ documentCode: string,
1335
+ length: number
1336
+ ): DocumentType {
1337
+ if (
1338
+ documentCode == null ||
1339
+ documentCode.length < 1 ||
1340
+ documentCode.length > 2
1341
+ ) {
1342
+ throw new Error(
1343
+ 'Was expecting 1 or 2 digit document code, got ' + documentCode
1344
+ );
1345
+ }
1346
+
1347
+ switch (length) {
1348
+ case 90:
1349
+ /* Document-code must start with C, I, or A. */
1350
+ return DocumentType.TD1;
1351
+ case 72:
1352
+ if (documentCode.startsWith('V')) {
1353
+ return DocumentType.MRVB;
1354
+ } else {
1355
+ /* Document-code must start with C, I, or A. */
1356
+ return DocumentType.TD2;
1357
+ }
1358
+ case 88:
1359
+ if (documentCode.startsWith('V')) {
1360
+ return DocumentType.MRVA;
1361
+ } else {
1362
+ /* Document-code must start with P. */
1363
+ return DocumentType.TD3;
1364
+ }
1365
+ default:
1366
+ return DocumentType.UNKNOWN;
1367
+ }
1368
+ }
1369
+
1370
+ /*
1371
+ * NOTE: Can be removed once deprecated methods are gone.
1372
+ */
1373
+ /**
1374
+ * Determines the document type based on the document code (the first two characters of the MRZ).
1375
+ *
1376
+ * ICAO Doc 9303 part 3 vol 1 defines MRTDs with 3-line MRZs,
1377
+ * in this case the document code starts with "A", "C", or "I"
1378
+ * according to note j to Section 6.6 (page V-9).
1379
+ *
1380
+ * ICAO Doc 9303 part 2 defines MRVs with 2-line MRZs,
1381
+ * in this case the document code starts with "V".
1382
+ *
1383
+ * ICAO Doc 9303 part 1 vol 1 defines MRPs with 2-line MRZs,
1384
+ * in this case the document code starts with "P"
1385
+ * according to Section 9.6 (page IV-15).
1386
+ *
1387
+ * @param documentCode a two letter code
1388
+ *
1389
+ * @return a document type, one of {@link #DOC_TYPE_ID1}, {@link #DOC_TYPE_ID2},
1390
+ * {@link #DOC_TYPE_ID3}, or {@link #DOC_TYPE_UNSPECIFIED}
1391
+ */
1392
+ private static getDocumentTypeFromDocumentCode(
1393
+ documentCode: string
1394
+ ): DocumentType {
1395
+ if (
1396
+ documentCode.startsWith('A') ||
1397
+ documentCode.startsWith('C') ||
1398
+ documentCode.startsWith('I')
1399
+ ) {
1400
+ /* MRTD according to ICAO Doc 9303 (seventh edition) part 5 or 6. NOTE: Could also be TD2. */
1401
+ return DocumentType.TD1;
1402
+ } else if (documentCode.startsWith('V')) {
1403
+ /* MRV according to ICAO Doc 9303 (old) part 2. NOTE: Could also be MRVA. */
1404
+ return DocumentType.MRVB;
1405
+ } else if (documentCode.startsWith('P')) {
1406
+ /* MRP according to ICAO Doc 9303 (old) part 1 vol 1 */
1407
+ return DocumentType.TD3;
1408
+ }
1409
+ return DocumentType.UNKNOWN;
1410
+ }
1411
+
1412
+ /**
1413
+ * Replaces '<' with ' ' and trims leading and trailing whitespace.
1414
+ *
1415
+ * @param str the string to read from
1416
+ *
1417
+ * @return a trimmed string
1418
+ */
1419
+ private static trimTrailingFillerChars(str: string): string {
1420
+ if (str == null) {
1421
+ return '';
1422
+ }
1423
+ return str.replace(/</g, ' ').trim();
1424
+ }
1425
+
1426
+ /**
1427
+ * Checks if the document-code is consistent with the given document-type.
1428
+ *
1429
+ * @param documentType the document-type
1430
+ * @param documentCode the document-code
1431
+ *
1432
+ * @return a boolean
1433
+ */
1434
+ private static isDocumentCodeConsistentWithDocumentType(
1435
+ documentType: DocumentType,
1436
+ documentCode: string
1437
+ ): boolean {
1438
+ if (documentCode == null) {
1439
+ return false;
1440
+ }
1441
+
1442
+ if (documentCode.length !== 1 && documentCode.length !== 2) {
1443
+ return false;
1444
+ }
1445
+
1446
+ switch (documentType) {
1447
+ case DocumentType.TD1:
1448
+ /* Fall through... */
1449
+ case DocumentType.TD2:
1450
+ return (
1451
+ documentCode.startsWith('C') ||
1452
+ documentCode.startsWith('I') ||
1453
+ documentCode.startsWith('A')
1454
+ );
1455
+ case DocumentType.TD3:
1456
+ return documentCode.startsWith('P');
1457
+ case DocumentType.MRVA:
1458
+ /* Fall through... */
1459
+ case DocumentType.MRVB:
1460
+ return documentCode.startsWith('V');
1461
+ default:
1462
+ return false;
1463
+ }
1464
+ }
1465
+
1466
+ /**
1467
+ * Checks if the optional data is consistent with the given document-type.
1468
+ *
1469
+ * @param documentType the document-type
1470
+ * @param optionalData1 optional data 1 or personal number
1471
+ * @param optionalData2 optional data 2 or {@code null} if not present
1472
+ *
1473
+ * @return a boolean
1474
+ */
1475
+ private static isOptionalDataConsistentWithDocumentType(
1476
+ documentType: DocumentType,
1477
+ optionalData1: string,
1478
+ optionalData2: string | null
1479
+ ): boolean {
1480
+ switch (documentType) {
1481
+ case DocumentType.TD1:
1482
+ return (
1483
+ (optionalData1 == null || optionalData1.length <= 15) &&
1484
+ (optionalData2 == null || optionalData2.length <= 11)
1485
+ );
1486
+ case DocumentType.TD2:
1487
+ return (
1488
+ (optionalData1 == null || optionalData1.length <= 7) &&
1489
+ optionalData2 == null
1490
+ );
1491
+ case DocumentType.MRVB:
1492
+ return (
1493
+ (optionalData1 == null || optionalData1.length <= 8) &&
1494
+ optionalData2 == null
1495
+ );
1496
+ case DocumentType.TD3:
1497
+ return (
1498
+ (optionalData1 == null || optionalData1.length <= 15) &&
1499
+ optionalData2 == null
1500
+ );
1501
+ case DocumentType.MRVA:
1502
+ return (
1503
+ (optionalData1 == null || optionalData1.length <= 16) &&
1504
+ optionalData2 == null
1505
+ );
1506
+ default:
1507
+ return false;
1508
+ }
1509
+ }
1510
+
1511
+ /**
1512
+ * Computes the 7-3-1 check digit for part of the MRZ.
1513
+ * If `preferFillerOverZero` is `true` then '<' will be
1514
+ * returned on check digit 0.
1515
+ *
1516
+ * @param str a part of the MRZ
1517
+ * @param preferFillerOverZero a boolean indicating whether fillers should be preferred
1518
+ *
1519
+ * @return the resulting check digit (in '0' - '9', '<')
1520
+ */
1521
+ public static checkDigit(
1522
+ str: string,
1523
+ preferFillerOverZero: boolean = false
1524
+ ): string {
1525
+ try {
1526
+ const chars: number[] =
1527
+ str == null ? [] : Array.from(str, (char) => char.charCodeAt(0));
1528
+ const weights: number[] = [7, 3, 1];
1529
+ let result: number = 0;
1530
+ for (let i = 0; i < chars.length; i++) {
1531
+ result = (result + weights[i % 3] * this.decodeMRZDigit(chars[i])) % 10;
1532
+ }
1533
+ const checkDigitString: string = result.toString();
1534
+ if (checkDigitString.length !== 1) {
1535
+ throw new Error(
1536
+ 'Error in computing check digit.'
1537
+ ); /* NOTE: Never happens. */
1538
+ }
1539
+ let checkDigit: string = String.fromCharCode(
1540
+ checkDigitString.charCodeAt(0)
1541
+ );
1542
+ if (preferFillerOverZero && checkDigit === '0') {
1543
+ checkDigit = '<';
1544
+ }
1545
+ return checkDigit;
1546
+ } catch (error) {
1547
+ /* NOTE: never happens. */
1548
+ throw new Error('Error in computing check digit');
1549
+ }
1550
+ }
1551
+
1552
+ /**
1553
+ * Looks up the numerical value for MRZ characters. In order to be able
1554
+ * to compute check digits.
1555
+ *
1556
+ * @param ch a character from the MRZ.
1557
+ *
1558
+ * @return the numerical value of the character.
1559
+ *
1560
+ * @throws NumberFormatException if {@code ch} is not a valid MRZ character
1561
+ */
1562
+ private static decodeMRZDigit(ch: number): number {
1563
+ switch (ch) {
1564
+ case '<'.charCodeAt(0):
1565
+ case '0'.charCodeAt(0):
1566
+ return 0;
1567
+ case '1'.charCodeAt(0):
1568
+ return 1;
1569
+ case '2'.charCodeAt(0):
1570
+ return 2;
1571
+ case '3'.charCodeAt(0):
1572
+ return 3;
1573
+ case '4'.charCodeAt(0):
1574
+ return 4;
1575
+ case '5'.charCodeAt(0):
1576
+ return 5;
1577
+ case '6'.charCodeAt(0):
1578
+ return 6;
1579
+ case '7'.charCodeAt(0):
1580
+ return 7;
1581
+ case '8'.charCodeAt(0):
1582
+ return 8;
1583
+ case '9'.charCodeAt(0):
1584
+ return 9;
1585
+ case 'a'.charCodeAt(0):
1586
+ case 'A'.charCodeAt(0):
1587
+ return 10;
1588
+ case 'b'.charCodeAt(0):
1589
+ case 'B'.charCodeAt(0):
1590
+ return 11;
1591
+ case 'c'.charCodeAt(0):
1592
+ case 'C'.charCodeAt(0):
1593
+ return 12;
1594
+ case 'd'.charCodeAt(0):
1595
+ case 'D'.charCodeAt(0):
1596
+ return 13;
1597
+ case 'e'.charCodeAt(0):
1598
+ case 'E'.charCodeAt(0):
1599
+ return 14;
1600
+ case 'f'.charCodeAt(0):
1601
+ case 'F'.charCodeAt(0):
1602
+ return 15;
1603
+ case 'g'.charCodeAt(0):
1604
+ case 'G'.charCodeAt(0):
1605
+ return 16;
1606
+ case 'h'.charCodeAt(0):
1607
+ case 'H'.charCodeAt(0):
1608
+ return 17;
1609
+ case 'i'.charCodeAt(0):
1610
+ case 'I'.charCodeAt(0):
1611
+ return 18;
1612
+ case 'j'.charCodeAt(0):
1613
+ case 'J'.charCodeAt(0):
1614
+ return 19;
1615
+ case 'k'.charCodeAt(0):
1616
+ case 'K'.charCodeAt(0):
1617
+ return 20;
1618
+ case 'l'.charCodeAt(0):
1619
+ case 'L'.charCodeAt(0):
1620
+ return 21;
1621
+ case 'm'.charCodeAt(0):
1622
+ case 'M'.charCodeAt(0):
1623
+ return 22;
1624
+ case 'n'.charCodeAt(0):
1625
+ case 'N'.charCodeAt(0):
1626
+ return 23;
1627
+ case 'o'.charCodeAt(0):
1628
+ case 'O'.charCodeAt(0):
1629
+ return 24;
1630
+ case 'p'.charCodeAt(0):
1631
+ case 'P'.charCodeAt(0):
1632
+ return 25;
1633
+ case 'q'.charCodeAt(0):
1634
+ case 'Q'.charCodeAt(0):
1635
+ return 26;
1636
+ case 'r'.charCodeAt(0):
1637
+ case 'R'.charCodeAt(0):
1638
+ return 27;
1639
+ case 's'.charCodeAt(0):
1640
+ case 'S'.charCodeAt(0):
1641
+ return 28;
1642
+ case 't'.charCodeAt(0):
1643
+ case 'T'.charCodeAt(0):
1644
+ return 29;
1645
+ case 'u'.charCodeAt(0):
1646
+ case 'U'.charCodeAt(0):
1647
+ return 30;
1648
+ case 'v'.charCodeAt(0):
1649
+ case 'V'.charCodeAt(0):
1650
+ return 31;
1651
+ case 'w'.charCodeAt(0):
1652
+ case 'W'.charCodeAt(0):
1653
+ return 32;
1654
+ case 'x'.charCodeAt(0):
1655
+ case 'X'.charCodeAt(0):
1656
+ return 33;
1657
+ case 'y'.charCodeAt(0):
1658
+ case 'Y'.charCodeAt(0):
1659
+ return 34;
1660
+ case 'z'.charCodeAt(0):
1661
+ case 'Z'.charCodeAt(0):
1662
+ return 35;
1663
+ default:
1664
+ throw new Error(
1665
+ `Could not decode MRZ character ${ch} ('${String.fromCharCode(ch)}')`
1666
+ );
1667
+ }
1668
+ }
1669
+ }