@regulaforensics/document-reader 7.1.301-rc

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 (435) hide show
  1. package/README.md +17 -0
  2. package/RNDocumentReader.podspec +21 -0
  3. package/android/CVDDocumentReader.kt +74 -0
  4. package/android/build.gradle +36 -0
  5. package/android/cordova.gradle +12 -0
  6. package/android/src/main/java/com/regula/plugin/documentreader/BluetoothUtil.kt +160 -0
  7. package/android/src/main/java/com/regula/plugin/documentreader/Config.kt +834 -0
  8. package/android/src/main/java/com/regula/plugin/documentreader/JSONConstructor.kt +1795 -0
  9. package/android/src/main/java/com/regula/plugin/documentreader/Main.kt +579 -0
  10. package/android/src/main/java/com/regula/plugin/documentreader/RNDocumentReaderModule.kt +100 -0
  11. package/android/src/main/java/com/regula/plugin/documentreader/Utils.kt +181 -0
  12. package/examples/capacitor/README.md +22 -0
  13. package/examples/capacitor/android/app/build.gradle +50 -0
  14. package/examples/capacitor/android/app/capacitor.build.gradle +22 -0
  15. package/examples/capacitor/android/app/proguard-rules.pro +21 -0
  16. package/examples/capacitor/android/app/src/main/AndroidManifest.xml +27 -0
  17. package/examples/capacitor/android/app/src/main/assets/Regula/.gitkeep +0 -0
  18. package/examples/capacitor/android/app/src/main/java/com/regula/example/dr/capacitor/MainActivity.java +5 -0
  19. package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher.png +0 -0
  20. package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher_foreground.png +0 -0
  21. package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher_round.png +0 -0
  22. package/examples/capacitor/android/app/src/main/res/drawable/launcher.xml +4 -0
  23. package/examples/capacitor/android/app/src/main/res/drawable/launcher_round.xml +4 -0
  24. package/examples/capacitor/android/app/src/main/res/drawable/splash.png +0 -0
  25. package/examples/capacitor/android/app/src/main/res/layout/activity_main.xml +12 -0
  26. package/examples/capacitor/android/app/src/main/res/values/styles.xml +22 -0
  27. package/examples/capacitor/android/build.gradle +30 -0
  28. package/examples/capacitor/android/capacitor.settings.gradle +15 -0
  29. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  30. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  31. package/examples/capacitor/android/gradle.properties +22 -0
  32. package/examples/capacitor/android/gradlew +252 -0
  33. package/examples/capacitor/android/gradlew.bat +94 -0
  34. package/examples/capacitor/android/settings.gradle +5 -0
  35. package/examples/capacitor/android/variables.gradle +16 -0
  36. package/examples/capacitor/index.html +5 -0
  37. package/examples/capacitor/index.tsx +39 -0
  38. package/examples/capacitor/ionic.config.json +7 -0
  39. package/examples/capacitor/ios/App/App/App.entitlements +10 -0
  40. package/examples/capacitor/ios/App/App/AppDelegate.swift +49 -0
  41. package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
  42. package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  43. package/examples/capacitor/ios/App/App/Assets.xcassets/Contents.json +6 -0
  44. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
  45. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
  46. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
  47. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
  48. package/examples/capacitor/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
  49. package/examples/capacitor/ios/App/App/Base.lproj/Main.storyboard +19 -0
  50. package/examples/capacitor/ios/App/App/Info.plist +67 -0
  51. package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +414 -0
  52. package/examples/capacitor/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  53. package/examples/capacitor/ios/App/App.xcworkspace/contents.xcworkspacedata +10 -0
  54. package/examples/capacitor/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  55. package/examples/capacitor/ios/App/Podfile +26 -0
  56. package/examples/capacitor/ios/App/Podfile.lock +56 -0
  57. package/examples/capacitor/package-lock.json +3411 -0
  58. package/examples/capacitor/package.json +27 -0
  59. package/examples/capacitor/public/assets/.gitkeep +0 -0
  60. package/examples/capacitor/public/images/document.png +0 -0
  61. package/examples/capacitor/public/images/portrait.png +0 -0
  62. package/examples/capacitor/scripts/android.sh +9 -0
  63. package/examples/capacitor/scripts/ios.sh +8 -0
  64. package/examples/capacitor/scripts/setup.sh +12 -0
  65. package/examples/capacitor/src/extra/bt_device.tsx +33 -0
  66. package/examples/capacitor/src/extra/custom_rfid.tsx +61 -0
  67. package/examples/capacitor/src/main.css +148 -0
  68. package/examples/capacitor/src/main.html +38 -0
  69. package/examples/capacitor/src/main.tsx +172 -0
  70. package/examples/capacitor/tsconfig.json +5 -0
  71. package/examples/capacitor/vite.config.ts +17 -0
  72. package/examples/ionic/README.md +22 -0
  73. package/examples/ionic/angular.json +39 -0
  74. package/examples/ionic/assets/.gitkeep +0 -0
  75. package/examples/ionic/config.xml +61 -0
  76. package/examples/ionic/images/document.png +0 -0
  77. package/examples/ionic/images/icon.png +0 -0
  78. package/examples/ionic/images/portrait.png +0 -0
  79. package/examples/ionic/index.html +19 -0
  80. package/examples/ionic/index.tsx +54 -0
  81. package/examples/ionic/ionic.config.json +7 -0
  82. package/examples/ionic/package-lock.json +14349 -0
  83. package/examples/ionic/package.json +44 -0
  84. package/examples/ionic/scripts/android.sh +8 -0
  85. package/examples/ionic/scripts/ios.sh +8 -0
  86. package/examples/ionic/scripts/setup.sh +8 -0
  87. package/examples/ionic/src/extra/bt_device.tsx +33 -0
  88. package/examples/ionic/src/extra/custom_rfid.tsx +61 -0
  89. package/examples/ionic/src/main.css +148 -0
  90. package/examples/ionic/src/main.html +38 -0
  91. package/examples/ionic/src/main.tsx +172 -0
  92. package/examples/ionic/tsconfig.json +14 -0
  93. package/examples/react_native/README.md +22 -0
  94. package/examples/react_native/app.config.ts +49 -0
  95. package/examples/react_native/assets/.gitkeep +0 -0
  96. package/examples/react_native/images/document.png +0 -0
  97. package/examples/react_native/images/icon.png +0 -0
  98. package/examples/react_native/images/portrait.png +0 -0
  99. package/examples/react_native/index.html +11 -0
  100. package/examples/react_native/index.tsx +81 -0
  101. package/examples/react_native/metro.config.js +7 -0
  102. package/examples/react_native/package-lock.json +8612 -0
  103. package/examples/react_native/package.json +27 -0
  104. package/examples/react_native/scripts/android.sh +13 -0
  105. package/examples/react_native/scripts/ios.sh +12 -0
  106. package/examples/react_native/scripts/setup.sh +8 -0
  107. package/examples/react_native/src/extra/bt_device.tsx +33 -0
  108. package/examples/react_native/src/extra/custom_rfid.tsx +61 -0
  109. package/examples/react_native/src/main.css +148 -0
  110. package/examples/react_native/src/main.html +38 -0
  111. package/examples/react_native/src/main.tsx +172 -0
  112. package/ios/CVDDocumentReader.h +7 -0
  113. package/ios/CVDDocumentReader.m +39 -0
  114. package/ios/RGLWConfig.h +42 -0
  115. package/ios/RGLWConfig.m +1404 -0
  116. package/ios/RGLWJSONConstructor.h +185 -0
  117. package/ios/RGLWJSONConstructor.m +2379 -0
  118. package/ios/RGLWMain.h +36 -0
  119. package/ios/RGLWMain.m +620 -0
  120. package/ios/RNDocumentReader.h +8 -0
  121. package/ios/RNDocumentReader.m +49 -0
  122. package/package.json +36 -0
  123. package/plugin.xml +50 -0
  124. package/test/json.tsx +868 -0
  125. package/test/package-lock.json +584 -0
  126. package/test/package.json +9 -0
  127. package/test/test.tsx +93 -0
  128. package/test/utils.tsx +38 -0
  129. package/www/capacitor/config/InitConfig.js +52 -0
  130. package/www/capacitor/config/OnlineProcessingConfig.js +52 -0
  131. package/www/capacitor/config/RFIDConfig.js +31 -0
  132. package/www/capacitor/config/RecognizeConfig.js +126 -0
  133. package/www/capacitor/config/ScannerConfig.js +48 -0
  134. package/www/capacitor/index.js +502 -0
  135. package/www/capacitor/info/DocReaderException.js +64 -0
  136. package/www/capacitor/info/DocReaderScenario.js +89 -0
  137. package/www/capacitor/info/DocReaderVersion.js +32 -0
  138. package/www/capacitor/info/DocumentsDatabase.js +39 -0
  139. package/www/capacitor/info/License.js +30 -0
  140. package/www/capacitor/info/PrepareProgress.js +31 -0
  141. package/www/capacitor/info/RFIDException.js +26 -0
  142. package/www/capacitor/internal/bridge.js +98 -0
  143. package/www/capacitor/internal/cordova.js +17 -0
  144. package/www/capacitor/params/Functionality.js +355 -0
  145. package/www/capacitor/params/customization/Customization.js +633 -0
  146. package/www/capacitor/params/customization/CustomizationColors.js +87 -0
  147. package/www/capacitor/params/customization/CustomizationFonts.js +48 -0
  148. package/www/capacitor/params/customization/CustomizationImages.js +31 -0
  149. package/www/capacitor/params/customization/Font.js +36 -0
  150. package/www/capacitor/params/process_params/AuthenticityParams.js +150 -0
  151. package/www/capacitor/params/process_params/BackendProcessingConfig.js +34 -0
  152. package/www/capacitor/params/process_params/FaceApiParams.js +51 -0
  153. package/www/capacitor/params/process_params/FaceApiSearchParams.js +29 -0
  154. package/www/capacitor/params/process_params/GlaresCheckParams.js +25 -0
  155. package/www/capacitor/params/process_params/ImageQA.js +113 -0
  156. package/www/capacitor/params/process_params/LivenessParams.js +79 -0
  157. package/www/capacitor/params/process_params/ProcessParams.js +665 -0
  158. package/www/capacitor/params/process_params/RFIDParams.js +21 -0
  159. package/www/capacitor/params/rfid_scenario/DTCDataGroup.js +63 -0
  160. package/www/capacitor/params/rfid_scenario/EDLDataGroups.js +135 -0
  161. package/www/capacitor/params/rfid_scenario/EIDDataGroups.js +191 -0
  162. package/www/capacitor/params/rfid_scenario/EPassportDataGroups.js +151 -0
  163. package/www/capacitor/params/rfid_scenario/RFIDScenario.js +560 -0
  164. package/www/capacitor/results/DocumentType.js +302 -0
  165. package/www/capacitor/results/Position.js +88 -0
  166. package/www/capacitor/results/Results.js +343 -0
  167. package/www/capacitor/results/TransactionInfo.js +24 -0
  168. package/www/capacitor/results/authenticity/Authenticity.js +23 -0
  169. package/www/capacitor/results/authenticity/AuthenticityCheck.js +43 -0
  170. package/www/capacitor/results/authenticity/AuthenticityElement.js +37 -0
  171. package/www/capacitor/results/authenticity/AuthenticityResult.js +33 -0
  172. package/www/capacitor/results/authenticity/CheckDiagnose.js +125 -0
  173. package/www/capacitor/results/authenticity/SecurityFeatureType.js +59 -0
  174. package/www/capacitor/results/barcode/BarcodeField.js +34 -0
  175. package/www/capacitor/results/barcode/BarcodeResult.js +30 -0
  176. package/www/capacitor/results/barcode/BarcodeStatus.js +33 -0
  177. package/www/capacitor/results/barcode/BarcodeType.js +21 -0
  178. package/www/capacitor/results/barcode/PDF417Info.js +24 -0
  179. package/www/capacitor/results/image_quality/ImageQuality.js +40 -0
  180. package/www/capacitor/results/image_quality/ImageQualityCheckType.js +19 -0
  181. package/www/capacitor/results/image_quality/ImageQualityGroup.js +39 -0
  182. package/www/capacitor/results/rfid/AccessControlProcedureType.js +30 -0
  183. package/www/capacitor/results/rfid/Application.js +59 -0
  184. package/www/capacitor/results/rfid/Attribute.js +23 -0
  185. package/www/capacitor/results/rfid/Authority.js +36 -0
  186. package/www/capacitor/results/rfid/CardProperties.js +57 -0
  187. package/www/capacitor/results/rfid/CertificateChain.js +69 -0
  188. package/www/capacitor/results/rfid/CertificateData.js +21 -0
  189. package/www/capacitor/results/rfid/DataField.js +23 -0
  190. package/www/capacitor/results/rfid/Extension.js +21 -0
  191. package/www/capacitor/results/rfid/File.js +56 -0
  192. package/www/capacitor/results/rfid/FileData.js +27 -0
  193. package/www/capacitor/results/rfid/RFIDAccessControlProcedureType.js +10 -0
  194. package/www/capacitor/results/rfid/RFIDCertificateType.js +13 -0
  195. package/www/capacitor/results/rfid/RFIDDataFileType.js +98 -0
  196. package/www/capacitor/results/rfid/RFIDSessionData.js +92 -0
  197. package/www/capacitor/results/rfid/RFIDValidity.js +23 -0
  198. package/www/capacitor/results/rfid/RFIDValue.js +30 -0
  199. package/www/capacitor/results/rfid/SecurityObject.js +41 -0
  200. package/www/capacitor/results/rfid/SecurityObjectCertificates.js +20 -0
  201. package/www/capacitor/results/rfid/SignerInfo.js +74 -0
  202. package/www/capacitor/results/status/CheckResult.js +5 -0
  203. package/www/capacitor/results/status/OpticalStatus.js +44 -0
  204. package/www/capacitor/results/status/RFIDStatus.js +38 -0
  205. package/www/capacitor/results/status/ResultsStatus.js +40 -0
  206. package/www/capacitor/results/visible_digital_seals/BytesData.js +27 -0
  207. package/www/capacitor/results/visible_digital_seals/LDSParsingErrorCodes.js +134 -0
  208. package/www/capacitor/results/visible_digital_seals/LDSParsingNotificationCodes.js +232 -0
  209. package/www/capacitor/results/visible_digital_seals/VDSNCData.js +54 -0
  210. package/www/capacitor/results/visual_results/Comparison.js +27 -0
  211. package/www/capacitor/results/visual_results/FieldType.js +660 -0
  212. package/www/capacitor/results/visual_results/GraphicField.js +47 -0
  213. package/www/capacitor/results/visual_results/GraphicFieldType.js +25 -0
  214. package/www/capacitor/results/visual_results/GraphicResult.js +28 -0
  215. package/www/capacitor/results/visual_results/LCID.js +174 -0
  216. package/www/capacitor/results/visual_results/Lights.js +11 -0
  217. package/www/capacitor/results/visual_results/RFIDOrigin.js +27 -0
  218. package/www/capacitor/results/visual_results/Rect.js +27 -0
  219. package/www/capacitor/results/visual_results/Symbol.js +26 -0
  220. package/www/capacitor/results/visual_results/TextField.js +85 -0
  221. package/www/capacitor/results/visual_results/TextResult.js +52 -0
  222. package/www/capacitor/results/visual_results/TextSource.js +27 -0
  223. package/www/capacitor/results/visual_results/Validity.js +24 -0
  224. package/www/capacitor/results/visual_results/Value.js +52 -0
  225. package/www/capacitor/rfid/PAAttribute.js +24 -0
  226. package/www/capacitor/rfid/PAResourcesIssuer.js +35 -0
  227. package/www/capacitor/rfid/PKDCertificate.js +62 -0
  228. package/www/capacitor/rfid/RFIDErrorCodes.js +123 -0
  229. package/www/capacitor/rfid/RFIDNotification.js +68 -0
  230. package/www/capacitor/rfid/TAChallenge.js +33 -0
  231. package/www/capacitor/rfid/TccParams.js +34 -0
  232. package/www/cordova.js +11029 -0
  233. package/www/react-native/config/InitConfig.js +52 -0
  234. package/www/react-native/config/OnlineProcessingConfig.js +52 -0
  235. package/www/react-native/config/RFIDConfig.js +31 -0
  236. package/www/react-native/config/RecognizeConfig.js +126 -0
  237. package/www/react-native/config/ScannerConfig.js +48 -0
  238. package/www/react-native/index.js +502 -0
  239. package/www/react-native/info/DocReaderException.js +64 -0
  240. package/www/react-native/info/DocReaderScenario.js +89 -0
  241. package/www/react-native/info/DocReaderVersion.js +32 -0
  242. package/www/react-native/info/DocumentsDatabase.js +39 -0
  243. package/www/react-native/info/License.js +30 -0
  244. package/www/react-native/info/PrepareProgress.js +31 -0
  245. package/www/react-native/info/RFIDException.js +26 -0
  246. package/www/react-native/internal/bridge.js +98 -0
  247. package/www/react-native/params/Functionality.js +355 -0
  248. package/www/react-native/params/customization/Customization.js +633 -0
  249. package/www/react-native/params/customization/CustomizationColors.js +87 -0
  250. package/www/react-native/params/customization/CustomizationFonts.js +48 -0
  251. package/www/react-native/params/customization/CustomizationImages.js +31 -0
  252. package/www/react-native/params/customization/Font.js +36 -0
  253. package/www/react-native/params/process_params/AuthenticityParams.js +150 -0
  254. package/www/react-native/params/process_params/BackendProcessingConfig.js +34 -0
  255. package/www/react-native/params/process_params/FaceApiParams.js +51 -0
  256. package/www/react-native/params/process_params/FaceApiSearchParams.js +29 -0
  257. package/www/react-native/params/process_params/GlaresCheckParams.js +25 -0
  258. package/www/react-native/params/process_params/ImageQA.js +113 -0
  259. package/www/react-native/params/process_params/LivenessParams.js +79 -0
  260. package/www/react-native/params/process_params/ProcessParams.js +665 -0
  261. package/www/react-native/params/process_params/RFIDParams.js +21 -0
  262. package/www/react-native/params/rfid_scenario/DTCDataGroup.js +63 -0
  263. package/www/react-native/params/rfid_scenario/EDLDataGroups.js +135 -0
  264. package/www/react-native/params/rfid_scenario/EIDDataGroups.js +191 -0
  265. package/www/react-native/params/rfid_scenario/EPassportDataGroups.js +151 -0
  266. package/www/react-native/params/rfid_scenario/RFIDScenario.js +560 -0
  267. package/www/react-native/results/DocumentType.js +302 -0
  268. package/www/react-native/results/Position.js +88 -0
  269. package/www/react-native/results/Results.js +343 -0
  270. package/www/react-native/results/TransactionInfo.js +24 -0
  271. package/www/react-native/results/authenticity/Authenticity.js +23 -0
  272. package/www/react-native/results/authenticity/AuthenticityCheck.js +43 -0
  273. package/www/react-native/results/authenticity/AuthenticityElement.js +37 -0
  274. package/www/react-native/results/authenticity/AuthenticityResult.js +33 -0
  275. package/www/react-native/results/authenticity/CheckDiagnose.js +125 -0
  276. package/www/react-native/results/authenticity/SecurityFeatureType.js +59 -0
  277. package/www/react-native/results/barcode/BarcodeField.js +34 -0
  278. package/www/react-native/results/barcode/BarcodeResult.js +30 -0
  279. package/www/react-native/results/barcode/BarcodeStatus.js +33 -0
  280. package/www/react-native/results/barcode/BarcodeType.js +21 -0
  281. package/www/react-native/results/barcode/PDF417Info.js +24 -0
  282. package/www/react-native/results/image_quality/ImageQuality.js +40 -0
  283. package/www/react-native/results/image_quality/ImageQualityCheckType.js +19 -0
  284. package/www/react-native/results/image_quality/ImageQualityGroup.js +39 -0
  285. package/www/react-native/results/rfid/AccessControlProcedureType.js +30 -0
  286. package/www/react-native/results/rfid/Application.js +59 -0
  287. package/www/react-native/results/rfid/Attribute.js +23 -0
  288. package/www/react-native/results/rfid/Authority.js +36 -0
  289. package/www/react-native/results/rfid/CardProperties.js +57 -0
  290. package/www/react-native/results/rfid/CertificateChain.js +69 -0
  291. package/www/react-native/results/rfid/CertificateData.js +21 -0
  292. package/www/react-native/results/rfid/DataField.js +23 -0
  293. package/www/react-native/results/rfid/Extension.js +21 -0
  294. package/www/react-native/results/rfid/File.js +56 -0
  295. package/www/react-native/results/rfid/FileData.js +27 -0
  296. package/www/react-native/results/rfid/RFIDAccessControlProcedureType.js +10 -0
  297. package/www/react-native/results/rfid/RFIDCertificateType.js +13 -0
  298. package/www/react-native/results/rfid/RFIDDataFileType.js +98 -0
  299. package/www/react-native/results/rfid/RFIDSessionData.js +92 -0
  300. package/www/react-native/results/rfid/RFIDValidity.js +23 -0
  301. package/www/react-native/results/rfid/RFIDValue.js +30 -0
  302. package/www/react-native/results/rfid/SecurityObject.js +41 -0
  303. package/www/react-native/results/rfid/SecurityObjectCertificates.js +20 -0
  304. package/www/react-native/results/rfid/SignerInfo.js +74 -0
  305. package/www/react-native/results/status/CheckResult.js +5 -0
  306. package/www/react-native/results/status/OpticalStatus.js +44 -0
  307. package/www/react-native/results/status/RFIDStatus.js +38 -0
  308. package/www/react-native/results/status/ResultsStatus.js +40 -0
  309. package/www/react-native/results/visible_digital_seals/BytesData.js +27 -0
  310. package/www/react-native/results/visible_digital_seals/LDSParsingErrorCodes.js +134 -0
  311. package/www/react-native/results/visible_digital_seals/LDSParsingNotificationCodes.js +232 -0
  312. package/www/react-native/results/visible_digital_seals/VDSNCData.js +54 -0
  313. package/www/react-native/results/visual_results/Comparison.js +27 -0
  314. package/www/react-native/results/visual_results/FieldType.js +660 -0
  315. package/www/react-native/results/visual_results/GraphicField.js +47 -0
  316. package/www/react-native/results/visual_results/GraphicFieldType.js +25 -0
  317. package/www/react-native/results/visual_results/GraphicResult.js +28 -0
  318. package/www/react-native/results/visual_results/LCID.js +174 -0
  319. package/www/react-native/results/visual_results/Lights.js +11 -0
  320. package/www/react-native/results/visual_results/RFIDOrigin.js +27 -0
  321. package/www/react-native/results/visual_results/Rect.js +27 -0
  322. package/www/react-native/results/visual_results/Symbol.js +26 -0
  323. package/www/react-native/results/visual_results/TextField.js +85 -0
  324. package/www/react-native/results/visual_results/TextResult.js +52 -0
  325. package/www/react-native/results/visual_results/TextSource.js +27 -0
  326. package/www/react-native/results/visual_results/Validity.js +24 -0
  327. package/www/react-native/results/visual_results/Value.js +52 -0
  328. package/www/react-native/rfid/PAAttribute.js +24 -0
  329. package/www/react-native/rfid/PAResourcesIssuer.js +35 -0
  330. package/www/react-native/rfid/PKDCertificate.js +62 -0
  331. package/www/react-native/rfid/RFIDErrorCodes.js +123 -0
  332. package/www/react-native/rfid/RFIDNotification.js +68 -0
  333. package/www/react-native/rfid/TAChallenge.js +33 -0
  334. package/www/react-native/rfid/TccParams.js +34 -0
  335. package/www/types/config/InitConfig.d.ts +63 -0
  336. package/www/types/config/OnlineProcessingConfig.d.ts +22 -0
  337. package/www/types/config/RFIDConfig.d.ts +131 -0
  338. package/www/types/config/RecognizeConfig.d.ts +119 -0
  339. package/www/types/config/ScannerConfig.d.ts +54 -0
  340. package/www/types/index.d.ts +427 -0
  341. package/www/types/info/DocReaderException.d.ts +79 -0
  342. package/www/types/info/DocReaderScenario.d.ts +90 -0
  343. package/www/types/info/DocReaderVersion.d.ts +28 -0
  344. package/www/types/info/DocumentsDatabase.d.ts +42 -0
  345. package/www/types/info/License.d.ts +23 -0
  346. package/www/types/info/PrepareProgress.d.ts +15 -0
  347. package/www/types/info/RFIDException.d.ts +8 -0
  348. package/www/types/params/Functionality.d.ts +320 -0
  349. package/www/types/params/customization/Customization.d.ts +563 -0
  350. package/www/types/params/customization/CustomizationColors.d.ts +16 -0
  351. package/www/types/params/customization/CustomizationFonts.d.ts +13 -0
  352. package/www/types/params/customization/CustomizationImages.d.ts +12 -0
  353. package/www/types/params/customization/Font.d.ts +36 -0
  354. package/www/types/params/process_params/AuthenticityParams.d.ts +30 -0
  355. package/www/types/params/process_params/BackendProcessingConfig.d.ts +25 -0
  356. package/www/types/params/process_params/FaceApiParams.d.ts +68 -0
  357. package/www/types/params/process_params/FaceApiSearchParams.d.ts +35 -0
  358. package/www/types/params/process_params/GlaresCheckParams.d.ts +26 -0
  359. package/www/types/params/process_params/ImageQA.d.ts +79 -0
  360. package/www/types/params/process_params/LivenessParams.d.ts +20 -0
  361. package/www/types/params/process_params/ProcessParams.d.ts +473 -0
  362. package/www/types/params/process_params/RFIDParams.d.ts +19 -0
  363. package/www/types/params/rfid_scenario/DTCDataGroup.d.ts +13 -0
  364. package/www/types/params/rfid_scenario/EDLDataGroups.d.ts +22 -0
  365. package/www/types/params/rfid_scenario/EIDDataGroups.d.ts +29 -0
  366. package/www/types/params/rfid_scenario/EPassportDataGroups.d.ts +24 -0
  367. package/www/types/params/rfid_scenario/RFIDScenario.d.ts +167 -0
  368. package/www/types/results/DocumentType.d.ts +525 -0
  369. package/www/types/results/Position.d.ts +50 -0
  370. package/www/types/results/Results.d.ts +283 -0
  371. package/www/types/results/TransactionInfo.d.ts +9 -0
  372. package/www/types/results/authenticity/Authenticity.d.ts +67 -0
  373. package/www/types/results/authenticity/AuthenticityCheck.d.ts +23 -0
  374. package/www/types/results/authenticity/AuthenticityElement.d.ts +26 -0
  375. package/www/types/results/authenticity/AuthenticityResult.d.ts +16 -0
  376. package/www/types/results/authenticity/CheckDiagnose.d.ts +231 -0
  377. package/www/types/results/authenticity/SecurityFeatureType.d.ts +100 -0
  378. package/www/types/results/barcode/BarcodeField.d.ts +37 -0
  379. package/www/types/results/barcode/BarcodeResult.d.ts +14 -0
  380. package/www/types/results/barcode/BarcodeStatus.d.ts +66 -0
  381. package/www/types/results/barcode/BarcodeType.d.ts +45 -0
  382. package/www/types/results/barcode/PDF417Info.d.ts +15 -0
  383. package/www/types/results/image_quality/ImageQuality.d.ts +18 -0
  384. package/www/types/results/image_quality/ImageQualityCheckType.d.ts +30 -0
  385. package/www/types/results/image_quality/ImageQualityGroup.d.ts +17 -0
  386. package/www/types/results/rfid/AccessControlProcedureType.d.ts +21 -0
  387. package/www/types/results/rfid/Application.d.ts +44 -0
  388. package/www/types/results/rfid/Attribute.d.ts +9 -0
  389. package/www/types/results/rfid/Authority.d.ts +11 -0
  390. package/www/types/results/rfid/CardProperties.d.ts +48 -0
  391. package/www/types/results/rfid/CertificateChain.d.ts +28 -0
  392. package/www/types/results/rfid/CertificateData.d.ts +7 -0
  393. package/www/types/results/rfid/DataField.d.ts +9 -0
  394. package/www/types/results/rfid/Extension.d.ts +7 -0
  395. package/www/types/results/rfid/File.d.ts +22 -0
  396. package/www/types/results/rfid/FileData.d.ts +9 -0
  397. package/www/types/results/rfid/RFIDAccessControlProcedureType.d.ts +18 -0
  398. package/www/types/results/rfid/RFIDCertificateType.d.ts +13 -0
  399. package/www/types/results/rfid/RFIDDataFileType.d.ts +101 -0
  400. package/www/types/results/rfid/RFIDSessionData.d.ts +48 -0
  401. package/www/types/results/rfid/RFIDValidity.d.ts +9 -0
  402. package/www/types/results/rfid/RFIDValue.d.ts +10 -0
  403. package/www/types/results/rfid/SecurityObject.d.ts +28 -0
  404. package/www/types/results/rfid/SecurityObjectCertificates.d.ts +8 -0
  405. package/www/types/results/rfid/SignerInfo.d.ts +41 -0
  406. package/www/types/results/status/CheckResult.d.ts +8 -0
  407. package/www/types/results/status/OpticalStatus.d.ts +29 -0
  408. package/www/types/results/status/RFIDStatus.d.ts +22 -0
  409. package/www/types/results/status/ResultsStatus.d.ts +24 -0
  410. package/www/types/results/visible_digital_seals/BytesData.d.ts +9 -0
  411. package/www/types/results/visible_digital_seals/LDSParsingErrorCodes.d.ts +132 -0
  412. package/www/types/results/visible_digital_seals/LDSParsingNotificationCodes.d.ts +230 -0
  413. package/www/types/results/visible_digital_seals/VDSNCData.d.ts +35 -0
  414. package/www/types/results/visual_results/Comparison.d.ts +15 -0
  415. package/www/types/results/visual_results/FieldType.d.ts +1314 -0
  416. package/www/types/results/visual_results/GraphicField.d.ts +29 -0
  417. package/www/types/results/visual_results/GraphicFieldType.d.ts +52 -0
  418. package/www/types/results/visual_results/GraphicResult.d.ts +10 -0
  419. package/www/types/results/visual_results/LCID.d.ts +173 -0
  420. package/www/types/results/visual_results/Lights.d.ts +23 -0
  421. package/www/types/results/visual_results/RFIDOrigin.d.ts +10 -0
  422. package/www/types/results/visual_results/Rect.d.ts +9 -0
  423. package/www/types/results/visual_results/Symbol.d.ts +14 -0
  424. package/www/types/results/visual_results/TextField.d.ts +40 -0
  425. package/www/types/results/visual_results/TextResult.d.ts +23 -0
  426. package/www/types/results/visual_results/TextSource.d.ts +15 -0
  427. package/www/types/results/visual_results/Validity.d.ts +13 -0
  428. package/www/types/results/visual_results/Value.d.ts +27 -0
  429. package/www/types/rfid/PAAttribute.d.ts +4 -0
  430. package/www/types/rfid/PAResourcesIssuer.d.ts +7 -0
  431. package/www/types/rfid/PKDCertificate.d.ts +34 -0
  432. package/www/types/rfid/RFIDErrorCodes.d.ts +121 -0
  433. package/www/types/rfid/RFIDNotification.d.ts +153 -0
  434. package/www/types/rfid/TAChallenge.d.ts +7 -0
  435. package/www/types/rfid/TccParams.d.ts +25 -0
@@ -0,0 +1,834 @@
1
+ @file:Suppress("EnumValuesSoftDeprecate", "DEPRECATION")
2
+
3
+ package com.regula.plugin.documentreader
4
+
5
+ import android.graphics.Paint
6
+ import android.graphics.Typeface
7
+ import android.graphics.drawable.Drawable
8
+ import android.text.SpannableString
9
+ import android.widget.ImageView
10
+ import androidx.core.content.ContextCompat
11
+ import com.regula.documentreader.api.enums.CustomizationColor
12
+ import com.regula.documentreader.api.enums.CustomizationFont
13
+ import com.regula.documentreader.api.enums.CustomizationImage
14
+ import com.regula.documentreader.api.enums.LogLevel
15
+ import com.regula.documentreader.api.params.AuthenticityParams
16
+ import com.regula.documentreader.api.params.Functionality
17
+ import com.regula.documentreader.api.params.ImageQA
18
+ import com.regula.documentreader.api.params.LivenessParams
19
+ import com.regula.documentreader.api.params.ParamsCustomization
20
+ import com.regula.documentreader.api.params.ProcessParam
21
+ import com.regula.documentreader.api.params.RfidScenario
22
+ import com.regula.documentreader.api.params.rfid.dg.DTCDataGroup
23
+ import com.regula.documentreader.api.params.rfid.dg.DataGroups
24
+ import com.regula.documentreader.api.params.rfid.dg.EIDDataGroups
25
+ import com.regula.documentreader.api.params.rfid.dg.EPassportDataGroups
26
+ import com.regula.plugin.documentreader.Convert.toBase64
27
+ import com.regula.plugin.documentreader.Convert.toDrawable
28
+ import org.json.JSONArray
29
+ import org.json.JSONObject
30
+
31
+ fun setFunctionality(config: Functionality, input: JSONObject) = input.forEach { k, v ->
32
+ val editor = config.edit()
33
+ when (k) {
34
+ "pictureOnBoundsReady" -> editor.setPictureOnBoundsReady(v as Boolean)
35
+ "showTorchButton" -> editor.setShowTorchButton(v as Boolean)
36
+ "showCloseButton" -> editor.setShowCloseButton(v as Boolean)
37
+ "videoCaptureMotionControl" -> editor.setVideoCaptureMotionControl(v as Boolean)
38
+ "showCaptureButton" -> editor.setShowCaptureButton(v as Boolean)
39
+ "showChangeFrameButton" -> editor.setShowChangeFrameButton(v as Boolean)
40
+ "showSkipNextPageButton" -> editor.setShowSkipNextPageButton(v as Boolean)
41
+ "useAuthenticator" -> editor.setUseAuthenticator(v as Boolean)
42
+ "skipFocusingFrames" -> editor.setSkipFocusingFrames(v as Boolean)
43
+ "showCameraSwitchButton" -> editor.setShowCameraSwitchButton(v as Boolean)
44
+ "displayMetadata" -> editor.setDisplayMetadata(v as Boolean)
45
+ "isZoomEnabled" -> editor.setZoomEnabled(v as Boolean)
46
+ "isCameraTorchCheckDisabled" -> editor.setIsCameraTorchCheckDisabled(v as Boolean)
47
+ "recordScanningProcess" -> editor.setDoRecordProcessingVideo(v as Boolean)
48
+ "manualMultipageMode" -> editor.setManualMultipageMode(v as Boolean)
49
+ "torchTurnedOn" -> editor.setTorchTurnedOn(v as Boolean)
50
+ "showCaptureButtonDelayFromDetect" -> editor.setShowCaptureButtonDelayFromDetect(v.toLong())
51
+ "showCaptureButtonDelayFromStart" -> editor.setShowCaptureButtonDelayFromStart(v.toLong())
52
+ "orientation" -> editor.setOrientation(v.toInt())
53
+ "captureMode" -> editor.setCaptureMode(v.toInt())
54
+ "cameraMode" -> editor.setCameraMode(v.toInt())
55
+ "rfidTimeout" -> editor.setRfidTimeout(v.toInt())
56
+ "forcePagesCount" -> editor.setForcePagesCount(v.toInt())
57
+ "cameraFrame" -> editor.setCameraFrame(v as String)
58
+ "btDeviceName" -> editor.setBtDeviceName(v as String)
59
+ "zoomFactor" -> editor.setZoomFactor(v.toFloat())
60
+ "exposure" -> editor.setExposure(v.toFloat())
61
+ "videoRecordingSizeDownscaleFactor" -> editor.setVideoRecordingSizeDownscaleFactor(v.toFloat())
62
+ "excludedCamera2Models" -> editor.setExcludedCamera2Models((v as JSONArray).toList())
63
+ "cameraSize" -> editor.setCameraSize(cameraSizeFromJSON(v as JSONObject).first, cameraSizeFromJSON(v).second)
64
+ }
65
+ editor.apply()
66
+ }
67
+
68
+ fun getFunctionality(input: Functionality) = mapOf(
69
+ "pictureOnBoundsReady" to input.isPictureOnBoundsReady,
70
+ "showTorchButton" to input.isShowTorchButton,
71
+ "showCloseButton" to input.isShowCloseButton,
72
+ "videoCaptureMotionControl" to input.isVideoCaptureMotionControl,
73
+ "showCaptureButton" to input.isShowCaptureButton,
74
+ "showChangeFrameButton" to input.isShowChangeFrameButton,
75
+ "showSkipNextPageButton" to input.isShowSkipNextPageButton,
76
+ "useAuthenticator" to input.isUseAuthenticator,
77
+ "skipFocusingFrames" to input.isSkipFocusingFrames,
78
+ "showCameraSwitchButton" to input.isShowCameraSwitchButton,
79
+ "displayMetadata" to input.isDisplayMetaData,
80
+ "isZoomEnabled" to input.isZoomEnabled,
81
+ "isCameraTorchCheckDisabled" to input.isCameraTorchCheckDisabled,
82
+ "recordScanningProcess" to input.doRecordProcessingVideo(),
83
+ "manualMultipageMode" to input.isManualMultipageMode,
84
+ "torchTurnedOn" to input.isTorchTurnedOn,
85
+ "showCaptureButtonDelayFromDetect" to input.showCaptureButtonDelayFromDetect,
86
+ "showCaptureButtonDelayFromStart" to input.showCaptureButtonDelayFromStart,
87
+ "orientation" to input.orientation,
88
+ "captureMode" to input.captureMode,
89
+ "cameraMode" to input.cameraMode,
90
+ "rfidTimeout" to input.rfidTimeout,
91
+ "forcePagesCount" to input.forcePagesCount,
92
+ "cameraFrame" to input.cameraFrame,
93
+ "btDeviceName" to input.btDeviceName,
94
+ "zoomFactor" to input.zoomFactor,
95
+ "exposure" to input.exposure,
96
+ "videoRecordingSizeDownscaleFactor" to input.videoRecordingSizeDownscaleFactor,
97
+ "excludedCamera2Models" to input.excludedCamera2Models.toJson(),
98
+ "cameraSize" to generateCameraSize(input.cameraWidth, input.cameraHeight)
99
+ ).toJson()
100
+
101
+ @Suppress("DEPRECATION")
102
+ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEach { k, v ->
103
+ when (k) {
104
+ "multipageProcessing" -> processParams.multipageProcessing = v as Boolean
105
+ "logs" -> processParams.setLogs(v as Boolean)
106
+ "debugSaveImages" -> processParams.debugSaveImages = v as Boolean
107
+ "debugSaveLogs" -> processParams.debugSaveLogs = v as Boolean
108
+ "returnUncroppedImage" -> processParams.returnUncroppedImage = v as Boolean
109
+ "uvTorchEnabled" -> processParams.uvTorchEnabled = v as Boolean
110
+ "debugSaveCroppedImages" -> processParams.debugSaveCroppedImages = v as Boolean
111
+ "disableFocusingCheck" -> processParams.disableFocusingCheck = v as Boolean
112
+ "debugSaveRFIDSession" -> processParams.debugSaveRFIDSession = v as Boolean
113
+ "doublePageSpread" -> processParams.doublePageSpread = v as Boolean
114
+ "manualCrop" -> processParams.manualCrop = v as Boolean
115
+ "integralImage" -> processParams.integralImage = v as Boolean
116
+ "returnCroppedBarcode" -> processParams.returnCroppedBarcode = v as Boolean
117
+ "checkRequiredTextFields" -> processParams.checkRequiredTextFields = v as Boolean
118
+ "depersonalizeLog" -> processParams.depersonalizeLog = v as Boolean
119
+ "generateDoublePageSpreadImage" -> processParams.generateDoublePageSpreadImage = v as Boolean
120
+ "alreadyCropped" -> processParams.alreadyCropped = v as Boolean
121
+ "matchTextFieldMask" -> processParams.matchTextFieldMask = v as Boolean
122
+ "updateOCRValidityByGlare" -> processParams.updateOCRValidityByGlare = v as Boolean
123
+ "noGraphics" -> processParams.noGraphics = v as Boolean
124
+ "multiDocOnImage" -> processParams.multiDocOnImage = v as Boolean
125
+ "forceReadMrzBeforeLocate" -> processParams.forceReadMrzBeforeLocate = v as Boolean
126
+ "parseBarcodes" -> processParams.parseBarcodes = v as Boolean
127
+ "shouldReturnPackageForReprocess" -> processParams.shouldReturnPackageForReprocess = v as Boolean
128
+ "disablePerforationOCR" -> processParams.disablePerforationOCR = v as Boolean
129
+ "respectImageQuality" -> processParams.respectImageQuality = v as Boolean
130
+ "strictImageQuality" -> processParams.strictImageQuality = v as Boolean
131
+ "splitNames" -> processParams.splitNames = v as Boolean
132
+ "doDetectCan" -> processParams.doDetectCan = v as Boolean
133
+ "useFaceApi" -> processParams.useFaceApi = v as Boolean
134
+ "useAuthenticityCheck" -> processParams.useAuthenticityCheck = v as Boolean
135
+ "checkHologram" -> processParams.checkHologram = v as Boolean
136
+ "generateNumericCodes" -> processParams.generateNumericCodes = v as Boolean
137
+ "strictBarcodeDigitalSignatureCheck" -> processParams.strictBarcodeDigitalSignatureCheck = v as Boolean
138
+ "selectLongestNames" -> processParams.selectLongestNames = v as Boolean
139
+ "generateDTCVC" -> processParams.generateDTCVC = v as Boolean
140
+ "strictDLCategoryExpiry" -> processParams.strictDLCategoryExpiry = v as Boolean
141
+ "generateAlpha2Codes" -> processParams.generateAlpha2Codes = v as Boolean
142
+ "disableAuthResolutionFilter" -> processParams.disableAuthResolutionFilter = v as Boolean
143
+ "strictSecurityChecks" -> processParams.strictSecurityChecks = v as Boolean
144
+ "measureSystem" -> processParams.measureSystem = v.toInt()
145
+ "barcodeParserType" -> processParams.barcodeParserType = v.toInt()
146
+ "perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
147
+ "minDPI" -> processParams.minDPI = v.toInt()
148
+ "imageDpiOutMax" -> processParams.imageDpiOutMax = v.toInt()
149
+ "forceDocID" -> processParams.forceDocID = v.toInt()
150
+ "forceDocFormat" -> processParams.forceDocFormat = v.toInt()
151
+ "shiftExpiryDate" -> processParams.shiftExpiryDate = v.toInt()
152
+ "minimalHolderAge" -> processParams.minimalHolderAge = v.toInt()
153
+ "imageOutputMaxHeight" -> processParams.imageOutputMaxHeight = v.toInt()
154
+ "imageOutputMaxWidth" -> processParams.imageOutputMaxWidth = v.toInt()
155
+ "processAuth" -> processParams.processAuth = v.toInt()
156
+ "convertCase" -> processParams.convertCase = v.toInt()
157
+ "logLevel" -> processParams.logLevel = LogLevel.valueOf(v.toString())
158
+ "mrzDetectMode" -> processParams.mrzDetectMode = v.toInt()
159
+ "pdfPagesLimit" -> processParams.pdfPagesLimit = v.toInt()
160
+ "dateFormat" -> processParams.dateFormat = v as String
161
+ "scenario" -> processParams.scenario = v as String
162
+ "captureButtonScenario" -> processParams.captureButtonScenario = v as String
163
+ "timeout" -> processParams.timeout = v.toDouble()
164
+ "timeoutFromFirstDetect" -> processParams.timeoutFromFirstDetect = v.toDouble()
165
+ "timeoutFromFirstDocType" -> processParams.timeoutFromFirstDocType = v.toDouble()
166
+ "documentAreaMin" -> processParams.documentAreaMin = v.toDouble()
167
+ "timeoutLiveness" -> processParams.timeoutLiveness = v.toDouble()
168
+ "documentIDList" -> processParams.documentIDList = v.toIntArray()
169
+ "fieldTypesFilter" -> processParams.fieldTypesFilter = v.toIntArray()
170
+ "resultTypeOutput" -> processParams.resultTypeOutput = v.toIntArray()
171
+ "documentGroupFilter" -> processParams.documentGroupFilter = v.toIntArray()
172
+ "lcidIgnoreFilter" -> processParams.lcidIgnoreFilter = v.toIntArray()
173
+ "lcidFilter" -> processParams.lcidFilter = v.toIntArray()
174
+ "barcodeTypes" -> processParams.doBarcodes = barcodeTypeArrayFromJson(v as JSONArray)
175
+ "mrzFormatsFilter" -> processParams.mrzFormatsFilter = (v as JSONArray).toArray()
176
+ "customParams" -> processParams.customParams = v as JSONObject
177
+ "imageQA" -> setImageQA(processParams.imageQA, v as JSONObject)
178
+ "rfidParams" -> processParams.rfidParams = rfidParamsFromJSON(v as JSONObject)
179
+ "faceApiParams" -> processParams.faceApiParams = faceApiParamsFromJSON(v as JSONObject)
180
+ "backendProcessingConfig" -> processParams.backendProcessingConfig = backendProcessingConfigFromJSON(v as JSONObject)
181
+ "authenticityParams" -> {
182
+ if (processParams.authenticityParams == null) processParams.authenticityParams = AuthenticityParams.defaultParams()
183
+ setAuthenticityParams(processParams.authenticityParams!!, v as JSONObject)
184
+ }
185
+ }
186
+ }
187
+
188
+ @Suppress("DEPRECATION")
189
+ fun getProcessParams(processParams: ProcessParam) = mapOf(
190
+ "multipageProcessing" to processParams.multipageProcessing,
191
+ "logs" to processParams.isLogEnable,
192
+ "debugSaveImages" to processParams.debugSaveImages,
193
+ "debugSaveLogs" to processParams.debugSaveLogs,
194
+ "returnUncroppedImage" to processParams.returnUncroppedImage,
195
+ "uvTorchEnabled" to processParams.uvTorchEnabled,
196
+ "debugSaveCroppedImages" to processParams.debugSaveCroppedImages,
197
+ "disableFocusingCheck" to processParams.disableFocusingCheck,
198
+ "debugSaveRFIDSession" to processParams.debugSaveRFIDSession,
199
+ "doublePageSpread" to processParams.doublePageSpread,
200
+ "manualCrop" to processParams.manualCrop,
201
+ "integralImage" to processParams.integralImage,
202
+ "returnCroppedBarcode" to processParams.returnCroppedBarcode,
203
+ "checkRequiredTextFields" to processParams.checkRequiredTextFields,
204
+ "depersonalizeLog" to processParams.depersonalizeLog,
205
+ "generateDoublePageSpreadImage" to processParams.generateDoublePageSpreadImage,
206
+ "alreadyCropped" to processParams.alreadyCropped,
207
+ "matchTextFieldMask" to processParams.matchTextFieldMask,
208
+ "updateOCRValidityByGlare" to processParams.updateOCRValidityByGlare,
209
+ "noGraphics" to processParams.noGraphics,
210
+ "multiDocOnImage" to processParams.multiDocOnImage,
211
+ "forceReadMrzBeforeLocate" to processParams.forceReadMrzBeforeLocate,
212
+ "parseBarcodes" to processParams.parseBarcodes,
213
+ "shouldReturnPackageForReprocess" to processParams.shouldReturnPackageForReprocess,
214
+ "disablePerforationOCR" to processParams.disablePerforationOCR,
215
+ "respectImageQuality" to processParams.respectImageQuality,
216
+ "strictImageQuality" to processParams.strictImageQuality,
217
+ "splitNames" to processParams.splitNames,
218
+ "doDetectCan" to processParams.doDetectCan,
219
+ "useFaceApi" to processParams.useFaceApi,
220
+ "useAuthenticityCheck" to processParams.useAuthenticityCheck,
221
+ "checkHologram" to processParams.checkHologram,
222
+ "generateNumericCodes" to processParams.generateNumericCodes,
223
+ "strictBarcodeDigitalSignatureCheck" to processParams.strictBarcodeDigitalSignatureCheck,
224
+ "selectLongestNames" to processParams.selectLongestNames,
225
+ "generateDTCVC" to processParams.generateDTCVC,
226
+ "strictDLCategoryExpiry" to processParams.strictDLCategoryExpiry,
227
+ "generateAlpha2Codes" to processParams.generateAlpha2Codes,
228
+ "disableAuthResolutionFilter" to processParams.disableAuthResolutionFilter,
229
+ "strictSecurityChecks" to processParams.strictSecurityChecks,
230
+ "measureSystem" to processParams.measureSystem,
231
+ "barcodeParserType" to processParams.barcodeParserType,
232
+ "perspectiveAngle" to processParams.perspectiveAngle,
233
+ "minDPI" to processParams.minDPI,
234
+ "imageDpiOutMax" to processParams.imageDpiOutMax,
235
+ "forceDocID" to processParams.forceDocID,
236
+ "forceDocFormat" to processParams.forceDocFormat,
237
+ "shiftExpiryDate" to processParams.shiftExpiryDate,
238
+ "minimalHolderAge" to processParams.minimalHolderAge,
239
+ "imageOutputMaxHeight" to processParams.imageOutputMaxHeight,
240
+ "imageOutputMaxWidth" to processParams.imageOutputMaxWidth,
241
+ "processAuth" to processParams.processAuth,
242
+ "convertCase" to processParams.convertCase,
243
+ "logLevel" to processParams.logLevel?.toString(),
244
+ "mrzDetectMode" to processParams.mrzDetectMode,
245
+ "pdfPagesLimit" to processParams.pdfPagesLimit,
246
+ "dateFormat" to processParams.dateFormat,
247
+ "scenario" to processParams.scenario,
248
+ "captureButtonScenario" to processParams.captureButtonScenario,
249
+ "timeout" to processParams.timeout,
250
+ "timeoutFromFirstDetect" to processParams.timeoutFromFirstDetect,
251
+ "timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
252
+ "documentAreaMin" to processParams.documentAreaMin,
253
+ "timeoutLiveness" to processParams.timeoutLiveness,
254
+ "documentIDList" to processParams.documentIDList.toJson(),
255
+ "fieldTypesFilter" to processParams.fieldTypesFilter.toJson(),
256
+ "documentGroupFilter" to processParams.documentGroupFilter.toJson(),
257
+ "lcidIgnoreFilter" to processParams.lcidIgnoreFilter.toJson(),
258
+ "lcidFilter" to processParams.lcidFilter.toJson(),
259
+ "resultTypeOutput" to processParams.resultTypeOutput.toJson(),
260
+ "mrzFormatsFilter" to processParams.mrzFormatsFilter.toJson(),
261
+ "barcodeTypes" to generateBarcodeTypeArray(processParams.doBarcodes),
262
+ "imageQA" to getImageQA(processParams.imageQA),
263
+ "rfidParams" to generateRFIDParams(processParams.rfidParams),
264
+ "faceApiParams" to generateFaceApiParams(processParams.faceApiParams),
265
+ "backendProcessingConfig" to generateBackendProcessingConfig(processParams.backendProcessingConfig),
266
+ "authenticityParams" to getAuthenticityParams(processParams.authenticityParams),
267
+ "customParams" to processParams.customParams,
268
+ ).toJson()
269
+
270
+ fun setCustomization(customization: ParamsCustomization, opts: JSONObject) = opts.forEach { k, v ->
271
+ val editor = customization.edit()
272
+ when (k) {
273
+ "showStatusMessages" -> editor.setShowStatusMessages(v as Boolean)
274
+ "showResultStatusMessages" -> editor.setShowResultStatusMessages(v as Boolean)
275
+ "showHelpAnimation" -> editor.setShowHelpAnimation(v as Boolean)
276
+ "showNextPageAnimation" -> editor.setShowNextPageAnimation(v as Boolean)
277
+ "showBackgroundMask" -> editor.setShowBackgroundMask(v as Boolean)
278
+ "cameraFrameBorderWidth" -> editor.setCameraFrameBorderWidth(v.toInt())
279
+ "cameraFrameLineLength" -> editor.setCameraFrameLineLength(v.toInt())
280
+ "cameraFrameShapeType" -> editor.setCameraFrameShapeType(v.toInt())
281
+ "cameraFrameOffsetWidth" -> editor.setCameraFrameOffsetWidth(v.toInt())
282
+ "activityIndicatorSize" -> editor.setActivityIndicatorSize(v.toInt())
283
+ "status" -> editor.setStatus(v as String)
284
+ "resultStatus" -> editor.setResultStatus(v as String)
285
+ "multipageButtonText" -> editor.setMultipageButtonText(v as String)
286
+ "cameraFrameDefaultColor" -> editor.setCameraFrameDefaultColor(v.toColor())
287
+ "cameraFrameActiveColor" -> editor.setCameraFrameActiveColor(v.toColor())
288
+ "statusTextColor" -> editor.setStatusTextColor(v.toColor())
289
+ "resultStatusTextColor" -> editor.setResultStatusTextColor(v.toColor())
290
+ "resultStatusBackgroundColor" -> editor.setResultStatusBackgroundColor(v.toColor())
291
+ "multipageButtonBackgroundColor" -> editor.setMultipageButtonBackgroundColor(v.toColor())
292
+ "tintColor" -> editor.setTintColor(v.toColor())
293
+ "activityIndicatorColor" -> editor.setActivityIndicatorColor(v.toColor())
294
+ "statusBackgroundColor" -> editor.setStatusBackgroundColor(v.toColor())
295
+ "cameraPreviewBackgroundColor" -> editor.setCameraPreviewBackgroundColor(v.toColor())
296
+ "backgroundMaskColor" -> editor.setBackgroundMaskColor(v.toColor())
297
+ "multipageButtonTextColor" -> editor.setMultipageButtonTextColor(v.toColor())
298
+ "statusPositionMultiplier" -> editor.setStatusPositionMultiplier(v.toFloat())
299
+ "resultStatusPositionMultiplier" -> editor.setResultStatusPositionMultiplier(v.toFloat())
300
+ "toolbarSize" -> editor.setToolbarSize(v.toFloat())
301
+ "backgroundMaskAlpha" -> editor.setBackgroundMaskAlpha(v.toFloat())
302
+ "customStatusPositionMultiplier" -> editor.setCustomStatusPositionMultiplier(v.toFloat())
303
+ "cameraFrameVerticalPositionMultiplier" -> editor.setCameraFrameVerticalPositionMultiplier(v.toFloat())
304
+ "cameraFrameLandscapeAspectRatio" -> editor.setCameraFrameLandscapeAspectRatio(v.toFloat())
305
+ "cameraFramePortraitAspectRatio" -> editor.setCameraFramePortraitAspectRatio(v.toFloat())
306
+ "cameraFrameCornerRadius" -> editor.setCameraFrameCornerRadius(v.toFloat())
307
+ "livenessAnimationPositionMultiplier" -> editor.setLivenessAnimationPositionMultiplier(v.toFloat())
308
+ "nextPageAnimationStartDelay" -> editor.setNextPageAnimationStartDelay(v.toFloat())
309
+ "nextPageAnimationEndDelay" -> editor.setNextPageAnimationEndDelay(v.toFloat())
310
+ "activityIndicatorPortraitPositionMultiplier" -> editor.setActivityIndicatorPortraitPositionMultiplier(v.toFloat())
311
+ "activityIndicatorLandscapePositionMultiplier" -> editor.setActivityIndicatorLandscapePositionMultiplier(v.toFloat())
312
+ "cameraPreviewVerticalPositionMultiplier" -> editor.setCameraPreviewVerticalPositionMultiplier(v.toFloat())
313
+ "multipageAnimationFrontImage" -> editor.setMultipageAnimationFrontImage(v.toDrawable())
314
+ "multipageAnimationBackImage" -> editor.setMultipageAnimationBackImage(v.toDrawable())
315
+ "borderBackgroundImage" -> editor.setBorderBackgroundImage(v.toDrawable())
316
+ "helpAnimationImage" -> editor.setHelpAnimationImage(v.toDrawable())
317
+ "closeButtonImage" -> editor.setCloseButtonImage(v.toDrawable())
318
+ "captureButtonImage" -> editor.setCaptureButtonImage(v.toDrawable())
319
+ "changeFrameButtonCollapseImage" -> editor.setChangeFrameCollapseButtonImage(v.toDrawable())
320
+ "changeFrameButtonExpandImage" -> editor.setChangeFrameExpandButtonImage(v.toDrawable())
321
+ "cameraSwitchButtonImage" -> editor.setCameraSwitchButtonImage(v.toDrawable())
322
+ "torchButtonOnImage" -> editor.setTorchImageOn(v.toDrawable())
323
+ "torchButtonOffImage" -> editor.setTorchImageOff(v.toDrawable())
324
+ "livenessAnimationImage" -> editor.setLivenessAnimationImage(v.toDrawable())
325
+ "multipageButtonImage" -> editor.setMultipageButtonImage(v.toDrawable())
326
+ "helpAnimationImageMatrix" -> editor.setHelpAnimationImageMatrix(matrixFromJSON(v as JSONArray?)).setHelpAnimationImageScaleType(ImageView.ScaleType.MATRIX)
327
+ "multipageAnimationFrontImageMatrix" -> editor.setMultipageAnimationFrontImageMatrix(matrixFromJSON(v as JSONArray?)).setMultipageAnimationFrontImageScaleType(ImageView.ScaleType.MATRIX)
328
+ "multipageAnimationBackImageMatrix" -> editor.setMultipageAnimationBackImageMatrix(matrixFromJSON(v as JSONArray?)).setMultipageAnimationBackImageScaleType(ImageView.ScaleType.MATRIX)
329
+ "livenessAnimationImageMatrix" -> editor.setLivenessAnimationImageMatrix(matrixFromJSON(v as JSONArray?)).setLivenessAnimationImageScaleType(ImageView.ScaleType.MATRIX)
330
+ "borderBackgroundImageMatrix" -> editor.setBorderBackgroundImageMatrix(matrixFromJSON(v as JSONArray?)).setBorderBackgroundImageScaleType(ImageView.ScaleType.MATRIX)
331
+ "customLabelStatus" -> editor.setCustomLabelStatus(SpannableString(v as String))
332
+ "cameraFrameLineCap" -> editor.setCameraFrameLineCap(Paint.Cap.values()[v.toInt()])
333
+ "uiCustomizationLayer" -> editor.setUiCustomizationLayer(JSONObject(v.toString()))
334
+ "colors" -> setColors(editor, v as JSONObject)
335
+ "fonts" -> setFonts(editor, v as JSONObject)
336
+ "images" -> setImages(editor, v as JSONObject)
337
+ "statusTextFont" -> {
338
+ val font = typefaceFromJSON(v as JSONObject)
339
+ editor.setStatusTextFont(font.first)
340
+ font.second?.let { editor.setStatusTextSize(it) }
341
+ }
342
+
343
+ "resultStatusTextFont" -> {
344
+ val font = typefaceFromJSON(v as JSONObject)
345
+ editor.setResultStatusTextFont(font.first)
346
+ font.second?.let { editor.setResultStatusTextSize(it) }
347
+ }
348
+
349
+ "multipageButtonTextFont" -> {
350
+ val font = typefaceFromJSON(v as JSONObject)
351
+ editor.setMultipageButtonTextFont(font.first)
352
+ font.second?.let { editor.setMultipageButtonTextSize(it) }
353
+ }
354
+ }
355
+ editor.applyImmediately(context)
356
+ }
357
+
358
+ fun getCustomization(customization: ParamsCustomization) = mapOf(
359
+ "showStatusMessages" to customization.isShowStatusMessages,
360
+ "showResultStatusMessages" to customization.isShowResultStatusMessages,
361
+ "showHelpAnimation" to customization.isShowHelpAnimation,
362
+ "showNextPageAnimation" to customization.isShowNextPageAnimation,
363
+ "showBackgroundMask" to customization.isShowBackgroundMask,
364
+ "cameraFrameBorderWidth" to customization.cameraFrameBorderWidth,
365
+ "cameraFrameLineLength" to customization.cameraFrameLineLength,
366
+ "cameraFrameShapeType" to customization.cameraFrameShapeType,
367
+ "cameraFrameOffsetWidth" to customization.cameraFrameOffsetWidth,
368
+ "activityIndicatorSize" to customization.activityIndicatorSize,
369
+ "status" to customization.status,
370
+ "resultStatus" to customization.resultStatus,
371
+ "multipageButtonText" to customization.multipageButtonText,
372
+ "cameraFrameDefaultColor" to customization.cameraFrameDefaultColor.colorToLong(),
373
+ "cameraFrameActiveColor" to customization.cameraFrameActiveColor.colorToLong(),
374
+ "statusTextColor" to customization.statusTextColor.colorToLong(),
375
+ "resultStatusTextColor" to customization.resultStatusTextColor.colorToLong(),
376
+ "resultStatusBackgroundColor" to customization.resultStatusBackgroundColor.colorToLong(),
377
+ "multipageButtonBackgroundColor" to customization.multipageButtonBackgroundColor.colorToLong(),
378
+ "tintColor" to customization.tintColor.colorToLong(),
379
+ "activityIndicatorColor" to customization.activityIndicatorColor.colorToLong(),
380
+ "statusBackgroundColor" to customization.statusBackgroundColor.colorToLong(),
381
+ "cameraPreviewBackgroundColor" to customization.cameraPreviewBackgroundColor.colorToLong(),
382
+ "backgroundMaskColor" to customization.backgroundMaskColor.colorToLong(),
383
+ "multipageButtonTextColor" to customization.multipageButtonTextColor.colorToLong(),
384
+ "statusPositionMultiplier" to customization.statusPositionMultiplier,
385
+ "resultStatusPositionMultiplier" to customization.resultStatusPositionMultiplier,
386
+ "backgroundMaskAlpha" to customization.backgroundMaskAlpha,
387
+ "toolbarSize" to customization.toolbarSize,
388
+ "customStatusPositionMultiplier" to customization.customStatusPositionMultiplier,
389
+ "cameraFrameVerticalPositionMultiplier" to customization.cameraFrameVerticalPositionMultiplier,
390
+ "cameraFrameLandscapeAspectRatio" to customization.cameraFrameLandscapeAspectRatio,
391
+ "cameraFramePortraitAspectRatio" to customization.cameraFramePortraitAspectRatio,
392
+ "cameraFrameCornerRadius" to customization.cameraFrameCornerRadius,
393
+ "livenessAnimationPositionMultiplier" to customization.livenessAnimationPositionMultiplier,
394
+ "nextPageAnimationStartDelay" to customization.nextPageAnimationStartDelay,
395
+ "nextPageAnimationEndDelay" to customization.nextPageAnimationEndDelay,
396
+ "activityIndicatorPortraitPositionMultiplier" to customization.activityIndicatorPortraitPositionMultiplier,
397
+ "activityIndicatorLandscapePositionMultiplier" to customization.activityIndicatorLandscapePositionMultiplier,
398
+ "cameraPreviewVerticalPositionMultiplier" to customization.cameraPreviewVerticalPositionMultiplier,
399
+ "multipageAnimationFrontImage" to customization.multipageAnimationFrontImage.toBase64(),
400
+ "multipageAnimationBackImage" to customization.multipageAnimationBackImage.toBase64(),
401
+ "borderBackgroundImage" to customization.borderBackgroundImage.toBase64(),
402
+ "helpAnimationImage" to customization.helpAnimationImageDrawable.toBase64(),
403
+ "closeButtonImage" to customization.closeButtonDrawable.toBase64(),
404
+ "captureButtonImage" to customization.captureButtonDrawable.toBase64(),
405
+ "changeFrameButtonCollapseImage" to customization.changeFrameCollapseButtonDrawable.toBase64(),
406
+ "changeFrameButtonExpandImage" to customization.changeFrameExpandButtonDrawable.toBase64(),
407
+ "cameraSwitchButtonImage" to customization.cameraSwitchButtonDrawable.toBase64(),
408
+ "torchButtonOnImage" to customization.torchImageOnDrawable.toBase64(),
409
+ "torchButtonOffImage" to customization.torchImageOffDrawable.toBase64(),
410
+ "livenessAnimationImage" to customization.livenessAnimationImage.toBase64(),
411
+ "multipageButtonImage" to customization.multipageButtonDrawable.toBase64(),
412
+ "helpAnimationImageMatrix" to generateMatrix(customization.helpAnimationImageMatrix),
413
+ "multipageAnimationFrontImageMatrix" to generateMatrix(customization.multipageAnimationFrontImageMatrix),
414
+ "multipageAnimationBackImageMatrix" to generateMatrix(customization.multipageAnimationBackImageMatrix),
415
+ "livenessAnimationImageMatrix" to generateMatrix(customization.livenessAnimationImageMatrix),
416
+ "borderBackgroundImageMatrix" to generateMatrix(customization.borderBackgroundImageMatrix),
417
+ "statusTextFont" to generateTypeface(customization.statusTextFont, customization.statusTextSize),
418
+ "resultStatusTextFont" to generateTypeface(customization.resultStatusTextFont, customization.resultStatusTextSize),
419
+ "multipageButtonTextFont" to generateTypeface(customization.multipageButtonTextFont, customization.multipageButtonTextSize),
420
+ "customLabelStatus" to customization.customLabelStatus?.toString(),
421
+ "cameraFrameLineCap" to customization.cameraFrameLineCap.ordinal,
422
+ "uiCustomizationLayer" to customization.uiCustomizationLayer,
423
+ "colors" to getColors(customization.colors),
424
+ "fonts" to getFonts(customization.typeFaces, customization.fontSizes),
425
+ "images" to getImages(customization.images)
426
+ ).toJson()
427
+
428
+ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach { k, v ->
429
+ when (k) {
430
+ "paceStaticBinding" -> rfidScenario.isPaceStaticBinding = v as Boolean
431
+ "onlineTA" -> rfidScenario.isOnlineTA = v as Boolean
432
+ "writeEid" -> rfidScenario.isWriteEid = v as Boolean
433
+ "universalAccessRights" -> rfidScenario.isUniversalAccessRights = v as Boolean
434
+ "authorizedRestrictedIdentification" -> rfidScenario.isAuthorizedRestrictedIdentification = v as Boolean
435
+ "auxVerificationCommunityID" -> rfidScenario.isAuxVerificationCommunityID = v as Boolean
436
+ "auxVerificationDateOfBirth" -> rfidScenario.isAuxVerificationDateOfBirth = v as Boolean
437
+ "skipAA" -> rfidScenario.isSkipAA = v as Boolean
438
+ "strictProcessing" -> rfidScenario.isStrictProcessing = v as Boolean
439
+ "pkdDSCertPriority" -> rfidScenario.isPkdDSCertPriority = v as Boolean
440
+ "pkdUseExternalCSCA" -> rfidScenario.isPkdUseExternalCSCA = v as Boolean
441
+ "trustedPKD" -> rfidScenario.isTrustedPKD = v as Boolean
442
+ "passiveAuth" -> rfidScenario.isPassiveAuth = v as Boolean
443
+ "useSFI" -> rfidScenario.isUseSFI = v as Boolean
444
+ "readEPassport" -> rfidScenario.isReadEPassport = v as Boolean
445
+ "readEID" -> rfidScenario.isReadEID = v as Boolean
446
+ "readEDL" -> rfidScenario.isReadEDL = v as Boolean
447
+ "authorizedSTSignature" -> rfidScenario.isAuthorizedSTSignature = v as Boolean
448
+ "authorizedSTQSignature" -> rfidScenario.isAuthorizedSTQSignature = v as Boolean
449
+ "authorizedWriteDG17" -> rfidScenario.isAuthorizedWriteDG17 = v as Boolean
450
+ "authorizedWriteDG18" -> rfidScenario.isAuthorizedWriteDG18 = v as Boolean
451
+ "authorizedWriteDG19" -> rfidScenario.isAuthorizedWriteDG19 = v as Boolean
452
+ "authorizedWriteDG20" -> rfidScenario.isAuthorizedWriteDG20 = v as Boolean
453
+ "authorizedWriteDG21" -> rfidScenario.isAuthorizedWriteDG21 = v as Boolean
454
+ "authorizedVerifyAge" -> rfidScenario.isAuthorizedVerifyAge = v as Boolean
455
+ "authorizedVerifyCommunityID" -> rfidScenario.isAuthorizedVerifyCommunityID = v as Boolean
456
+ "authorizedPrivilegedTerminal" -> rfidScenario.isAuthorizedPrivilegedTerminal = v as Boolean
457
+ "authorizedCANAllowed" -> rfidScenario.isAuthorizedCANAllowed = v as Boolean
458
+ "authorizedPINManagement" -> rfidScenario.isAuthorizedPINManagment = v as Boolean
459
+ "authorizedInstallCert" -> rfidScenario.isAuthorizedInstallCert = v as Boolean
460
+ "authorizedInstallQCert" -> rfidScenario.isAuthorizedInstallQCert = v as Boolean
461
+ "applyAmendments" -> rfidScenario.isApplyAmendments = v as Boolean
462
+ "autoSettings" -> rfidScenario.isAutoSettings = v as Boolean
463
+ "proceedReadingAlways" -> rfidScenario.proceedReadingAlways = v as Boolean
464
+ "readDTC" -> rfidScenario.isReadDTC = v as Boolean
465
+ "mrzStrictCheck" -> rfidScenario.isMrzStrictCheck = v as Boolean
466
+ "loadCRLFromRemote" -> rfidScenario.isLoadCRLFromRemote = v as Boolean
467
+ "independentSODStatus" -> rfidScenario.isIndependentSODStatus = v as Boolean
468
+ "signManagementAction" -> rfidScenario.signManagementAction = v.toInt()
469
+ "readingBuffer" -> rfidScenario.readingBuffer = v.toInt()
470
+ "onlineTAToSignDataType" -> rfidScenario.onlineTAToSignDataType = v.toInt()
471
+ "profilerType" -> rfidScenario.profilerType = v.toInt()
472
+ "authProcType" -> rfidScenario.authProcType = v.toInt()
473
+ "baseSMProcedure" -> rfidScenario.baseSMProcedure = v.toInt()
474
+ "pacePasswordType" -> rfidScenario.pacePasswordType = v.toInt()
475
+ "terminalType" -> rfidScenario.terminalType = v.toInt()
476
+ "defaultReadingBufferSize" -> rfidScenario.defaultReadingBufferSize = v.toInt()
477
+ "password" -> rfidScenario.password = v as String
478
+ "pkdPA" -> rfidScenario.pkdPA = v as String
479
+ "pkdEAC" -> rfidScenario.pkdEAC = v as String
480
+ "mrz" -> rfidScenario.mrz = v as String
481
+ "eSignPINDefault" -> rfidScenario.seteSignPINDefault(v as String)
482
+ "eSignPINNewValue" -> rfidScenario.seteSignPINNewValue(v as String)
483
+ "cardAccess" -> rfidScenario.cardAccess = v as String
484
+ "mrzHash" -> rfidScenario.mrzHash = v as String
485
+ "documentNumber" -> rfidScenario.documentNumber = v as String
486
+ "dateOfBirth" -> rfidScenario.dateOfBirth = v as String
487
+ "dateOfExpiry" -> rfidScenario.dateOfExpiry = v as String
488
+ "ePassportDataGroups" -> setDataGroups(rfidScenario.ePassportDataGroups(), v as JSONObject)
489
+ "eIDDataGroups" -> setDataGroups(rfidScenario.eIDDataGroups(), v as JSONObject)
490
+ "eDLDataGroups" -> setDataGroups(rfidScenario.eDLDataGroups(), v as JSONObject)
491
+ "dtcDataGroups" -> setDTCDataGroup(rfidScenario.DTCDataGroup(), v as JSONObject)
492
+ }
493
+ }
494
+
495
+ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
496
+ "paceStaticBinding" to rfidScenario.isPaceStaticBinding,
497
+ "onlineTA" to rfidScenario.isOnlineTA,
498
+ "writeEid" to rfidScenario.isWriteEid,
499
+ "universalAccessRights" to rfidScenario.isUniversalAccessRights,
500
+ "authorizedRestrictedIdentification" to rfidScenario.isAuthorizedRestrictedIdentification,
501
+ "auxVerificationCommunityID" to rfidScenario.isAuxVerificationCommunityID,
502
+ "auxVerificationDateOfBirth" to rfidScenario.isAuxVerificationDateOfBirth,
503
+ "skipAA" to rfidScenario.isSkipAA,
504
+ "strictProcessing" to rfidScenario.isStrictProcessing,
505
+ "pkdDSCertPriority" to rfidScenario.isPkdDSCertPriority,
506
+ "pkdUseExternalCSCA" to rfidScenario.isPkdUseExternalCSCA,
507
+ "trustedPKD" to rfidScenario.isTrustedPKD,
508
+ "passiveAuth" to rfidScenario.isPassiveAuth,
509
+ "useSFI" to rfidScenario.isUseSFI,
510
+ "readEPassport" to rfidScenario.isReadEPassport,
511
+ "readEID" to rfidScenario.isReadEID,
512
+ "readEDL" to rfidScenario.isReadEDL,
513
+ "authorizedSTSignature" to rfidScenario.isAuthorizedSTSignature,
514
+ "authorizedSTQSignature" to rfidScenario.isAuthorizedSTQSignature,
515
+ "authorizedWriteDG17" to rfidScenario.isAuthorizedWriteDG17,
516
+ "authorizedWriteDG18" to rfidScenario.isAuthorizedWriteDG18,
517
+ "authorizedWriteDG19" to rfidScenario.isAuthorizedWriteDG19,
518
+ "authorizedWriteDG20" to rfidScenario.isAuthorizedWriteDG20,
519
+ "authorizedWriteDG21" to rfidScenario.isAuthorizedWriteDG21,
520
+ "authorizedVerifyAge" to rfidScenario.isAuthorizedVerifyAge,
521
+ "authorizedVerifyCommunityID" to rfidScenario.isAuthorizedVerifyCommunityID,
522
+ "authorizedPrivilegedTerminal" to rfidScenario.isAuthorizedPrivilegedTerminal,
523
+ "authorizedCANAllowed" to rfidScenario.isAuthorizedCANAllowed,
524
+ "authorizedPINManagement" to rfidScenario.isAuthorizedPINManagment,
525
+ "authorizedInstallCert" to rfidScenario.isAuthorizedInstallCert,
526
+ "authorizedInstallQCert" to rfidScenario.isAuthorizedInstallQCert,
527
+ "applyAmendments" to rfidScenario.isApplyAmendments,
528
+ "autoSettings" to rfidScenario.isAutoSettings,
529
+ "proceedReadingAlways" to rfidScenario.proceedReadingAlways,
530
+ "readDTC" to rfidScenario.isReadDTC,
531
+ "mrzStrictCheck" to rfidScenario.isMrzStrictCheck,
532
+ "loadCRLFromRemote" to rfidScenario.isLoadCRLFromRemote,
533
+ "independentSODStatus" to rfidScenario.isIndependentSODStatus,
534
+ "signManagementAction" to rfidScenario.signManagementAction,
535
+ "readingBuffer" to rfidScenario.readingBuffer,
536
+ "onlineTAToSignDataType" to rfidScenario.onlineTAToSignDataType,
537
+ "profilerType" to rfidScenario.profilerType,
538
+ "authProcType" to rfidScenario.authProcType,
539
+ "baseSMProcedure" to rfidScenario.baseSMProcedure,
540
+ "pacePasswordType" to rfidScenario.pacePasswordType,
541
+ "terminalType" to rfidScenario.terminalType,
542
+ "defaultReadingBufferSize" to rfidScenario.defaultReadingBufferSize,
543
+ "password" to rfidScenario.password,
544
+ "pkdPA" to rfidScenario.pkdPA,
545
+ "pkdEAC" to rfidScenario.pkdEAC,
546
+ "mrz" to rfidScenario.mrz,
547
+ "eSignPINDefault" to rfidScenario.geteSignPINDefault(),
548
+ "eSignPINNewValue" to rfidScenario.geteSignPINNewValue(),
549
+ "cardAccess" to rfidScenario.cardAccess,
550
+ "mrzHash" to rfidScenario.mrzHash,
551
+ "documentNumber" to rfidScenario.documentNumber,
552
+ "dateOfBirth" to rfidScenario.dateOfBirth,
553
+ "dateOfExpiry" to rfidScenario.dateOfExpiry,
554
+ "ePassportDataGroups" to getDataGroups(rfidScenario.ePassportDataGroups()),
555
+ "eIDDataGroups" to getDataGroups(rfidScenario.eIDDataGroups()),
556
+ "eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups()),
557
+ "dtcDataGroups" to getDTCDataGroup(rfidScenario.DTCDataGroup())
558
+ ).toJson()
559
+
560
+ fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v ->
561
+ val value = v as Boolean
562
+ when (k) {
563
+ "DG1" -> dataGroup.isDG1 = value
564
+ "DG2" -> dataGroup.isDG2 = value
565
+ "DG3" -> dataGroup.isDG3 = value
566
+ "DG4" -> dataGroup.isDG4 = value
567
+ "DG5" -> dataGroup.isDG5 = value
568
+ "DG6" -> dataGroup.isDG6 = value
569
+ "DG7" -> dataGroup.isDG7 = value
570
+ "DG8" -> dataGroup.isDG8 = value
571
+ "DG9" -> dataGroup.isDG9 = value
572
+ "DG10" -> dataGroup.isDG10 = value
573
+ "DG11" -> dataGroup.isDG11 = value
574
+ "DG12" -> dataGroup.isDG12 = value
575
+ "DG13" -> dataGroup.isDG13 = value
576
+ "DG14" -> dataGroup.isDG14 = value
577
+ }
578
+ if (dataGroup is EPassportDataGroups) when (k) {
579
+ "DG15" -> dataGroup.isDG15 = value
580
+ "DG16" -> dataGroup.isDG16 = value
581
+ }
582
+ if (dataGroup is EIDDataGroups) when (k) {
583
+ "DG15" -> dataGroup.isDG15 = value
584
+ "DG16" -> dataGroup.isDG16 = value
585
+ "DG17" -> dataGroup.isDG17 = value
586
+ "DG18" -> dataGroup.isDG18 = value
587
+ "DG19" -> dataGroup.isDG19 = value
588
+ "DG20" -> dataGroup.isDG20 = value
589
+ "DG21" -> dataGroup.isDG21 = value
590
+ }
591
+ }
592
+
593
+ fun getDataGroups(dataGroup: DataGroups): JSONObject {
594
+ val result = mutableMapOf(
595
+ "DG1" to dataGroup.isDG1,
596
+ "DG2" to dataGroup.isDG2,
597
+ "DG3" to dataGroup.isDG3,
598
+ "DG4" to dataGroup.isDG4,
599
+ "DG5" to dataGroup.isDG5,
600
+ "DG6" to dataGroup.isDG6,
601
+ "DG7" to dataGroup.isDG7,
602
+ "DG8" to dataGroup.isDG8,
603
+ "DG9" to dataGroup.isDG9,
604
+ "DG10" to dataGroup.isDG10,
605
+ "DG11" to dataGroup.isDG11,
606
+ "DG12" to dataGroup.isDG12,
607
+ "DG13" to dataGroup.isDG13,
608
+ "DG14" to dataGroup.isDG14
609
+ )
610
+ if (dataGroup is EPassportDataGroups) {
611
+ result["DG15"] = dataGroup.isDG15
612
+ result["DG16"] = dataGroup.isDG16
613
+ }
614
+ if (dataGroup is EIDDataGroups) {
615
+ result["DG15"] = dataGroup.isDG15
616
+ result["DG16"] = dataGroup.isDG16
617
+ result["DG17"] = dataGroup.isDG17
618
+ result["DG18"] = dataGroup.isDG18
619
+ result["DG19"] = dataGroup.isDG19
620
+ result["DG20"] = dataGroup.isDG20
621
+ result["DG21"] = dataGroup.isDG21
622
+ }
623
+ return result.toJson()
624
+ }
625
+
626
+ fun setDTCDataGroup(dataGroup: DTCDataGroup, opts: JSONObject) = opts.forEach { k, v ->
627
+ val value = v as Boolean
628
+ when (k) {
629
+ "DG17" -> dataGroup.isDG17 = value
630
+ "DG18" -> dataGroup.isDG18 = value
631
+ "DG22" -> dataGroup.isDG22 = value
632
+ "DG23" -> dataGroup.isDG23 = value
633
+ "DG24" -> dataGroup.isDG24 = value
634
+ }
635
+ }
636
+
637
+ fun getDTCDataGroup(dataGroup: DTCDataGroup) = mapOf(
638
+ "DG17" to dataGroup.isDG17,
639
+ "DG18" to dataGroup.isDG18,
640
+ "DG22" to dataGroup.isDG22,
641
+ "DG23" to dataGroup.isDG23,
642
+ "DG24" to dataGroup.isDG24,
643
+ ).toJson()
644
+
645
+ fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
646
+ when (k) {
647
+ "focusCheck" -> input.focusCheck = v as Boolean
648
+ "glaresCheck" -> input.glaresCheck = v as Boolean
649
+ "colornessCheck" -> input.colornessCheck = v as Boolean
650
+ "screenCapture" -> input.screenCapture = v as Boolean
651
+ "dpiThreshold" -> input.dpiThreshold = v.toInt()
652
+ "angleThreshold" -> input.angleThreshold = v.toInt()
653
+ "documentPositionIndent" -> input.documentPositionIndent = v.toInt()
654
+ "brightnessThreshold" -> input.brightnessThreshold = v.toDouble()
655
+ "expectedPass" -> input.expectedPass = v.toIntArray()
656
+ "glaresCheckParams" -> input.glaresCheckParams = glaresCheckParamsFromJSON(v as JSONObject)
657
+ "occlusionCheck" -> input.occlusionCheck = v as Boolean
658
+ }
659
+ }
660
+
661
+ fun getImageQA(input: ImageQA) = mapOf(
662
+ "focusCheck" to input.focusCheck,
663
+ "glaresCheck" to input.glaresCheck,
664
+ "colornessCheck" to input.colornessCheck,
665
+ "screenCapture" to input.screenCapture,
666
+ "dpiThreshold" to input.dpiThreshold,
667
+ "angleThreshold" to input.angleThreshold,
668
+ "documentPositionIndent" to input.documentPositionIndent,
669
+ "brightnessThreshold" to input.brightnessThreshold,
670
+ "expectedPass" to input.expectedPass.toJson(),
671
+ "glaresCheckParams" to generateGlaresCheckParams(input.glaresCheckParams),
672
+ "occlusionCheck" to input.occlusionCheck,
673
+ ).toJson()
674
+
675
+ fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.forEach { k, v ->
676
+ when (k) {
677
+ "useLivenessCheck" -> input.useLivenessCheck = v as Boolean
678
+ "checkUVLuminiscence" -> input.checkUVLuminiscence = v as Boolean
679
+ "checkIRB900" -> input.checkIRB900 = v as Boolean
680
+ "checkImagePatterns" -> input.checkImagePatterns = v as Boolean
681
+ "checkFibers" -> input.checkFibers = v as Boolean
682
+ "checkExtMRZ" -> input.checkExtMRZ = v as Boolean
683
+ "checkExtOCR" -> input.checkExtOCR = v as Boolean
684
+ "checkAxial" -> input.checkAxial = v as Boolean
685
+ "checkBarcodeFormat" -> input.checkBarcodeFormat = v as Boolean
686
+ "checkIRVisibility" -> input.checkIRVisibility = v as Boolean
687
+ "checkIPI" -> input.checkIPI = v as Boolean
688
+ "checkPhotoEmbedding" -> input.checkPhotoEmbedding = v as Boolean
689
+ "checkPhotoComparison" -> input.checkPhotoComparison = v as Boolean
690
+ "checkLetterScreen" -> input.checkLetterScreen = v as Boolean
691
+ "checkSecurityText" -> input.checkSecurityText = v as Boolean
692
+ "livenessParams" -> {
693
+ if (input.livenessParams == null) input.livenessParams = LivenessParams.defaultParams()
694
+ setLivenessParams(input.livenessParams!!, v as JSONObject)
695
+ }
696
+ }
697
+ }
698
+
699
+ fun getAuthenticityParams(input: AuthenticityParams?) = input?.let {
700
+ mapOf(
701
+ "useLivenessCheck" to it.useLivenessCheck,
702
+ "checkUVLuminiscence" to it.checkUVLuminiscence,
703
+ "checkIRB900" to input.checkIRB900,
704
+ "checkImagePatterns" to it.checkImagePatterns,
705
+ "checkFibers" to it.checkFibers,
706
+ "checkExtMRZ" to it.checkExtMRZ,
707
+ "checkExtOCR" to it.checkExtOCR,
708
+ "checkAxial" to it.checkAxial,
709
+ "checkBarcodeFormat" to it.checkBarcodeFormat,
710
+ "checkIRVisibility" to it.checkIRVisibility,
711
+ "checkIPI" to it.checkIPI,
712
+ "checkPhotoEmbedding" to it.checkPhotoEmbedding,
713
+ "checkPhotoComparison" to it.checkPhotoComparison,
714
+ "checkLetterScreen" to it.checkLetterScreen,
715
+ "checkSecurityText" to it.checkSecurityText,
716
+ "livenessParams" to getLivenessParams(it.livenessParams)
717
+ ).toJson()
718
+ }
719
+
720
+ fun setLivenessParams(input: LivenessParams, opts: JSONObject) = opts.forEach { k, v ->
721
+ when (k) {
722
+ "checkOVI" -> input.checkOVI = v as Boolean
723
+ "checkMLI" -> input.checkMLI = v as Boolean
724
+ "checkHolo" -> input.checkHolo = v as Boolean
725
+ "checkED" -> input.checkED = v as Boolean
726
+ "checkBlackAndWhiteCopy" -> input.checkBlackAndWhiteCopy = v as Boolean
727
+ "checkDynaprint" -> input.checkDynaprint = v as Boolean
728
+ "checkGeometry" -> input.checkGeometry = v as Boolean
729
+ }
730
+ }
731
+
732
+ fun getLivenessParams(input: LivenessParams?) = input?.let {
733
+ mapOf(
734
+ "checkOVI" to input.checkOVI,
735
+ "checkMLI" to input.checkMLI,
736
+ "checkHolo" to input.checkHolo,
737
+ "checkED" to input.checkED,
738
+ "checkBlackAndWhiteCopy" to input.checkBlackAndWhiteCopy,
739
+ "checkDynaprint" to input.checkDynaprint,
740
+ "checkGeometry" to input.checkGeometry,
741
+ ).toJson()
742
+ }
743
+
744
+ fun setColors(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
745
+ val value = v.toLong()
746
+ when (key) {
747
+ "rfidProcessingScreenBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_BACKGROUND, value)
748
+ "rfidProcessingScreenHintLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_TEXT, value)
749
+ "rfidProcessingScreenHintLabelBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_BACKGROUND, value)
750
+ "rfidProcessingScreenProgressLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_LABEL_TEXT, value)
751
+ "rfidProcessingScreenProgressBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR, value)
752
+ "rfidProcessingScreenProgressBarBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND, value)
753
+ "rfidProcessingScreenResultLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT, value)
754
+ "rfidProcessingScreenLoadingBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR, value)
755
+ }
756
+ }
757
+
758
+ fun getColors(input: Map<CustomizationColor, Long>) = mapOf(
759
+ "rfidProcessingScreenBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_BACKGROUND],
760
+ "rfidProcessingScreenHintLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_TEXT],
761
+ "rfidProcessingScreenHintLabelBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_BACKGROUND],
762
+ "rfidProcessingScreenProgressLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_LABEL_TEXT],
763
+ "rfidProcessingScreenProgressBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR],
764
+ "rfidProcessingScreenProgressBarBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND],
765
+ "rfidProcessingScreenResultLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT],
766
+ "rfidProcessingScreenLoadingBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR],
767
+ ).toJson()
768
+
769
+ fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, value ->
770
+ when (key) {
771
+ "rfidProcessingScreenHintLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.setFont(input, value)
772
+ "rfidProcessingScreenProgressLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.setFont(input, value)
773
+ "rfidProcessingScreenResultLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.setFont(input, value)
774
+ }
775
+ }
776
+
777
+ fun getFonts(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) = mapOf(
778
+ "rfidProcessingScreenHintLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.getFont(fonts, sizes),
779
+ "rfidProcessingScreenProgressLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.getFont(fonts, sizes),
780
+ "rfidProcessingScreenResultLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.getFont(fonts, sizes),
781
+ ).toJson()
782
+
783
+ fun setImages(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
784
+ when (key) {
785
+ "rfidProcessingScreenFailureImage" -> input.setImage(CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE, v.toDrawable())
786
+ }
787
+ }
788
+
789
+ fun getImages(input: Map<CustomizationImage, Drawable>) = mapOf(
790
+ "rfidProcessingScreenFailureImage" to (input[CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_ic_error)).toBase64(),
791
+ ).toJson()
792
+
793
+ fun CustomizationFont.getFont(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) =
794
+ generateTypeface(fonts[this], sizes[this])
795
+
796
+ fun CustomizationFont.setFont(editor: ParamsCustomization.CustomizationEditor, value: Any?) {
797
+ val font = typefaceFromJSON(value as JSONObject)
798
+ editor.setFont(this, font.first)
799
+ font.second?.let { editor.setFontSize(this, it) }
800
+ }
801
+
802
+ fun Any.toInt() = when (this) {
803
+ is Double -> toInt()
804
+ is Long -> toInt()
805
+ is String -> Integer.parseInt(this)
806
+ else -> this as Int
807
+ }
808
+
809
+ fun Any.toLong() = when (this) {
810
+ is Double -> toLong()
811
+ is Int -> toLong()
812
+ else -> this as Long
813
+ }
814
+
815
+ fun Any.toFloat() = when (this) {
816
+ is Int -> toFloat()
817
+ is Double -> toFloat()
818
+ else -> this as Float
819
+ }
820
+
821
+ fun Any.toDouble() = when (this) {
822
+ is Int -> toDouble()
823
+ is Long -> toDouble()
824
+ else -> this as Double
825
+ }
826
+
827
+ fun Any?.toColor() = this?.let {
828
+ "#" + toLong().toString(16)
829
+ }
830
+
831
+ fun String?.colorToLong() = this?.let {
832
+ if (this[0] == '#') this.substring(1).toLong(16)
833
+ else this.toLong(16)
834
+ }