@regulaforensics/document-reader 1.1.1318-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 (483) hide show
  1. package/Package.swift +28 -0
  2. package/README.md +19 -0
  3. package/android/CVDDocumentReader.kt +76 -0
  4. package/android/build.gradle.kts +37 -0
  5. package/android/cordova.gradle.kts +13 -0
  6. package/android/src/main/kotlin/com/regula/plugin/document/reader/BluetoothUtil.kt +164 -0
  7. package/android/src/main/kotlin/com/regula/plugin/document/reader/Config.kt +1021 -0
  8. package/android/src/main/kotlin/com/regula/plugin/document/reader/JSONConstructor.kt +2192 -0
  9. package/android/src/main/kotlin/com/regula/plugin/document/reader/Main.kt +656 -0
  10. package/android/src/main/kotlin/com/regula/plugin/document/reader/RNDocumentReaderModule.kt +101 -0
  11. package/android/src/main/kotlin/com/regula/plugin/document/reader/Utils.kt +248 -0
  12. package/app.plugin.js +45 -0
  13. package/examples/capacitor/README.md +24 -0
  14. package/examples/capacitor/android/app/build.gradle +41 -0
  15. package/examples/capacitor/android/app/proguard-rules.pro +21 -0
  16. package/examples/capacitor/android/app/src/main/AndroidManifest.xml +36 -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/app/src/main/res/xml/file_paths.xml +5 -0
  28. package/examples/capacitor/android/build.gradle +39 -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 +26 -0
  32. package/examples/capacitor/android/gradlew +248 -0
  33. package/examples/capacitor/android/gradlew.bat +82 -0
  34. package/examples/capacitor/android/settings.gradle +5 -0
  35. package/examples/capacitor/android/variables.gradle +20 -0
  36. package/examples/capacitor/capacitor.config.json +15 -0
  37. package/examples/capacitor/index.html +5 -0
  38. package/examples/capacitor/index.tsx +31 -0
  39. package/examples/capacitor/ios/App/App/App.entitlements +10 -0
  40. package/examples/capacitor/ios/App/App/AppDelegate.swift +14 -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/Info.plist +88 -0
  50. package/examples/capacitor/ios/App/App/SceneDelegate.swift +23 -0
  51. package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +374 -0
  52. package/examples/capacitor/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  53. package/examples/capacitor/ios/App/CapApp-SPM/Sources/CapApp-SPM/CapApp-SPM.swift +1 -0
  54. package/examples/capacitor/package-lock.json +1965 -0
  55. package/examples/capacitor/package.json +26 -0
  56. package/examples/capacitor/public/assets/.gitkeep +0 -0
  57. package/examples/capacitor/public/images/document.png +0 -0
  58. package/examples/capacitor/public/images/portrait.png +0 -0
  59. package/examples/capacitor/scripts/android.sh +8 -0
  60. package/examples/capacitor/scripts/ios.sh +8 -0
  61. package/examples/capacitor/scripts/setup.sh +9 -0
  62. package/examples/capacitor/src/extra/bt_device.tsx +33 -0
  63. package/examples/capacitor/src/extra/custom_rfid.tsx +61 -0
  64. package/examples/capacitor/src/main.css +153 -0
  65. package/examples/capacitor/src/main.html +38 -0
  66. package/examples/capacitor/src/main.tsx +172 -0
  67. package/examples/capacitor/tsconfig.json +5 -0
  68. package/examples/capacitor/vite.config.ts +5 -0
  69. package/examples/ionic/README.md +24 -0
  70. package/examples/ionic/angular.json +39 -0
  71. package/examples/ionic/assets/.gitkeep +0 -0
  72. package/examples/ionic/config.xml +61 -0
  73. package/examples/ionic/images/document.png +0 -0
  74. package/examples/ionic/images/icon.png +0 -0
  75. package/examples/ionic/images/portrait.png +0 -0
  76. package/examples/ionic/index.html +19 -0
  77. package/examples/ionic/index.tsx +63 -0
  78. package/examples/ionic/ionic.config.json +7 -0
  79. package/examples/ionic/package-lock.json +17554 -0
  80. package/examples/ionic/package.json +76 -0
  81. package/examples/ionic/patches/cordova-plugin-ionic-webview+5.0.1.patch +23 -0
  82. package/examples/ionic/scripts/android.sh +9 -0
  83. package/examples/ionic/scripts/ios.sh +11 -0
  84. package/examples/ionic/scripts/setup.sh +8 -0
  85. package/examples/ionic/src/extra/bt_device.tsx +33 -0
  86. package/examples/ionic/src/extra/custom_rfid.tsx +61 -0
  87. package/examples/ionic/src/main.css +148 -0
  88. package/examples/ionic/src/main.html +38 -0
  89. package/examples/ionic/src/main.tsx +172 -0
  90. package/examples/ionic/tsconfig.json +13 -0
  91. package/examples/react_native/README.md +24 -0
  92. package/examples/react_native/app.config.ts +54 -0
  93. package/examples/react_native/assets/.gitkeep +0 -0
  94. package/examples/react_native/images/document.png +0 -0
  95. package/examples/react_native/images/icon.png +0 -0
  96. package/examples/react_native/images/portrait.png +0 -0
  97. package/examples/react_native/index.tsx +111 -0
  98. package/examples/react_native/metro.config.js +5 -0
  99. package/examples/react_native/package-lock.json +6924 -0
  100. package/examples/react_native/package.json +37 -0
  101. package/examples/react_native/scripts/android.sh +8 -0
  102. package/examples/react_native/scripts/ios.sh +6 -0
  103. package/examples/react_native/scripts/setup.sh +10 -0
  104. package/examples/react_native/scripts/withoutMetroServer.js +89 -0
  105. package/examples/react_native/src/extra/bt_device.tsx +33 -0
  106. package/examples/react_native/src/extra/custom_rfid.tsx +61 -0
  107. package/examples/react_native/src/main.css +148 -0
  108. package/examples/react_native/src/main.html +38 -0
  109. package/examples/react_native/src/main.tsx +172 -0
  110. package/ios/CVDDocumentReader.h +7 -0
  111. package/ios/CVDDocumentReader.m +43 -0
  112. package/ios/RGLWConfig.h +44 -0
  113. package/ios/RGLWConfig.m +1577 -0
  114. package/ios/RGLWJSONConstructor.h +216 -0
  115. package/ios/RGLWJSONConstructor.m +2875 -0
  116. package/ios/RGLWMain.h +34 -0
  117. package/ios/RGLWMain.m +722 -0
  118. package/ios/RNDocumentReader.h +8 -0
  119. package/ios/RNDocumentReader.m +52 -0
  120. package/ios/spm/module.modulemap +7 -0
  121. package/package.json +39 -0
  122. package/plugin.xml +51 -0
  123. package/react-native-document-reader.podspec +14 -0
  124. package/test/json.tsx +1159 -0
  125. package/test/package-lock.json +584 -0
  126. package/test/package.json +9 -0
  127. package/test/test.tsx +315 -0
  128. package/test/utils.tsx +38 -0
  129. package/www/capacitor/config/FinalizeConfig.js +35 -0
  130. package/www/capacitor/config/InitConfig.js +55 -0
  131. package/www/capacitor/config/OnlineProcessingConfig.js +52 -0
  132. package/www/capacitor/config/RFIDConfig.js +47 -0
  133. package/www/capacitor/config/RecognizeConfig.js +138 -0
  134. package/www/capacitor/config/ScannerConfig.js +48 -0
  135. package/www/capacitor/index.js +758 -0
  136. package/www/capacitor/info/DocReaderException.js +68 -0
  137. package/www/capacitor/info/DocReaderScenario.js +89 -0
  138. package/www/capacitor/info/DocReaderVersion.js +32 -0
  139. package/www/capacitor/info/DocumentsDatabase.js +39 -0
  140. package/www/capacitor/info/License.js +30 -0
  141. package/www/capacitor/info/PrepareProgress.js +31 -0
  142. package/www/capacitor/info/RFIDException.js +26 -0
  143. package/www/capacitor/internal/bridge.js +131 -0
  144. package/www/capacitor/internal/cordova.js +17 -0
  145. package/www/capacitor/mdl/DataRetrieval.js +55 -0
  146. package/www/capacitor/mdl/DeviceEngagement.js +30 -0
  147. package/www/capacitor/mdl/DeviceRetrievalMethod.js +41 -0
  148. package/www/capacitor/mdl/DocumentRequestMDL.js +212 -0
  149. package/www/capacitor/mdl/NameSpaceMDL.js +33 -0
  150. package/www/capacitor/params/Functionality.js +387 -0
  151. package/www/capacitor/params/customization/Customization.js +664 -0
  152. package/www/capacitor/params/customization/CustomizationColors.js +231 -0
  153. package/www/capacitor/params/customization/CustomizationContentModes.js +55 -0
  154. package/www/capacitor/params/customization/CustomizationFonts.js +156 -0
  155. package/www/capacitor/params/customization/CustomizationImages.js +199 -0
  156. package/www/capacitor/params/customization/CustomizationMatrices.js +39 -0
  157. package/www/capacitor/params/customization/CustomizationTimings.js +71 -0
  158. package/www/capacitor/params/process_params/AuthenticityParams.js +166 -0
  159. package/www/capacitor/params/process_params/AuthenticityPropertiesParams.js +39 -0
  160. package/www/capacitor/params/process_params/BackendProcessingConfig.js +38 -0
  161. package/www/capacitor/params/process_params/Bsi.js +23 -0
  162. package/www/capacitor/params/process_params/FaceApiParams.js +55 -0
  163. package/www/capacitor/params/process_params/FaceApiSearchParams.js +29 -0
  164. package/www/capacitor/params/process_params/GlaresCheckParams.js +25 -0
  165. package/www/capacitor/params/process_params/ImageQA.js +122 -0
  166. package/www/capacitor/params/process_params/LivenessParams.js +87 -0
  167. package/www/capacitor/params/process_params/OcclusionCheckParams.js +21 -0
  168. package/www/capacitor/params/process_params/ProcessParams.js +724 -0
  169. package/www/capacitor/params/process_params/RFIDParams.js +21 -0
  170. package/www/capacitor/params/rfid_scenario/DTCDataGroup.js +63 -0
  171. package/www/capacitor/params/rfid_scenario/EDLDataGroups.js +135 -0
  172. package/www/capacitor/params/rfid_scenario/EIDDataGroups.js +191 -0
  173. package/www/capacitor/params/rfid_scenario/EPassportDataGroups.js +151 -0
  174. package/www/capacitor/params/rfid_scenario/RFIDScenario.js +584 -0
  175. package/www/capacitor/results/DocumentType.js +302 -0
  176. package/www/capacitor/results/Position.js +88 -0
  177. package/www/capacitor/results/Results.js +354 -0
  178. package/www/capacitor/results/TransactionInfo.js +24 -0
  179. package/www/capacitor/results/authenticity/Authenticity.js +24 -0
  180. package/www/capacitor/results/authenticity/AuthenticityCheck.js +43 -0
  181. package/www/capacitor/results/authenticity/AuthenticityElement.js +37 -0
  182. package/www/capacitor/results/authenticity/AuthenticityResult.js +33 -0
  183. package/www/capacitor/results/authenticity/CheckDiagnose.js +133 -0
  184. package/www/capacitor/results/authenticity/SecurityFeatureType.js +67 -0
  185. package/www/capacitor/results/barcode/BarcodeField.js +34 -0
  186. package/www/capacitor/results/barcode/BarcodeResult.js +30 -0
  187. package/www/capacitor/results/barcode/BarcodeStatus.js +33 -0
  188. package/www/capacitor/results/barcode/BarcodeType.js +21 -0
  189. package/www/capacitor/results/barcode/PDF417Info.js +24 -0
  190. package/www/capacitor/results/image_quality/ImageQuality.js +40 -0
  191. package/www/capacitor/results/image_quality/ImageQualityCheckType.js +19 -0
  192. package/www/capacitor/results/image_quality/ImageQualityGroup.js +39 -0
  193. package/www/capacitor/results/rfid/AccessControlProcedureType.js +30 -0
  194. package/www/capacitor/results/rfid/Application.js +63 -0
  195. package/www/capacitor/results/rfid/Attribute.js +23 -0
  196. package/www/capacitor/results/rfid/Authority.js +36 -0
  197. package/www/capacitor/results/rfid/CardProperties.js +57 -0
  198. package/www/capacitor/results/rfid/CertificateChain.js +69 -0
  199. package/www/capacitor/results/rfid/CertificateData.js +21 -0
  200. package/www/capacitor/results/rfid/DataField.js +23 -0
  201. package/www/capacitor/results/rfid/Extension.js +21 -0
  202. package/www/capacitor/results/rfid/File.js +56 -0
  203. package/www/capacitor/results/rfid/FileData.js +27 -0
  204. package/www/capacitor/results/rfid/RFIDAccessControlProcedureType.js +10 -0
  205. package/www/capacitor/results/rfid/RFIDCertificateType.js +14 -0
  206. package/www/capacitor/results/rfid/RFIDDataFileType.js +106 -0
  207. package/www/capacitor/results/rfid/RFIDSessionData.js +92 -0
  208. package/www/capacitor/results/rfid/RFIDValidity.js +23 -0
  209. package/www/capacitor/results/rfid/RFIDValue.js +30 -0
  210. package/www/capacitor/results/rfid/SecurityObject.js +41 -0
  211. package/www/capacitor/results/rfid/SecurityObjectCertificates.js +20 -0
  212. package/www/capacitor/results/rfid/SignerInfo.js +74 -0
  213. package/www/capacitor/results/status/AgeStatus.js +35 -0
  214. package/www/capacitor/results/status/CheckResult.js +5 -0
  215. package/www/capacitor/results/status/OpticalStatus.js +44 -0
  216. package/www/capacitor/results/status/RFIDStatus.js +38 -0
  217. package/www/capacitor/results/status/ResultsStatus.js +53 -0
  218. package/www/capacitor/results/visible_digital_seals/BytesData.js +27 -0
  219. package/www/capacitor/results/visible_digital_seals/DocFeature.js +23 -0
  220. package/www/capacitor/results/visible_digital_seals/LDSParsingErrorCodes.js +136 -0
  221. package/www/capacitor/results/visible_digital_seals/LDSParsingNotificationCodes.js +239 -0
  222. package/www/capacitor/results/visible_digital_seals/VDSData.js +75 -0
  223. package/www/capacitor/results/visible_digital_seals/VDSNCData.js +54 -0
  224. package/www/capacitor/results/visual_results/Comparison.js +27 -0
  225. package/www/capacitor/results/visual_results/FieldType.js +671 -0
  226. package/www/capacitor/results/visual_results/GraphicField.js +47 -0
  227. package/www/capacitor/results/visual_results/GraphicFieldType.js +25 -0
  228. package/www/capacitor/results/visual_results/GraphicResult.js +28 -0
  229. package/www/capacitor/results/visual_results/LCID.js +174 -0
  230. package/www/capacitor/results/visual_results/Lights.js +11 -0
  231. package/www/capacitor/results/visual_results/RFIDOrigin.js +27 -0
  232. package/www/capacitor/results/visual_results/Rect.js +27 -0
  233. package/www/capacitor/results/visual_results/Symbol.js +26 -0
  234. package/www/capacitor/results/visual_results/TextField.js +85 -0
  235. package/www/capacitor/results/visual_results/TextResult.js +52 -0
  236. package/www/capacitor/results/visual_results/TextSource.js +27 -0
  237. package/www/capacitor/results/visual_results/Validity.js +24 -0
  238. package/www/capacitor/results/visual_results/Value.js +52 -0
  239. package/www/capacitor/rfid/CAProtocol.js +27 -0
  240. package/www/capacitor/rfid/PAAttribute.js +24 -0
  241. package/www/capacitor/rfid/PACEProtocol.js +24 -0
  242. package/www/capacitor/rfid/PAResourcesIssuer.js +35 -0
  243. package/www/capacitor/rfid/PKDCertificate.js +65 -0
  244. package/www/capacitor/rfid/RFIDErrorCodes.js +123 -0
  245. package/www/capacitor/rfid/RFIDNotification.js +71 -0
  246. package/www/capacitor/rfid/TAChallenge.js +33 -0
  247. package/www/capacitor/rfid/TccParams.js +34 -0
  248. package/www/cordova.js +12948 -0
  249. package/www/react-native/config/FinalizeConfig.js +35 -0
  250. package/www/react-native/config/InitConfig.js +55 -0
  251. package/www/react-native/config/OnlineProcessingConfig.js +52 -0
  252. package/www/react-native/config/RFIDConfig.js +47 -0
  253. package/www/react-native/config/RecognizeConfig.js +138 -0
  254. package/www/react-native/config/ScannerConfig.js +48 -0
  255. package/www/react-native/index.js +758 -0
  256. package/www/react-native/info/DocReaderException.js +68 -0
  257. package/www/react-native/info/DocReaderScenario.js +89 -0
  258. package/www/react-native/info/DocReaderVersion.js +32 -0
  259. package/www/react-native/info/DocumentsDatabase.js +39 -0
  260. package/www/react-native/info/License.js +30 -0
  261. package/www/react-native/info/PrepareProgress.js +31 -0
  262. package/www/react-native/info/RFIDException.js +26 -0
  263. package/www/react-native/internal/bridge.js +131 -0
  264. package/www/react-native/mdl/DataRetrieval.js +55 -0
  265. package/www/react-native/mdl/DeviceEngagement.js +30 -0
  266. package/www/react-native/mdl/DeviceRetrievalMethod.js +41 -0
  267. package/www/react-native/mdl/DocumentRequestMDL.js +212 -0
  268. package/www/react-native/mdl/NameSpaceMDL.js +33 -0
  269. package/www/react-native/params/Functionality.js +387 -0
  270. package/www/react-native/params/customization/Customization.js +664 -0
  271. package/www/react-native/params/customization/CustomizationColors.js +231 -0
  272. package/www/react-native/params/customization/CustomizationContentModes.js +55 -0
  273. package/www/react-native/params/customization/CustomizationFonts.js +156 -0
  274. package/www/react-native/params/customization/CustomizationImages.js +199 -0
  275. package/www/react-native/params/customization/CustomizationMatrices.js +39 -0
  276. package/www/react-native/params/customization/CustomizationTimings.js +71 -0
  277. package/www/react-native/params/process_params/AuthenticityParams.js +166 -0
  278. package/www/react-native/params/process_params/AuthenticityPropertiesParams.js +39 -0
  279. package/www/react-native/params/process_params/BackendProcessingConfig.js +38 -0
  280. package/www/react-native/params/process_params/Bsi.js +23 -0
  281. package/www/react-native/params/process_params/FaceApiParams.js +55 -0
  282. package/www/react-native/params/process_params/FaceApiSearchParams.js +29 -0
  283. package/www/react-native/params/process_params/GlaresCheckParams.js +25 -0
  284. package/www/react-native/params/process_params/ImageQA.js +122 -0
  285. package/www/react-native/params/process_params/LivenessParams.js +87 -0
  286. package/www/react-native/params/process_params/OcclusionCheckParams.js +21 -0
  287. package/www/react-native/params/process_params/ProcessParams.js +724 -0
  288. package/www/react-native/params/process_params/RFIDParams.js +21 -0
  289. package/www/react-native/params/rfid_scenario/DTCDataGroup.js +63 -0
  290. package/www/react-native/params/rfid_scenario/EDLDataGroups.js +135 -0
  291. package/www/react-native/params/rfid_scenario/EIDDataGroups.js +191 -0
  292. package/www/react-native/params/rfid_scenario/EPassportDataGroups.js +151 -0
  293. package/www/react-native/params/rfid_scenario/RFIDScenario.js +584 -0
  294. package/www/react-native/results/DocumentType.js +302 -0
  295. package/www/react-native/results/Position.js +88 -0
  296. package/www/react-native/results/Results.js +354 -0
  297. package/www/react-native/results/TransactionInfo.js +24 -0
  298. package/www/react-native/results/authenticity/Authenticity.js +24 -0
  299. package/www/react-native/results/authenticity/AuthenticityCheck.js +43 -0
  300. package/www/react-native/results/authenticity/AuthenticityElement.js +37 -0
  301. package/www/react-native/results/authenticity/AuthenticityResult.js +33 -0
  302. package/www/react-native/results/authenticity/CheckDiagnose.js +133 -0
  303. package/www/react-native/results/authenticity/SecurityFeatureType.js +67 -0
  304. package/www/react-native/results/barcode/BarcodeField.js +34 -0
  305. package/www/react-native/results/barcode/BarcodeResult.js +30 -0
  306. package/www/react-native/results/barcode/BarcodeStatus.js +33 -0
  307. package/www/react-native/results/barcode/BarcodeType.js +21 -0
  308. package/www/react-native/results/barcode/PDF417Info.js +24 -0
  309. package/www/react-native/results/image_quality/ImageQuality.js +40 -0
  310. package/www/react-native/results/image_quality/ImageQualityCheckType.js +19 -0
  311. package/www/react-native/results/image_quality/ImageQualityGroup.js +39 -0
  312. package/www/react-native/results/rfid/AccessControlProcedureType.js +30 -0
  313. package/www/react-native/results/rfid/Application.js +63 -0
  314. package/www/react-native/results/rfid/Attribute.js +23 -0
  315. package/www/react-native/results/rfid/Authority.js +36 -0
  316. package/www/react-native/results/rfid/CardProperties.js +57 -0
  317. package/www/react-native/results/rfid/CertificateChain.js +69 -0
  318. package/www/react-native/results/rfid/CertificateData.js +21 -0
  319. package/www/react-native/results/rfid/DataField.js +23 -0
  320. package/www/react-native/results/rfid/Extension.js +21 -0
  321. package/www/react-native/results/rfid/File.js +56 -0
  322. package/www/react-native/results/rfid/FileData.js +27 -0
  323. package/www/react-native/results/rfid/RFIDAccessControlProcedureType.js +10 -0
  324. package/www/react-native/results/rfid/RFIDCertificateType.js +14 -0
  325. package/www/react-native/results/rfid/RFIDDataFileType.js +106 -0
  326. package/www/react-native/results/rfid/RFIDSessionData.js +92 -0
  327. package/www/react-native/results/rfid/RFIDValidity.js +23 -0
  328. package/www/react-native/results/rfid/RFIDValue.js +30 -0
  329. package/www/react-native/results/rfid/SecurityObject.js +41 -0
  330. package/www/react-native/results/rfid/SecurityObjectCertificates.js +20 -0
  331. package/www/react-native/results/rfid/SignerInfo.js +74 -0
  332. package/www/react-native/results/status/AgeStatus.js +35 -0
  333. package/www/react-native/results/status/CheckResult.js +5 -0
  334. package/www/react-native/results/status/OpticalStatus.js +44 -0
  335. package/www/react-native/results/status/RFIDStatus.js +38 -0
  336. package/www/react-native/results/status/ResultsStatus.js +53 -0
  337. package/www/react-native/results/visible_digital_seals/BytesData.js +27 -0
  338. package/www/react-native/results/visible_digital_seals/DocFeature.js +23 -0
  339. package/www/react-native/results/visible_digital_seals/LDSParsingErrorCodes.js +136 -0
  340. package/www/react-native/results/visible_digital_seals/LDSParsingNotificationCodes.js +239 -0
  341. package/www/react-native/results/visible_digital_seals/VDSData.js +75 -0
  342. package/www/react-native/results/visible_digital_seals/VDSNCData.js +54 -0
  343. package/www/react-native/results/visual_results/Comparison.js +27 -0
  344. package/www/react-native/results/visual_results/FieldType.js +671 -0
  345. package/www/react-native/results/visual_results/GraphicField.js +47 -0
  346. package/www/react-native/results/visual_results/GraphicFieldType.js +25 -0
  347. package/www/react-native/results/visual_results/GraphicResult.js +28 -0
  348. package/www/react-native/results/visual_results/LCID.js +174 -0
  349. package/www/react-native/results/visual_results/Lights.js +11 -0
  350. package/www/react-native/results/visual_results/RFIDOrigin.js +27 -0
  351. package/www/react-native/results/visual_results/Rect.js +27 -0
  352. package/www/react-native/results/visual_results/Symbol.js +26 -0
  353. package/www/react-native/results/visual_results/TextField.js +85 -0
  354. package/www/react-native/results/visual_results/TextResult.js +52 -0
  355. package/www/react-native/results/visual_results/TextSource.js +27 -0
  356. package/www/react-native/results/visual_results/Validity.js +24 -0
  357. package/www/react-native/results/visual_results/Value.js +52 -0
  358. package/www/react-native/rfid/CAProtocol.js +27 -0
  359. package/www/react-native/rfid/PAAttribute.js +24 -0
  360. package/www/react-native/rfid/PACEProtocol.js +24 -0
  361. package/www/react-native/rfid/PAResourcesIssuer.js +35 -0
  362. package/www/react-native/rfid/PKDCertificate.js +65 -0
  363. package/www/react-native/rfid/RFIDErrorCodes.js +123 -0
  364. package/www/react-native/rfid/RFIDNotification.js +71 -0
  365. package/www/react-native/rfid/TAChallenge.js +33 -0
  366. package/www/react-native/rfid/TccParams.js +34 -0
  367. package/www/types/config/FinalizeConfig.d.ts +6 -0
  368. package/www/types/config/InitConfig.d.ts +68 -0
  369. package/www/types/config/OnlineProcessingConfig.d.ts +22 -0
  370. package/www/types/config/RFIDConfig.d.ts +178 -0
  371. package/www/types/config/RecognizeConfig.d.ts +126 -0
  372. package/www/types/config/ScannerConfig.d.ts +54 -0
  373. package/www/types/index.d.ts +656 -0
  374. package/www/types/info/DocReaderException.d.ts +85 -0
  375. package/www/types/info/DocReaderScenario.d.ts +90 -0
  376. package/www/types/info/DocReaderVersion.d.ts +28 -0
  377. package/www/types/info/DocumentsDatabase.d.ts +42 -0
  378. package/www/types/info/License.d.ts +23 -0
  379. package/www/types/info/PrepareProgress.d.ts +15 -0
  380. package/www/types/info/RFIDException.d.ts +8 -0
  381. package/www/types/mdl/DataRetrieval.d.ts +28 -0
  382. package/www/types/mdl/DeviceEngagement.d.ts +16 -0
  383. package/www/types/mdl/DeviceRetrievalMethod.d.ts +18 -0
  384. package/www/types/mdl/DocumentRequestMDL.d.ts +63 -0
  385. package/www/types/mdl/NameSpaceMDL.d.ts +16 -0
  386. package/www/types/params/Functionality.d.ts +337 -0
  387. package/www/types/params/customization/Customization.d.ts +584 -0
  388. package/www/types/params/customization/CustomizationColors.d.ts +42 -0
  389. package/www/types/params/customization/CustomizationContentModes.d.ts +41 -0
  390. package/www/types/params/customization/CustomizationFonts.d.ts +63 -0
  391. package/www/types/params/customization/CustomizationImages.d.ts +34 -0
  392. package/www/types/params/customization/CustomizationMatrices.d.ts +10 -0
  393. package/www/types/params/customization/CustomizationTimings.d.ts +14 -0
  394. package/www/types/params/process_params/AuthenticityParams.d.ts +31 -0
  395. package/www/types/params/process_params/AuthenticityPropertiesParams.d.ts +12 -0
  396. package/www/types/params/process_params/BackendProcessingConfig.d.ts +27 -0
  397. package/www/types/params/process_params/Bsi.d.ts +3 -0
  398. package/www/types/params/process_params/FaceApiParams.d.ts +72 -0
  399. package/www/types/params/process_params/FaceApiSearchParams.d.ts +35 -0
  400. package/www/types/params/process_params/GlaresCheckParams.d.ts +26 -0
  401. package/www/types/params/process_params/ImageQA.d.ts +85 -0
  402. package/www/types/params/process_params/LivenessParams.d.ts +18 -0
  403. package/www/types/params/process_params/OcclusionCheckParams.d.ts +16 -0
  404. package/www/types/params/process_params/ProcessParams.d.ts +496 -0
  405. package/www/types/params/process_params/RFIDParams.d.ts +19 -0
  406. package/www/types/params/rfid_scenario/DTCDataGroup.d.ts +13 -0
  407. package/www/types/params/rfid_scenario/EDLDataGroups.d.ts +22 -0
  408. package/www/types/params/rfid_scenario/EIDDataGroups.d.ts +29 -0
  409. package/www/types/params/rfid_scenario/EPassportDataGroups.d.ts +24 -0
  410. package/www/types/params/rfid_scenario/RFIDScenario.d.ts +178 -0
  411. package/www/types/results/DocumentType.d.ts +525 -0
  412. package/www/types/results/Position.d.ts +50 -0
  413. package/www/types/results/Results.d.ts +295 -0
  414. package/www/types/results/TransactionInfo.d.ts +9 -0
  415. package/www/types/results/authenticity/Authenticity.d.ts +68 -0
  416. package/www/types/results/authenticity/AuthenticityCheck.d.ts +23 -0
  417. package/www/types/results/authenticity/AuthenticityElement.d.ts +26 -0
  418. package/www/types/results/authenticity/AuthenticityResult.d.ts +16 -0
  419. package/www/types/results/authenticity/CheckDiagnose.d.ts +242 -0
  420. package/www/types/results/authenticity/SecurityFeatureType.d.ts +110 -0
  421. package/www/types/results/barcode/BarcodeField.d.ts +37 -0
  422. package/www/types/results/barcode/BarcodeResult.d.ts +14 -0
  423. package/www/types/results/barcode/BarcodeStatus.d.ts +66 -0
  424. package/www/types/results/barcode/BarcodeType.d.ts +45 -0
  425. package/www/types/results/barcode/PDF417Info.d.ts +15 -0
  426. package/www/types/results/image_quality/ImageQuality.d.ts +18 -0
  427. package/www/types/results/image_quality/ImageQualityCheckType.d.ts +30 -0
  428. package/www/types/results/image_quality/ImageQualityGroup.d.ts +17 -0
  429. package/www/types/results/rfid/AccessControlProcedureType.d.ts +21 -0
  430. package/www/types/results/rfid/Application.d.ts +48 -0
  431. package/www/types/results/rfid/Attribute.d.ts +9 -0
  432. package/www/types/results/rfid/Authority.d.ts +11 -0
  433. package/www/types/results/rfid/CardProperties.d.ts +48 -0
  434. package/www/types/results/rfid/CertificateChain.d.ts +28 -0
  435. package/www/types/results/rfid/CertificateData.d.ts +7 -0
  436. package/www/types/results/rfid/DataField.d.ts +9 -0
  437. package/www/types/results/rfid/Extension.d.ts +7 -0
  438. package/www/types/results/rfid/File.d.ts +22 -0
  439. package/www/types/results/rfid/FileData.d.ts +9 -0
  440. package/www/types/results/rfid/RFIDAccessControlProcedureType.d.ts +18 -0
  441. package/www/types/results/rfid/RFIDCertificateType.d.ts +14 -0
  442. package/www/types/results/rfid/RFIDDataFileType.d.ts +108 -0
  443. package/www/types/results/rfid/RFIDSessionData.d.ts +48 -0
  444. package/www/types/results/rfid/RFIDValidity.d.ts +9 -0
  445. package/www/types/results/rfid/RFIDValue.d.ts +10 -0
  446. package/www/types/results/rfid/SecurityObject.d.ts +28 -0
  447. package/www/types/results/rfid/SecurityObjectCertificates.d.ts +8 -0
  448. package/www/types/results/rfid/SignerInfo.d.ts +41 -0
  449. package/www/types/results/status/AgeStatus.d.ts +14 -0
  450. package/www/types/results/status/CheckResult.d.ts +8 -0
  451. package/www/types/results/status/OpticalStatus.d.ts +29 -0
  452. package/www/types/results/status/RFIDStatus.d.ts +22 -0
  453. package/www/types/results/status/ResultsStatus.d.ts +32 -0
  454. package/www/types/results/visible_digital_seals/BytesData.d.ts +9 -0
  455. package/www/types/results/visible_digital_seals/DocFeature.d.ts +9 -0
  456. package/www/types/results/visible_digital_seals/LDSParsingErrorCodes.d.ts +134 -0
  457. package/www/types/results/visible_digital_seals/LDSParsingNotificationCodes.d.ts +237 -0
  458. package/www/types/results/visible_digital_seals/VDSData.d.ts +32 -0
  459. package/www/types/results/visible_digital_seals/VDSNCData.d.ts +35 -0
  460. package/www/types/results/visual_results/Comparison.d.ts +15 -0
  461. package/www/types/results/visual_results/FieldType.d.ts +1328 -0
  462. package/www/types/results/visual_results/GraphicField.d.ts +29 -0
  463. package/www/types/results/visual_results/GraphicFieldType.d.ts +52 -0
  464. package/www/types/results/visual_results/GraphicResult.d.ts +10 -0
  465. package/www/types/results/visual_results/LCID.d.ts +173 -0
  466. package/www/types/results/visual_results/Lights.d.ts +23 -0
  467. package/www/types/results/visual_results/RFIDOrigin.d.ts +10 -0
  468. package/www/types/results/visual_results/Rect.d.ts +9 -0
  469. package/www/types/results/visual_results/Symbol.d.ts +14 -0
  470. package/www/types/results/visual_results/TextField.d.ts +40 -0
  471. package/www/types/results/visual_results/TextResult.d.ts +23 -0
  472. package/www/types/results/visual_results/TextSource.d.ts +15 -0
  473. package/www/types/results/visual_results/Validity.d.ts +13 -0
  474. package/www/types/results/visual_results/Value.d.ts +27 -0
  475. package/www/types/rfid/CAProtocol.d.ts +6 -0
  476. package/www/types/rfid/PAAttribute.d.ts +4 -0
  477. package/www/types/rfid/PACEProtocol.d.ts +5 -0
  478. package/www/types/rfid/PAResourcesIssuer.d.ts +7 -0
  479. package/www/types/rfid/PKDCertificate.d.ts +40 -0
  480. package/www/types/rfid/RFIDErrorCodes.d.ts +121 -0
  481. package/www/types/rfid/RFIDNotification.d.ts +156 -0
  482. package/www/types/rfid/TAChallenge.d.ts +7 -0
  483. package/www/types/rfid/TccParams.d.ts +25 -0
@@ -0,0 +1,101 @@
1
+ @file:Suppress("unused", "UNUSED_PARAMETER")
2
+
3
+ package com.regula.plugin.document.reader
4
+
5
+ import android.app.Activity
6
+ import android.content.Context
7
+ import android.content.Intent
8
+ import android.util.Log
9
+ import androidx.appcompat.app.AppCompatActivity
10
+ import androidx.lifecycle.Lifecycle
11
+ import com.facebook.react.ReactPackage
12
+ import com.facebook.react.bridge.ActivityEventListener
13
+ import com.facebook.react.bridge.Promise
14
+ import com.facebook.react.bridge.ReactApplicationContext
15
+ import com.facebook.react.bridge.ReactContext
16
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
17
+ import com.facebook.react.bridge.ReactMethod
18
+ import com.facebook.react.bridge.ReadableArray
19
+ import com.facebook.react.modules.core.DeviceEventManagerModule
20
+ import com.facebook.react.modules.core.PermissionAwareActivity
21
+ import com.facebook.react.uimanager.ViewManager
22
+ import org.json.JSONArray
23
+ import org.json.JSONObject
24
+
25
+ var listenerCount = 0
26
+
27
+ lateinit var args: JSONArray
28
+ lateinit var binding: ReactContext
29
+ val context: Context
30
+ get() = binding.applicationContext
31
+ val activity: Activity
32
+ get() = binding.currentActivity!!
33
+ val lifecycle: Lifecycle
34
+ get() = (activity as AppCompatActivity).lifecycle
35
+
36
+ fun sendEvent(event: String, data: Any? = "") {
37
+ if (listenerCount <= 0) return
38
+ val result = if (data is JSONObject || data is JSONArray) data.toString() else data.toString() + ""
39
+ binding.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit(event, result)
40
+ }
41
+
42
+ @Suppress("UNCHECKED_CAST")
43
+ fun <T> argsNullable(index: Int): T? {
44
+ val value = args[index]
45
+ if (value is Double && value % 1 == 0.0) return value.toInt() as T
46
+ if (value.toString() == "null") return null
47
+ return value as T
48
+ }
49
+
50
+ fun requestPermissions(activity: Activity, permissions: Array<String>, requestCode: Int) {
51
+ (activity as PermissionAwareActivity).requestPermissions(permissions, requestCode) { code, perms, grantResults ->
52
+ onRequestPermissionsResult(code, perms, grantResults)
53
+ }
54
+ }
55
+
56
+ fun startActivityForResult(activity: Activity, intent: Intent, requestCode: Int) {
57
+ activity.startActivityForResult(intent, requestCode)
58
+ }
59
+
60
+ class RNDocumentReaderPackage : ReactPackage {
61
+ override fun createNativeModules(reactContext: ReactApplicationContext) = listOf(RNDocumentReaderModule(reactContext))
62
+ override fun createViewManagers(reactContext: ReactApplicationContext) = emptyList<ViewManager<*, *>>()
63
+ }
64
+
65
+ class RNDocumentReaderModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), ActivityEventListener {
66
+ init {
67
+ binding = reactContext
68
+ binding.addActivityEventListener(this)
69
+ }
70
+
71
+ @ReactMethod
72
+ fun addListener(eventName: String) {
73
+ listenerCount += 1
74
+ }
75
+
76
+ @ReactMethod
77
+ fun removeListeners(count: Int) {
78
+ listenerCount -= count
79
+ }
80
+
81
+ override fun onNewIntent(intent: Intent) {
82
+ newIntent(intent)
83
+ }
84
+
85
+ override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
86
+ onActivityResult(requestCode, resultCode, data)
87
+ }
88
+
89
+ @ReactMethod
90
+ fun exec(method: String, arguments: ReadableArray, promise: Promise) {
91
+ args = JSONArray(arguments.toArrayList())
92
+ try {
93
+ methodCall(method) { data -> promise.resolve(data.toSendable()) }
94
+ } catch (error: Throwable) {
95
+ Log.e("REGULA", "Caught an exception in \"$method\" function:", error)
96
+ promise.reject(Throwable("Unexpected error, check logs for details"))
97
+ }
98
+ }
99
+
100
+ override fun getName() = "RNDocumentReader"
101
+ }
@@ -0,0 +1,248 @@
1
+ @file:SuppressLint("UseKtx")
2
+
3
+ package com.regula.plugin.document.reader
4
+
5
+ import android.annotation.SuppressLint
6
+ import android.graphics.Bitmap
7
+ import android.graphics.BitmapFactory
8
+ import android.graphics.Canvas
9
+ import android.graphics.drawable.BitmapDrawable
10
+ import android.graphics.drawable.Drawable
11
+ import android.util.Base64
12
+ import org.json.JSONArray
13
+ import org.json.JSONObject
14
+ import java.io.ByteArrayOutputStream
15
+ import java.lang.reflect.Constructor
16
+ import kotlin.math.sqrt
17
+ import kotlin.reflect.KClass
18
+
19
+ fun List<*>.toJson(): JSONArray {
20
+ val result = JSONArray()
21
+ for (i in indices)
22
+ when (val v = this[i]) {
23
+ null -> result.put(null)
24
+ is Map<*, *> -> result.put(v.toJson())
25
+ is List<*> -> result.put(v.toJson())
26
+ else -> result.put(v)
27
+ }
28
+ return result
29
+ }
30
+
31
+ fun Map<*, *>.toJson(): JSONObject {
32
+ val result = JSONObject()
33
+ for ((k, v) in this) {
34
+ when (v) {
35
+ null -> result.put(k as String, null)
36
+ is Map<*, *> -> result.put(k as String, v.toJson())
37
+ is List<*> -> result.put(k as String, v.toJson())
38
+ else -> result.put(k as String, v)
39
+ }
40
+ }
41
+ return result
42
+ }
43
+
44
+ fun Any?.toSendable(): Any? = this?.let {
45
+ if (it is JSONObject || it is JSONArray) it.toString()
46
+ else it
47
+ }
48
+
49
+ fun <T> List<T>?.toJson(toJson: (T?) -> Any?) = this?.let {
50
+ val result = JSONArray()
51
+ for (item in it) result.put(toJson(item))
52
+ result
53
+ }
54
+
55
+ fun <T> List<T>?.toJsonNullable(toJson: (T?) -> Any?) = this?.let {
56
+ val result = JSONArray()
57
+ for (item in it) result.put(toJson(item))
58
+ result
59
+ }
60
+
61
+ fun <T> JSONArray?.toList(fromJson: (JSONObject) -> T) = this?.let {
62
+ val result: MutableList<T> = ArrayList()
63
+ for (i in 0 until it.length()) result.add(fromJson(it.getJSONObject(i)))
64
+ result
65
+ }
66
+
67
+ fun <T> JSONArray.toList() = this.let {
68
+ val result = mutableListOf<T>()
69
+ @Suppress("UNCHECKED_CAST")
70
+ for (i in 0 until length()) result.add(get(i) as T)
71
+ result
72
+ }
73
+
74
+ inline fun <reified T> JSONArray?.toArray() = this?.let {
75
+ val result = arrayOfNulls<T>(length())
76
+ for (i in 0 until length()) result[i] = get(i) as T
77
+ result
78
+ }
79
+
80
+ inline fun <reified T> JSONArray?.toArray(fromJson: (JSONObject?) -> T) = this?.let {
81
+ val result = arrayOfNulls<T>(length())
82
+ for (i in 0 until length()) result[i] = fromJson(getJSONObject(i))
83
+ result
84
+ }
85
+
86
+ fun <T> Array<T>?.toJson() = this?.let {
87
+ val result = JSONArray()
88
+ for (i in it.indices) result.put(i, it[i])
89
+ result
90
+ }
91
+
92
+ fun <T> Array<T>?.toJson(toJson: (T?) -> JSONObject?) = this?.let {
93
+ val result = JSONArray()
94
+ for (i in indices) result.put(i, toJson(this[i]))
95
+ result
96
+ }
97
+
98
+ fun Any?.toIntArray() = (this as JSONArray?)?.let {
99
+ val result = IntArray(it.length())
100
+ for (i in 0 until it.length()) result[i] = it.getInt(i)
101
+ result
102
+ }
103
+
104
+ fun IntArray?.toJson() = this?.let {
105
+ val result = JSONArray()
106
+ for (i in it.indices) result.put(i, it[i])
107
+ result
108
+ }
109
+
110
+ fun JSONArray.toLongArray(): LongArray {
111
+ val result = LongArray(length())
112
+ for (i in 0 until length()) result[i] = getLong(i)
113
+ return result
114
+ }
115
+
116
+ fun LongArray.toJson(): JSONArray {
117
+ val result = JSONArray()
118
+ for (i in indices) result.put(i, this[i])
119
+ return result
120
+ }
121
+
122
+ fun JSONObject.forEach(action: (String, Any) -> Unit) {
123
+ val keys: Iterator<String> = keys()
124
+ while (keys.hasNext()) {
125
+ val key = keys.next()
126
+ action(key, get(key))
127
+ }
128
+ }
129
+
130
+ fun JSONObject.getJSONObjectOrNull(name: String): JSONObject? {
131
+ if (has(name) && get(name).toString() != "null") return getJSONObject(name)
132
+ return null
133
+ }
134
+
135
+ fun JSONObject.getIntOrNull(name: String): Int? {
136
+ if (has(name) && get(name).toString() != "null") return getInt(name)
137
+ return null
138
+ }
139
+
140
+ fun JSONObject.getLongOrNull(name: String): Long? {
141
+ if (has(name) && get(name).toString() != "null") return getLong(name)
142
+ return null
143
+ }
144
+
145
+ fun JSONObject.getDoubleOrNull(name: String): Double? {
146
+ if (has(name) && get(name).toString() != "null") return getDouble(name)
147
+ return null
148
+ }
149
+
150
+ fun JSONObject.getBooleanOrNull(name: String): Boolean? {
151
+ if (has(name) && get(name).toString() != "null") return getBoolean(name)
152
+ return null
153
+ }
154
+
155
+ fun JSONObject.getStringOrNull(name: String): String? {
156
+ if (has(name) && get(name).toString() != "null") return getString(name)
157
+ return null
158
+ }
159
+
160
+ fun JSONObject.getJSONArrayOrNull(name: String): JSONArray? {
161
+ if (has(name) && get(name).toString() != "null") return getJSONArray(name)
162
+ return null
163
+ }
164
+
165
+ fun <T : Any> KClass<T>.constructor(vararg argTypes: KClass<*>): Constructor<T> {
166
+ val types = mutableListOf<Class<*>>()
167
+ for (argType in argTypes) types.add(argType.java)
168
+ return java.getDeclaredConstructor(*types.toTypedArray())
169
+ }
170
+
171
+ fun <T : Any> Constructor<T>.instantiate(vararg args: Any?): T {
172
+ isAccessible = true
173
+ return newInstance(*args)
174
+ }
175
+
176
+ fun <T : Any> T.setPrivateProperty(varName: String, data: Any?) {
177
+ try {
178
+ setPrivateProperty(javaClass, varName, data)
179
+ } catch (_: java.lang.Exception) {
180
+ try {
181
+ setPrivateProperty(javaClass.superclass!!, varName, data)
182
+ } catch (_: java.lang.Exception) {
183
+ }
184
+ }
185
+ }
186
+
187
+ fun <T : Any> T.setPrivateProperty(clazz: Class<T>, varName: String, data: Any?) = clazz.getDeclaredField(varName).let {
188
+ it.isAccessible = true
189
+ it.set(this, data)
190
+ }
191
+
192
+ fun <T : Any> T.getPrivateProperty(varName: String): Any? {
193
+ var clazz: Class<*>? = this.javaClass
194
+ while (clazz != null) {
195
+ try {
196
+ val field = clazz.getDeclaredField(varName)
197
+ field.isAccessible = true
198
+ return field.get(this)
199
+ } catch (_: NoSuchFieldException) {
200
+ clazz = clazz.superclass
201
+ }
202
+ }
203
+ throw NoSuchFieldException(
204
+ "Field '$varName' not found in class hierarchy of ${this.javaClass.name}"
205
+ )
206
+ }
207
+
208
+ internal object Convert {
209
+ fun String?.toByteArray(): ByteArray? {
210
+ var str = this ?: return null
211
+ if (str.startsWith("data")) str = str.substring(str.indexOf(",") + 1)
212
+ return Base64.decode(str, Base64.NO_WRAP)
213
+ }
214
+
215
+ fun ByteArray?.toBase64() = this?.let { Base64.encodeToString(it, Base64.NO_WRAP) }
216
+
217
+ fun Bitmap?.toBase64() = this?.let {
218
+ val byteArrayOutputStream = ByteArrayOutputStream()
219
+ it.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream)
220
+ byteArrayOutputStream.toByteArray().toBase64()
221
+ }
222
+
223
+ fun String?.toBitmap() = this?.let {
224
+ val decodedString = toByteArray()!!
225
+ var result = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.size)
226
+ val sizeMultiplier = result.byteCount / 5000000
227
+ if (result.byteCount > 5000000) result = Bitmap.createScaledBitmap(result, result.width / sqrt(sizeMultiplier.toDouble()).toInt(), result.height / sqrt(sizeMultiplier.toDouble()).toInt(), false)
228
+ result
229
+ }
230
+
231
+ fun Any?.toDrawable() = (this as String?)?.let {
232
+ val decodedByte = it.toByteArray()!!
233
+ val bitmap = BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.size)
234
+ val density = context.resources.displayMetrics.density
235
+ val width = (bitmap.width * density).toInt()
236
+ val height = (bitmap.height * density).toInt()
237
+ BitmapDrawable(context.resources, Bitmap.createScaledBitmap(bitmap, width, height, false))
238
+ }
239
+
240
+ fun Drawable?.toBase64(): String? = this?.let {
241
+ if (this is BitmapDrawable) if (bitmap != null) return bitmap.toBase64()
242
+ val bitmap: Bitmap = if (intrinsicWidth <= 0 || intrinsicHeight <= 0) Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) else Bitmap.createBitmap(intrinsicWidth, intrinsicHeight, Bitmap.Config.ARGB_8888)
243
+ val canvas = Canvas(bitmap)
244
+ setBounds(0, 0, canvas.width, canvas.height)
245
+ draw(canvas)
246
+ bitmap.toBase64()
247
+ }
248
+ }
package/app.plugin.js ADDED
@@ -0,0 +1,45 @@
1
+ module.exports = function withRegulaPodSources(config) {
2
+ const { createRequire } = require('module');
3
+ const { join } = require('path');
4
+ const projectRoot = config._internal?.projectRoot ?? process.cwd();
5
+ const appRequire = createRequire(join(projectRoot, 'package.json'));
6
+ const { withPodfile } = appRequire('expo/config-plugins');
7
+
8
+ const SOURCES = [
9
+ 'https://github.com/CocoaPods/Specs.git',
10
+ 'https://github.com/regulaforensics/podspecs.git',
11
+ ];
12
+
13
+ return withPodfile(config, (config) => {
14
+ let podfile = config.modResults.contents;
15
+
16
+ const missingSources = SOURCES.filter(
17
+ (source) =>
18
+ !podfile.includes(`source '${source}'`) &&
19
+ !podfile.includes(`source "${source}"`)
20
+ );
21
+
22
+ if (missingSources.length === 0) {
23
+ return config;
24
+ }
25
+
26
+ const header = [
27
+ '# ============================================================================',
28
+ '# Regula Pod Sources',
29
+ '# Added automatically by @regulaforensics/document-reader',
30
+ '#',
31
+ '# Sources:',
32
+ ...SOURCES.map((s) => `# - ${s}`),
33
+ '# ============================================================================',
34
+ '',
35
+ ...missingSources.map((s) => `source '${s}'`),
36
+ '',
37
+ '',
38
+ '',
39
+ ].join('\n');
40
+
41
+ config.modResults.contents = header + podfile;
42
+
43
+ return config;
44
+ });
45
+ };
@@ -0,0 +1,24 @@
1
+ # Regula Document Reader Capacitor demo application
2
+
3
+ Requires Node.js 22+, Xcode 26+, Android Studio with JDK 21+ and Android SDK 37.
4
+
5
+ ## How to build demo application
6
+ 1. Download or the clone current repository using the command `git clone https://github.com/regulaforensics/npm-document-reader.git`.
7
+ 2. Put `regula.license` file at `public/assets/` (you can get a trial license [here](https://client.regulaforensics.com)).
8
+ 3. Put `db.dat` file at `public/assets/` (you can get a trial database [here](https://client.regulaforensics.com/customer/databases))
9
+ 4. Execute `npm run setup` within this directory.
10
+ 5. Run the app:
11
+ * IOS: `npm run ios`.
12
+ * Android: `npm run android`.
13
+
14
+ **Note**: this is just one way of running the app. You can also pass `-- -o` or `-- --open` argument to the command, and this will open Xcode/Android Studio, then run the app directly from the IDE. Overall, this is a more consistent way, so if you're having troubles running the app from terminal, try running it from the IDE.
15
+
16
+ ## Additional examples
17
+
18
+ ### Bluetooth device
19
+
20
+ In order to connect to an external scanning device, change the `useBtDevice` constant to true in `src/extra/bt_device`, and set `btDeviceName` to the name of your device. After running the app, click `Connect`.
21
+
22
+ ### RFID self hosted UI
23
+
24
+ This app also demonstraits how you can implement your own UI for the RFID reading process. To enable it, change the `useRfidSelfHostedUI` constant to true in `src/extra/custom_rfid`. Run the app and initiate RFID reading.
@@ -0,0 +1,41 @@
1
+ apply plugin: 'com.android.application'
2
+
3
+ android {
4
+ namespace = "com.regula.example.dr.capacitor"
5
+ compileSdkVersion rootProject.ext.compileSdkVersion
6
+ defaultConfig {
7
+ applicationId "com.regula.example.dr.capacitor"
8
+ minSdkVersion rootProject.ext.minSdkVersion
9
+ targetSdkVersion rootProject.ext.targetSdkVersion
10
+ versionCode 1
11
+ versionName "1.0"
12
+ aaptOptions {
13
+ // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
14
+ // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
15
+ ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
16
+ }
17
+ }
18
+ buildTypes {
19
+ release {
20
+ minifyEnabled false
21
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22
+ }
23
+ }
24
+ }
25
+
26
+ repositories {
27
+ flatDir{
28
+ dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
29
+ }
30
+ }
31
+
32
+ dependencies {
33
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
34
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
35
+ implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
36
+ implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
37
+ implementation project(':capacitor-android')
38
+ implementation project(':capacitor-cordova-android-plugins')
39
+ }
40
+
41
+ apply from: 'capacitor.build.gradle'
@@ -0,0 +1,21 @@
1
+ # Add project specific ProGuard rules here.
2
+ # You can control the set of applied configuration files using the
3
+ # proguardFiles setting in build.gradle.
4
+ #
5
+ # For more details, see
6
+ # http://developer.android.com/guide/developing/tools/proguard.html
7
+
8
+ # If your project uses WebView with JS, uncomment the following
9
+ # and specify the fully qualified class name to the JavaScript interface
10
+ # class:
11
+ #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
+ # public *;
13
+ #}
14
+
15
+ # Uncomment this to preserve the line number information for
16
+ # debugging stack traces.
17
+ #-keepattributes SourceFile,LineNumberTable
18
+
19
+ # If you keep the line number information, uncomment this to
20
+ # hide the original source file name.
21
+ #-renamesourcefileattribute SourceFile
@@ -0,0 +1,36 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <application
4
+ android:allowBackup="true"
5
+ android:icon="@drawable/launcher"
6
+ android:label="Document"
7
+ android:supportsRtl="true"
8
+ android:theme="@style/AppTheme"
9
+ android:usesCleartextTraffic="true">
10
+ <activity
11
+ android:name=".MainActivity"
12
+ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"
13
+ android:exported="true"
14
+ android:launchMode="singleTask"
15
+ android:screenOrientation="portrait"
16
+ android:theme="@style/AppTheme.NoActionBarLaunch">
17
+ <intent-filter>
18
+ <action android:name="android.intent.action.MAIN" />
19
+ <category android:name="android.intent.category.LAUNCHER" />
20
+ </intent-filter>
21
+ </activity>
22
+ <provider
23
+ android:name="androidx.core.content.FileProvider"
24
+ android:authorities="${applicationId}.fileprovider"
25
+ android:exported="false"
26
+ android:grantUriPermissions="true">
27
+ <meta-data
28
+ android:name="android.support.FILE_PROVIDER_PATHS"
29
+ android:resource="@xml/file_paths" />
30
+ </provider>
31
+ </application>
32
+
33
+ <uses-permission android:name="android.permission.NFC" />
34
+ <uses-permission android:name="android.permission.INTERNET" />
35
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
36
+ </manifest>
@@ -0,0 +1,5 @@
1
+ package com.regula.example.dr.capacitor;
2
+
3
+ import com.getcapacitor.BridgeActivity;
4
+
5
+ public class MainActivity extends BridgeActivity {}
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <foreground android:drawable="@drawable/ic_launcher_foreground"/>
4
+ </adaptive-icon>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <foreground android:drawable="@drawable/ic_launcher_foreground"/>
4
+ </adaptive-icon>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:app="http://schemas.android.com/apk/res-auto"
4
+ xmlns:tools="http://schemas.android.com/tools"
5
+ android:layout_width="match_parent"
6
+ android:layout_height="match_parent"
7
+ tools:context=".MainActivity">
8
+
9
+ <WebView
10
+ android:layout_width="match_parent"
11
+ android:layout_height="match_parent" />
12
+ </androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+
4
+ <!-- Base application theme. -->
5
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
6
+ <!-- Customize your theme here. -->
7
+ <item name="colorPrimary">@color/colorPrimary</item>
8
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
9
+ <item name="colorAccent">@color/colorAccent</item>
10
+ </style>
11
+
12
+ <style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
13
+ <item name="windowActionBar">false</item>
14
+ <item name="windowNoTitle">true</item>
15
+ <item name="android:background">@null</item>
16
+ </style>
17
+
18
+
19
+ <style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
20
+ <item name="android:background">@drawable/splash</item>
21
+ </style>
22
+ </resources>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <paths xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <external-files-path name="images" path="Pictures/" />
4
+ <cache-path name="cache_images" path="." />
5
+ </paths>
@@ -0,0 +1,39 @@
1
+ // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+ buildscript {
4
+
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+ dependencies {
10
+ classpath 'com.android.tools.build:gradle:9.4.0'
11
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.4.20"
12
+
13
+ // NOTE: Do not place your application dependencies here; they belong
14
+ // in the individual module build.gradle files
15
+ }
16
+ }
17
+
18
+ apply from: "variables.gradle"
19
+
20
+ allprojects {
21
+ repositories {
22
+ google()
23
+ mavenCentral()
24
+ }
25
+ }
26
+
27
+ task clean(type: Delete) {
28
+ delete rootProject.buildDir
29
+ }
30
+
31
+ // Use the JDK running Gradle, while keeping Capacitor's Java 21 bytecode target.
32
+ subprojects {
33
+ afterEvaluate {
34
+ if (plugins.hasPlugin('org.jetbrains.kotlin.android')) {
35
+ kotlin.jvmToolchain(JavaVersion.current().majorVersion.toInteger())
36
+ kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,7 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
6
+ zipStoreBase=GRADLE_USER_HOME
7
+ zipStorePath=wrapper/dists
@@ -0,0 +1,26 @@
1
+ # Project-wide Gradle settings.
2
+
3
+ # IDE (e.g. Android Studio) users:
4
+ # Gradle settings configured through the IDE *will override*
5
+ # any settings specified in this file.
6
+
7
+ # For more details on how to configure your build environment visit
8
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+ # Specifies the JVM arguments used for the daemon process.
11
+ # The setting is particularly useful for tweaking memory settings.
12
+ org.gradle.jvmargs=-Xmx1536m
13
+
14
+ # When configured, Gradle will run in incubating parallel mode.
15
+ # This option should only be used with decoupled projects. More details, visit
16
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17
+ # org.gradle.parallel=true
18
+
19
+ # AndroidX package structure to make it clearer which packages are bundled with the
20
+ # Android operating system, and which are packaged with your app's APK
21
+ # https://developer.android.com/topic/libraries/support-library/androidx-rn
22
+ android.useAndroidX=true
23
+
24
+ # Required by Capacitor and its generated Cordova plugin module on AGP 9.
25
+ android.newDsl=false
26
+ android.builtInKotlin=false