@ha_tecno/live-id-sdk 1.0.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (429) hide show
  1. package/android/build.gradle +4 -0
  2. package/lib/commonjs/components/{WaitingForResult → CameraConfigInfo}/index.js +9 -11
  3. package/lib/commonjs/components/CameraConfigInfo/index.js.map +1 -0
  4. package/lib/commonjs/components/CameraConfigInfo/styles.js +20 -0
  5. package/lib/commonjs/components/CameraConfigInfo/styles.js.map +1 -0
  6. package/lib/commonjs/components/CaptureButton/index.js +88 -0
  7. package/lib/commonjs/components/CaptureButton/index.js.map +1 -0
  8. package/lib/commonjs/components/CaptureButton/styles.js +22 -0
  9. package/lib/commonjs/components/CaptureButton/styles.js.map +1 -0
  10. package/lib/commonjs/components/Gabarito/index.js +2 -2
  11. package/lib/commonjs/components/Gabarito/index.js.map +1 -1
  12. package/lib/commonjs/components/Gabarito/styles.js +10 -11
  13. package/lib/commonjs/components/Gabarito/styles.js.map +1 -1
  14. package/lib/commonjs/components/HelpRegister/index.js +51 -0
  15. package/lib/commonjs/components/HelpRegister/index.js.map +1 -0
  16. package/lib/commonjs/{screens/CadastroFinger/components/AjudaCadastro → components/HelpRegister}/styles.js +17 -20
  17. package/lib/commonjs/components/HelpRegister/styles.js.map +1 -0
  18. package/lib/commonjs/components/Toast/Toast.js +12 -12
  19. package/lib/commonjs/components/Toast/Toast.js.map +1 -1
  20. package/lib/commonjs/components/deviceNotFound/deviceNotFound.js +27 -0
  21. package/lib/commonjs/components/deviceNotFound/deviceNotFound.js.map +1 -0
  22. package/lib/commonjs/components/deviceNotFound/styles.js +36 -0
  23. package/lib/commonjs/components/deviceNotFound/styles.js.map +1 -0
  24. package/lib/commonjs/components/icon/icon.js +22 -0
  25. package/lib/commonjs/components/icon/icon.js.map +1 -0
  26. package/lib/commonjs/components/index.js +56 -0
  27. package/lib/commonjs/components/index.js.map +1 -0
  28. package/lib/commonjs/components/modalMessage/modalMessage.js +63 -0
  29. package/lib/commonjs/components/modalMessage/modalMessage.js.map +1 -0
  30. package/lib/commonjs/components/modalMessage/styles.js +51 -0
  31. package/lib/commonjs/components/modalMessage/styles.js.map +1 -0
  32. package/lib/commonjs/components/recordButton/recordButton.js +83 -0
  33. package/lib/commonjs/components/recordButton/recordButton.js.map +1 -0
  34. package/lib/commonjs/components/recordButton/styles.js +21 -0
  35. package/lib/commonjs/components/recordButton/styles.js.map +1 -0
  36. package/lib/commonjs/index.js +9 -11
  37. package/lib/commonjs/index.js.map +1 -1
  38. package/lib/commonjs/screens/CadastroScreen/CadastroScreen.js +29 -29
  39. package/lib/commonjs/screens/CadastroScreen/CadastroScreen.js.map +1 -1
  40. package/lib/commonjs/screens/FingerAuth/FingerAuth.js +128 -0
  41. package/lib/commonjs/screens/FingerAuth/FingerAuth.js.map +1 -0
  42. package/lib/commonjs/screens/FingerAuth/styles.js +35 -0
  43. package/lib/commonjs/screens/FingerAuth/styles.js.map +1 -0
  44. package/lib/commonjs/screens/FingerRegister/index.js +138 -0
  45. package/lib/commonjs/screens/FingerRegister/index.js.map +1 -0
  46. package/lib/commonjs/screens/FingerRegister/styles.js +35 -0
  47. package/lib/commonjs/screens/FingerRegister/styles.js.map +1 -0
  48. package/lib/commonjs/screens/LifeCertificate/index.js +145 -0
  49. package/lib/commonjs/screens/LifeCertificate/index.js.map +1 -0
  50. package/lib/commonjs/screens/LifeCertificate/styles.js +27 -0
  51. package/lib/commonjs/screens/LifeCertificate/styles.js.map +1 -0
  52. package/lib/commonjs/screens/index.js +28 -0
  53. package/lib/commonjs/screens/index.js.map +1 -0
  54. package/lib/commonjs/services/index.js +35 -101
  55. package/lib/commonjs/services/index.js.map +1 -1
  56. package/lib/commonjs/services/services.js +134 -0
  57. package/lib/commonjs/services/services.js.map +1 -0
  58. package/lib/commonjs/services/types.js +2 -0
  59. package/lib/commonjs/{types/screen.js.map → services/types.js.map} +1 -1
  60. package/lib/commonjs/store/createSelectors.js +16 -0
  61. package/lib/commonjs/store/createSelectors.js.map +1 -0
  62. package/lib/commonjs/store/modules/fingerAuth/index.js +19 -0
  63. package/lib/commonjs/store/modules/fingerAuth/index.js.map +1 -0
  64. package/lib/commonjs/store/modules/fingerAuth/selectors.js +13 -0
  65. package/lib/commonjs/store/modules/fingerAuth/selectors.js.map +1 -0
  66. package/lib/commonjs/store/modules/fingerAuth/slice.js +92 -0
  67. package/lib/commonjs/store/modules/fingerAuth/slice.js.map +1 -0
  68. package/lib/commonjs/store/modules/fingerAuth/type.js +2 -0
  69. package/lib/commonjs/store/modules/fingerAuth/type.js.map +1 -0
  70. package/lib/commonjs/store/modules/fingerRegister/index.js +19 -0
  71. package/lib/commonjs/store/modules/fingerRegister/index.js.map +1 -0
  72. package/lib/commonjs/store/modules/fingerRegister/selectors.js +13 -0
  73. package/lib/commonjs/store/modules/fingerRegister/selectors.js.map +1 -0
  74. package/lib/commonjs/store/modules/fingerRegister/slice.js +101 -0
  75. package/lib/commonjs/store/modules/fingerRegister/slice.js.map +1 -0
  76. package/lib/commonjs/store/modules/fingerRegister/types.js +2 -0
  77. package/lib/commonjs/store/modules/fingerRegister/types.js.map +1 -0
  78. package/lib/commonjs/store/modules/lifeCertificate/index.js +19 -0
  79. package/lib/commonjs/store/modules/lifeCertificate/index.js.map +1 -0
  80. package/lib/commonjs/store/modules/lifeCertificate/selectors.js +13 -0
  81. package/lib/commonjs/store/modules/lifeCertificate/selectors.js.map +1 -0
  82. package/lib/commonjs/store/modules/lifeCertificate/slice.js +101 -0
  83. package/lib/commonjs/store/modules/lifeCertificate/slice.js.map +1 -0
  84. package/lib/commonjs/store/modules/lifeCertificate/types.js +6 -0
  85. package/lib/commonjs/store/modules/lifeCertificate/types.js.map +1 -0
  86. package/lib/commonjs/utils/file.js +2 -2
  87. package/lib/commonjs/utils/getConfigCamera.js +1 -1
  88. package/lib/commonjs/utils/getConfigCamera.js.map +1 -1
  89. package/lib/module/components/CameraConfigInfo/index.js +15 -0
  90. package/lib/module/components/CameraConfigInfo/index.js.map +1 -0
  91. package/lib/module/components/CameraConfigInfo/styles.js +14 -0
  92. package/lib/module/components/CameraConfigInfo/styles.js.map +1 -0
  93. package/lib/module/components/CaptureButton/index.js +79 -0
  94. package/lib/module/components/CaptureButton/index.js.map +1 -0
  95. package/lib/module/components/CaptureButton/styles.js +16 -0
  96. package/lib/module/components/CaptureButton/styles.js.map +1 -0
  97. package/lib/module/components/Gabarito/index.js +5 -4
  98. package/lib/module/components/Gabarito/index.js.map +1 -1
  99. package/lib/module/components/Gabarito/styles.js +11 -12
  100. package/lib/module/components/Gabarito/styles.js.map +1 -1
  101. package/lib/module/{screens/CadastroFinger/components/AjudaCadastro → components/HelpRegister}/index.js +17 -15
  102. package/lib/module/components/HelpRegister/index.js.map +1 -0
  103. package/lib/module/components/HelpRegister/styles.js +53 -0
  104. package/lib/module/components/HelpRegister/styles.js.map +1 -0
  105. package/lib/module/components/Toast/Toast.js +14 -14
  106. package/lib/module/components/Toast/Toast.js.map +1 -1
  107. package/lib/module/components/deviceNotFound/deviceNotFound.js +20 -0
  108. package/lib/module/components/deviceNotFound/deviceNotFound.js.map +1 -0
  109. package/lib/module/components/deviceNotFound/styles.js +30 -0
  110. package/lib/module/components/deviceNotFound/styles.js.map +1 -0
  111. package/lib/module/components/icon/icon.js +15 -0
  112. package/lib/module/components/icon/icon.js.map +1 -0
  113. package/lib/module/components/index.js +9 -0
  114. package/lib/module/components/index.js.map +1 -0
  115. package/lib/module/components/modalMessage/modalMessage.js +54 -0
  116. package/lib/module/components/modalMessage/modalMessage.js.map +1 -0
  117. package/lib/module/components/modalMessage/styles.js +45 -0
  118. package/lib/module/components/modalMessage/styles.js.map +1 -0
  119. package/lib/module/components/recordButton/recordButton.js +74 -0
  120. package/lib/module/components/recordButton/recordButton.js.map +1 -0
  121. package/lib/module/components/recordButton/styles.js +15 -0
  122. package/lib/module/components/recordButton/styles.js.map +1 -0
  123. package/lib/module/index.js +4 -4
  124. package/lib/module/index.js.map +1 -1
  125. package/lib/module/screens/CadastroScreen/CadastroScreen.js +33 -33
  126. package/lib/module/screens/CadastroScreen/CadastroScreen.js.map +1 -1
  127. package/lib/module/screens/FingerAuth/FingerAuth.js +119 -0
  128. package/lib/module/screens/FingerAuth/FingerAuth.js.map +1 -0
  129. package/lib/module/screens/FingerAuth/styles.js +29 -0
  130. package/lib/module/screens/FingerAuth/styles.js.map +1 -0
  131. package/lib/module/screens/FingerRegister/index.js +129 -0
  132. package/lib/module/screens/FingerRegister/index.js.map +1 -0
  133. package/lib/module/screens/FingerRegister/styles.js +29 -0
  134. package/lib/module/screens/FingerRegister/styles.js.map +1 -0
  135. package/lib/module/screens/LifeCertificate/index.js +136 -0
  136. package/lib/module/screens/LifeCertificate/index.js.map +1 -0
  137. package/lib/module/screens/LifeCertificate/styles.js +21 -0
  138. package/lib/module/screens/LifeCertificate/styles.js.map +1 -0
  139. package/lib/module/screens/index.js +5 -0
  140. package/lib/module/screens/index.js.map +1 -0
  141. package/lib/module/services/index.js +9 -95
  142. package/lib/module/services/index.js.map +1 -1
  143. package/lib/module/services/services.js +123 -0
  144. package/lib/module/services/services.js.map +1 -0
  145. package/lib/module/services/types.js +2 -0
  146. package/lib/module/{types/screen.js.map → services/types.js.map} +1 -1
  147. package/lib/module/store/createSelectors.js +10 -0
  148. package/lib/module/store/createSelectors.js.map +1 -0
  149. package/lib/module/store/modules/fingerAuth/index.js +3 -0
  150. package/lib/module/store/modules/fingerAuth/index.js.map +1 -0
  151. package/lib/module/store/modules/fingerAuth/selectors.js +6 -0
  152. package/lib/module/store/modules/fingerAuth/selectors.js.map +1 -0
  153. package/lib/module/store/modules/fingerAuth/slice.js +86 -0
  154. package/lib/module/store/modules/fingerAuth/slice.js.map +1 -0
  155. package/lib/module/store/modules/fingerAuth/type.js +2 -0
  156. package/lib/module/store/modules/fingerAuth/type.js.map +1 -0
  157. package/lib/module/store/modules/fingerRegister/index.js +3 -0
  158. package/lib/module/store/modules/fingerRegister/index.js.map +1 -0
  159. package/lib/module/store/modules/fingerRegister/selectors.js +6 -0
  160. package/lib/module/store/modules/fingerRegister/selectors.js.map +1 -0
  161. package/lib/module/store/modules/fingerRegister/slice.js +95 -0
  162. package/lib/module/store/modules/fingerRegister/slice.js.map +1 -0
  163. package/lib/module/store/modules/fingerRegister/types.js +2 -0
  164. package/lib/module/store/modules/fingerRegister/types.js.map +1 -0
  165. package/lib/module/store/modules/lifeCertificate/index.js +3 -0
  166. package/lib/module/store/modules/lifeCertificate/index.js.map +1 -0
  167. package/lib/module/store/modules/lifeCertificate/selectors.js +6 -0
  168. package/lib/module/store/modules/lifeCertificate/selectors.js.map +1 -0
  169. package/lib/module/store/modules/lifeCertificate/slice.js +95 -0
  170. package/lib/module/store/modules/lifeCertificate/slice.js.map +1 -0
  171. package/lib/module/store/modules/lifeCertificate/types.js +2 -0
  172. package/lib/module/store/modules/lifeCertificate/types.js.map +1 -0
  173. package/lib/module/utils/file.js +3 -3
  174. package/lib/module/utils/getConfigCamera.js +4 -4
  175. package/lib/module/utils/getConfigCamera.js.map +1 -1
  176. package/lib/module/utils/index.js +1 -1
  177. package/lib/typescript/src/components/CameraConfigInfo/index.d.ts +8 -0
  178. package/lib/typescript/src/components/CameraConfigInfo/index.d.ts.map +1 -0
  179. package/lib/typescript/src/components/CameraConfigInfo/styles.d.ts +13 -0
  180. package/lib/typescript/src/components/CameraConfigInfo/styles.d.ts.map +1 -0
  181. package/lib/typescript/src/components/CaptureButton/index.d.ts +10 -0
  182. package/lib/typescript/src/components/CaptureButton/index.d.ts.map +1 -0
  183. package/lib/typescript/src/components/CaptureButton/styles.d.ts +15 -0
  184. package/lib/typescript/src/components/CaptureButton/styles.d.ts.map +1 -0
  185. package/lib/typescript/src/components/Gabarito/index.d.ts +2 -1
  186. package/lib/typescript/src/components/Gabarito/index.d.ts.map +1 -1
  187. package/lib/typescript/src/components/Gabarito/styles.d.ts +1 -2
  188. package/lib/typescript/src/components/Gabarito/styles.d.ts.map +1 -1
  189. package/lib/typescript/src/components/HelpRegister/index.d.ts +4 -0
  190. package/lib/typescript/src/components/HelpRegister/index.d.ts.map +1 -0
  191. package/lib/typescript/src/{screens/CadastroFinger/components/AjudaCadastro → components/HelpRegister}/styles.d.ts +2 -5
  192. package/lib/typescript/src/components/HelpRegister/styles.d.ts.map +1 -0
  193. package/lib/typescript/src/components/Toast/Toast.d.ts +1 -1
  194. package/lib/typescript/src/components/Toast/Toast.d.ts.map +1 -1
  195. package/lib/typescript/src/components/deviceNotFound/deviceNotFound.d.ts +8 -0
  196. package/lib/typescript/src/components/deviceNotFound/deviceNotFound.d.ts.map +1 -0
  197. package/lib/typescript/src/components/deviceNotFound/styles.d.ts +29 -0
  198. package/lib/typescript/src/components/deviceNotFound/styles.d.ts.map +1 -0
  199. package/lib/typescript/src/components/icon/icon.d.ts +9 -0
  200. package/lib/typescript/src/components/icon/icon.d.ts.map +1 -0
  201. package/lib/typescript/src/components/index.d.ts +9 -0
  202. package/lib/typescript/src/components/index.d.ts.map +1 -0
  203. package/lib/typescript/src/components/modalMessage/modalMessage.d.ts +11 -0
  204. package/lib/typescript/src/components/modalMessage/modalMessage.d.ts.map +1 -0
  205. package/lib/typescript/src/components/modalMessage/styles.d.ts +44 -0
  206. package/lib/typescript/src/components/modalMessage/styles.d.ts.map +1 -0
  207. package/lib/typescript/src/components/recordButton/recordButton.d.ts +10 -0
  208. package/lib/typescript/src/components/recordButton/recordButton.d.ts.map +1 -0
  209. package/lib/typescript/src/components/recordButton/styles.d.ts +14 -0
  210. package/lib/typescript/src/components/recordButton/styles.d.ts.map +1 -0
  211. package/lib/typescript/src/index.d.ts +3 -4
  212. package/lib/typescript/src/index.d.ts.map +1 -1
  213. package/lib/typescript/src/screens/CadastroScreen/CadastroScreen.d.ts +2 -4
  214. package/lib/typescript/src/screens/CadastroScreen/CadastroScreen.d.ts.map +1 -1
  215. package/lib/typescript/src/screens/FingerAuth/FingerAuth.d.ts +9 -0
  216. package/lib/typescript/src/screens/FingerAuth/FingerAuth.d.ts.map +1 -0
  217. package/lib/typescript/src/screens/FingerAuth/styles.d.ts +25 -0
  218. package/lib/typescript/src/screens/FingerAuth/styles.d.ts.map +1 -0
  219. package/lib/typescript/src/screens/FingerRegister/index.d.ts +9 -0
  220. package/lib/typescript/src/screens/FingerRegister/index.d.ts.map +1 -0
  221. package/lib/typescript/src/screens/FingerRegister/styles.d.ts +25 -0
  222. package/lib/typescript/src/screens/FingerRegister/styles.d.ts.map +1 -0
  223. package/lib/typescript/src/screens/LifeCertificate/index.d.ts +7 -0
  224. package/lib/typescript/src/screens/LifeCertificate/index.d.ts.map +1 -0
  225. package/lib/typescript/src/{components/WaitingForResult → screens/LifeCertificate}/styles.d.ts +7 -11
  226. package/lib/typescript/src/screens/LifeCertificate/styles.d.ts.map +1 -0
  227. package/lib/typescript/src/screens/index.d.ts +5 -0
  228. package/lib/typescript/src/screens/index.d.ts.map +1 -0
  229. package/lib/typescript/src/services/index.d.ts +2 -17
  230. package/lib/typescript/src/services/index.d.ts.map +1 -1
  231. package/lib/typescript/src/services/services.d.ts +6 -0
  232. package/lib/typescript/src/services/services.d.ts.map +1 -0
  233. package/lib/typescript/src/services/types.d.ts +37 -0
  234. package/lib/typescript/src/services/types.d.ts.map +1 -0
  235. package/lib/typescript/src/store/createSelectors.d.ts +11 -0
  236. package/lib/typescript/src/store/createSelectors.d.ts.map +1 -0
  237. package/lib/typescript/src/store/modules/fingerAuth/index.d.ts +3 -0
  238. package/lib/typescript/src/store/modules/fingerAuth/index.d.ts.map +1 -0
  239. package/lib/typescript/src/store/modules/fingerAuth/selectors.d.ts +20 -0
  240. package/lib/typescript/src/store/modules/fingerAuth/selectors.d.ts.map +1 -0
  241. package/lib/typescript/src/store/modules/fingerAuth/slice.d.ts +4 -0
  242. package/lib/typescript/src/store/modules/fingerAuth/slice.d.ts.map +1 -0
  243. package/lib/typescript/src/store/modules/fingerAuth/type.d.ts +28 -0
  244. package/lib/typescript/src/store/modules/fingerAuth/type.d.ts.map +1 -0
  245. package/lib/typescript/src/store/modules/fingerRegister/index.d.ts +3 -0
  246. package/lib/typescript/src/store/modules/fingerRegister/index.d.ts.map +1 -0
  247. package/lib/typescript/src/store/modules/fingerRegister/selectors.d.ts +22 -0
  248. package/lib/typescript/src/store/modules/fingerRegister/selectors.d.ts.map +1 -0
  249. package/lib/typescript/src/store/modules/fingerRegister/slice.d.ts +4 -0
  250. package/lib/typescript/src/store/modules/fingerRegister/slice.d.ts.map +1 -0
  251. package/lib/typescript/src/store/modules/fingerRegister/types.d.ts +30 -0
  252. package/lib/typescript/src/store/modules/fingerRegister/types.d.ts.map +1 -0
  253. package/lib/typescript/src/store/modules/lifeCertificate/index.d.ts +3 -0
  254. package/lib/typescript/src/store/modules/lifeCertificate/index.d.ts.map +1 -0
  255. package/lib/typescript/src/store/modules/lifeCertificate/selectors.d.ts +23 -0
  256. package/lib/typescript/src/store/modules/lifeCertificate/selectors.d.ts.map +1 -0
  257. package/lib/typescript/src/store/modules/lifeCertificate/slice.d.ts +4 -0
  258. package/lib/typescript/src/store/modules/lifeCertificate/slice.d.ts.map +1 -0
  259. package/lib/typescript/src/store/modules/lifeCertificate/types.d.ts +37 -0
  260. package/lib/typescript/src/store/modules/lifeCertificate/types.d.ts.map +1 -0
  261. package/lib/typescript/src/utils/getConfigCamera.d.ts +1 -1
  262. package/lib/typescript/src/utils/getConfigCamera.d.ts.map +1 -1
  263. package/lib/typescript/src/utils/index.d.ts +1 -1
  264. package/package.json +24 -42
  265. package/src/components/CameraConfigInfo/index.tsx +20 -0
  266. package/src/components/CameraConfigInfo/styles.ts +14 -0
  267. package/src/components/CaptureButton/index.tsx +74 -0
  268. package/src/components/CaptureButton/styles.ts +16 -0
  269. package/src/components/Gabarito/index.tsx +6 -4
  270. package/src/components/Gabarito/styles.ts +13 -14
  271. package/src/components/HelpRegister/index.tsx +40 -0
  272. package/src/components/HelpRegister/styles.ts +54 -0
  273. package/src/components/Toast/Toast.tsx +18 -22
  274. package/src/components/deviceNotFound/deviceNotFound.tsx +23 -0
  275. package/src/components/deviceNotFound/styles.ts +30 -0
  276. package/src/components/icon/icon.tsx +14 -0
  277. package/src/components/index.ts +9 -0
  278. package/src/components/modalMessage/modalMessage.tsx +73 -0
  279. package/src/components/modalMessage/styles.ts +45 -0
  280. package/src/components/recordButton/recordButton.tsx +75 -0
  281. package/src/components/recordButton/styles.ts +15 -0
  282. package/src/index.tsx +5 -4
  283. package/src/screens/CadastroScreen/CadastroScreen.tsx +35 -52
  284. package/src/screens/FingerAuth/FingerAuth.tsx +121 -0
  285. package/src/screens/FingerAuth/styles.ts +28 -0
  286. package/src/screens/FingerRegister/index.tsx +141 -0
  287. package/src/screens/FingerRegister/styles.ts +28 -0
  288. package/src/screens/LifeCertificate/index.tsx +152 -0
  289. package/src/screens/LifeCertificate/styles.ts +21 -0
  290. package/src/screens/index.ts +5 -0
  291. package/src/services/index.ts +12 -113
  292. package/src/services/services.ts +129 -0
  293. package/src/services/types.ts +42 -0
  294. package/src/store/createSelectors.ts +15 -0
  295. package/src/store/modules/fingerAuth/index.ts +3 -0
  296. package/src/store/modules/fingerAuth/selectors.ts +7 -0
  297. package/src/store/modules/fingerAuth/slice.ts +91 -0
  298. package/src/store/modules/fingerAuth/type.ts +29 -0
  299. package/src/store/modules/fingerRegister/index.ts +3 -0
  300. package/src/store/modules/fingerRegister/selectors.ts +7 -0
  301. package/src/store/modules/fingerRegister/slice.ts +101 -0
  302. package/src/store/modules/fingerRegister/types.ts +30 -0
  303. package/src/store/modules/lifeCertificate/index.ts +3 -0
  304. package/src/store/modules/lifeCertificate/selectors.ts +7 -0
  305. package/src/store/modules/lifeCertificate/slice.ts +100 -0
  306. package/src/store/modules/lifeCertificate/types.ts +40 -0
  307. package/src/utils/file.ts +3 -3
  308. package/src/utils/getConfigCamera.ts +7 -12
  309. package/src/utils/index.ts +1 -1
  310. package/lib/commonjs/components/CameraConfigInfos/index.js +0 -21
  311. package/lib/commonjs/components/CameraConfigInfos/index.js.map +0 -1
  312. package/lib/commonjs/components/CameraConfigInfos/styles.js +0 -19
  313. package/lib/commonjs/components/CameraConfigInfos/styles.js.map +0 -1
  314. package/lib/commonjs/components/DeviceNullDisplay/index.js +0 -59
  315. package/lib/commonjs/components/DeviceNullDisplay/index.js.map +0 -1
  316. package/lib/commonjs/components/ErrorDisplay/index.js +0 -59
  317. package/lib/commonjs/components/ErrorDisplay/index.js.map +0 -1
  318. package/lib/commonjs/components/WaitingForResult/index.js.map +0 -1
  319. package/lib/commonjs/components/WaitingForResult/styles.js +0 -32
  320. package/lib/commonjs/components/WaitingForResult/styles.js.map +0 -1
  321. package/lib/commonjs/screens/CadastroFinger/components/AjudaCadastro/index.js +0 -49
  322. package/lib/commonjs/screens/CadastroFinger/components/AjudaCadastro/index.js.map +0 -1
  323. package/lib/commonjs/screens/CadastroFinger/components/AjudaCadastro/styles.js.map +0 -1
  324. package/lib/commonjs/screens/CadastroFinger/components/CameraCadastro/index.js +0 -298
  325. package/lib/commonjs/screens/CadastroFinger/components/CameraCadastro/index.js.map +0 -1
  326. package/lib/commonjs/screens/CadastroFinger/components/CameraCadastro/styles.js +0 -54
  327. package/lib/commonjs/screens/CadastroFinger/components/CameraCadastro/styles.js.map +0 -1
  328. package/lib/commonjs/screens/CadastroFinger/components/ImageDisplayScreen/index.js +0 -44
  329. package/lib/commonjs/screens/CadastroFinger/components/ImageDisplayScreen/index.js.map +0 -1
  330. package/lib/commonjs/screens/CadastroFinger/components/ImageDisplayScreen/styles.js +0 -65
  331. package/lib/commonjs/screens/CadastroFinger/components/ImageDisplayScreen/styles.js.map +0 -1
  332. package/lib/commonjs/screens/CadastroFinger/index.js +0 -50
  333. package/lib/commonjs/screens/CadastroFinger/index.js.map +0 -1
  334. package/lib/commonjs/screens/ProvaVidas/index.js +0 -246
  335. package/lib/commonjs/screens/ProvaVidas/index.js.map +0 -1
  336. package/lib/commonjs/screens/ProvaVidas/styles.js +0 -93
  337. package/lib/commonjs/screens/ProvaVidas/styles.js.map +0 -1
  338. package/lib/commonjs/screens/ValidadeFinger/index.js +0 -216
  339. package/lib/commonjs/screens/ValidadeFinger/index.js.map +0 -1
  340. package/lib/commonjs/screens/ValidadeFinger/styles.js +0 -54
  341. package/lib/commonjs/screens/ValidadeFinger/styles.js.map +0 -1
  342. package/lib/commonjs/types/screen.js +0 -2
  343. package/lib/module/components/CameraConfigInfos/index.js +0 -13
  344. package/lib/module/components/CameraConfigInfos/index.js.map +0 -1
  345. package/lib/module/components/CameraConfigInfos/styles.js +0 -13
  346. package/lib/module/components/CameraConfigInfos/styles.js.map +0 -1
  347. package/lib/module/components/DeviceNullDisplay/index.js +0 -51
  348. package/lib/module/components/DeviceNullDisplay/index.js.map +0 -1
  349. package/lib/module/components/ErrorDisplay/index.js +0 -51
  350. package/lib/module/components/ErrorDisplay/index.js.map +0 -1
  351. package/lib/module/components/WaitingForResult/index.js +0 -17
  352. package/lib/module/components/WaitingForResult/index.js.map +0 -1
  353. package/lib/module/components/WaitingForResult/styles.js +0 -26
  354. package/lib/module/components/WaitingForResult/styles.js.map +0 -1
  355. package/lib/module/screens/CadastroFinger/components/AjudaCadastro/index.js.map +0 -1
  356. package/lib/module/screens/CadastroFinger/components/AjudaCadastro/styles.js +0 -56
  357. package/lib/module/screens/CadastroFinger/components/AjudaCadastro/styles.js.map +0 -1
  358. package/lib/module/screens/CadastroFinger/components/CameraCadastro/index.js +0 -288
  359. package/lib/module/screens/CadastroFinger/components/CameraCadastro/index.js.map +0 -1
  360. package/lib/module/screens/CadastroFinger/components/CameraCadastro/styles.js +0 -48
  361. package/lib/module/screens/CadastroFinger/components/CameraCadastro/styles.js.map +0 -1
  362. package/lib/module/screens/CadastroFinger/components/ImageDisplayScreen/index.js +0 -36
  363. package/lib/module/screens/CadastroFinger/components/ImageDisplayScreen/index.js.map +0 -1
  364. package/lib/module/screens/CadastroFinger/components/ImageDisplayScreen/styles.js +0 -59
  365. package/lib/module/screens/CadastroFinger/components/ImageDisplayScreen/styles.js.map +0 -1
  366. package/lib/module/screens/CadastroFinger/index.js +0 -42
  367. package/lib/module/screens/CadastroFinger/index.js.map +0 -1
  368. package/lib/module/screens/ProvaVidas/index.js +0 -239
  369. package/lib/module/screens/ProvaVidas/index.js.map +0 -1
  370. package/lib/module/screens/ProvaVidas/styles.js +0 -87
  371. package/lib/module/screens/ProvaVidas/styles.js.map +0 -1
  372. package/lib/module/screens/ValidadeFinger/index.js +0 -206
  373. package/lib/module/screens/ValidadeFinger/index.js.map +0 -1
  374. package/lib/module/screens/ValidadeFinger/styles.js +0 -48
  375. package/lib/module/screens/ValidadeFinger/styles.js.map +0 -1
  376. package/lib/module/types/screen.js +0 -2
  377. package/lib/typescript/src/components/CameraConfigInfos/index.d.ts +0 -9
  378. package/lib/typescript/src/components/CameraConfigInfos/index.d.ts.map +0 -1
  379. package/lib/typescript/src/components/CameraConfigInfos/styles.d.ts +0 -11
  380. package/lib/typescript/src/components/CameraConfigInfos/styles.d.ts.map +0 -1
  381. package/lib/typescript/src/components/DeviceNullDisplay/index.d.ts +0 -11
  382. package/lib/typescript/src/components/DeviceNullDisplay/index.d.ts.map +0 -1
  383. package/lib/typescript/src/components/ErrorDisplay/index.d.ts +0 -11
  384. package/lib/typescript/src/components/ErrorDisplay/index.d.ts.map +0 -1
  385. package/lib/typescript/src/components/WaitingForResult/index.d.ts +0 -7
  386. package/lib/typescript/src/components/WaitingForResult/index.d.ts.map +0 -1
  387. package/lib/typescript/src/components/WaitingForResult/styles.d.ts.map +0 -1
  388. package/lib/typescript/src/screens/CadastroFinger/components/AjudaCadastro/index.d.ts +0 -7
  389. package/lib/typescript/src/screens/CadastroFinger/components/AjudaCadastro/index.d.ts.map +0 -1
  390. package/lib/typescript/src/screens/CadastroFinger/components/AjudaCadastro/styles.d.ts.map +0 -1
  391. package/lib/typescript/src/screens/CadastroFinger/components/CameraCadastro/index.d.ts +0 -16
  392. package/lib/typescript/src/screens/CadastroFinger/components/CameraCadastro/index.d.ts.map +0 -1
  393. package/lib/typescript/src/screens/CadastroFinger/components/CameraCadastro/styles.d.ts +0 -44
  394. package/lib/typescript/src/screens/CadastroFinger/components/CameraCadastro/styles.d.ts.map +0 -1
  395. package/lib/typescript/src/screens/CadastroFinger/components/ImageDisplayScreen/index.d.ts +0 -12
  396. package/lib/typescript/src/screens/CadastroFinger/components/ImageDisplayScreen/index.d.ts.map +0 -1
  397. package/lib/typescript/src/screens/CadastroFinger/components/ImageDisplayScreen/styles.d.ts +0 -54
  398. package/lib/typescript/src/screens/CadastroFinger/components/ImageDisplayScreen/styles.d.ts.map +0 -1
  399. package/lib/typescript/src/screens/CadastroFinger/index.d.ts +0 -16
  400. package/lib/typescript/src/screens/CadastroFinger/index.d.ts.map +0 -1
  401. package/lib/typescript/src/screens/ProvaVidas/index.d.ts +0 -14
  402. package/lib/typescript/src/screens/ProvaVidas/index.d.ts.map +0 -1
  403. package/lib/typescript/src/screens/ProvaVidas/styles.d.ts +0 -85
  404. package/lib/typescript/src/screens/ProvaVidas/styles.d.ts.map +0 -1
  405. package/lib/typescript/src/screens/ValidadeFinger/index.d.ts +0 -14
  406. package/lib/typescript/src/screens/ValidadeFinger/index.d.ts.map +0 -1
  407. package/lib/typescript/src/screens/ValidadeFinger/styles.d.ts +0 -44
  408. package/lib/typescript/src/screens/ValidadeFinger/styles.d.ts.map +0 -1
  409. package/lib/typescript/src/types/screen.d.ts +0 -6
  410. package/lib/typescript/src/types/screen.d.ts.map +0 -1
  411. package/live-id-sdk.podspec +0 -41
  412. package/src/components/CameraConfigInfos/index.tsx +0 -25
  413. package/src/components/CameraConfigInfos/styles.ts +0 -13
  414. package/src/components/DeviceNullDisplay/index.tsx +0 -59
  415. package/src/components/ErrorDisplay/index.tsx +0 -60
  416. package/src/components/WaitingForResult/index.tsx +0 -22
  417. package/src/components/WaitingForResult/styles.ts +0 -27
  418. package/src/screens/CadastroFinger/components/AjudaCadastro/index.tsx +0 -49
  419. package/src/screens/CadastroFinger/components/AjudaCadastro/styles.ts +0 -56
  420. package/src/screens/CadastroFinger/components/CameraCadastro/index.tsx +0 -356
  421. package/src/screens/CadastroFinger/components/CameraCadastro/styles.ts +0 -47
  422. package/src/screens/CadastroFinger/components/ImageDisplayScreen/index.tsx +0 -45
  423. package/src/screens/CadastroFinger/components/ImageDisplayScreen/styles.ts +0 -55
  424. package/src/screens/CadastroFinger/index.tsx +0 -56
  425. package/src/screens/ProvaVidas/index.tsx +0 -308
  426. package/src/screens/ProvaVidas/styles.ts +0 -99
  427. package/src/screens/ValidadeFinger/index.tsx +0 -263
  428. package/src/screens/ValidadeFinger/styles.ts +0 -47
  429. package/src/types/screen.ts +0 -5
@@ -0,0 +1,152 @@
1
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import { StatusBar, View } from "react-native";
3
+ import Orientation from "react-native-orientation-locker";
4
+ import { Camera, VideoFile, useCameraDevice, useCameraFormat, useCameraPermission } from "react-native-vision-camera";
5
+ import { useDispatch, useSelector } from "../../store/modules/lifeCertificate";
6
+ import { DeviceNotFound, ModalMessage, RecordButton, CameraConfigInfo } from "../../components";
7
+ import { styles } from "./styles";
8
+
9
+ type Props = {
10
+ UID: string;
11
+ };
12
+
13
+ const LifeCertificate = ({ UID }: Props) => {
14
+ const camera = useRef<Camera>(null);
15
+ const state = useSelector();
16
+ const dispatch = useDispatch();
17
+ const { hasPermission, requestPermission } = useCameraPermission();
18
+ const [intervalState, setIntervalState] = useState<NodeJS.Timeout | null>(null);
19
+ const [timer, setTimer] = useState(10);
20
+ const device = useCameraDevice("back");
21
+
22
+ const format = useCameraFormat(device, [
23
+ {
24
+ videoResolution: {
25
+ height: 1280,
26
+ width: 720
27
+ }
28
+ }
29
+ ]);
30
+
31
+ const cameraPermission = useCallback(async () => {
32
+ if (!hasPermission) {
33
+ await requestPermission();
34
+ }
35
+ }, [hasPermission, requestPermission]);
36
+
37
+ useEffect(() => {
38
+ cameraPermission();
39
+ dispatch.getConfig("liveness");
40
+ }, [cameraPermission, dispatch.getConfig]);
41
+
42
+ const containerRecordStyled = useMemo(
43
+ () => [styles.containerRecord, { bottom: state.showButtonInfo ? 75 : 20 }],
44
+ [state.showButtonInfo]
45
+ );
46
+
47
+ useEffect(() => {
48
+ Orientation.lockToPortrait();
49
+ }, []);
50
+
51
+ useEffect(() => {
52
+ if (state.code === 0) {
53
+ dispatch.setModal("Sucesso!", `Seu batimento está em: ${state.bpm}.\nProva de vida concluída!`);
54
+ dispatch.handleLoading();
55
+ }
56
+ if (state.code !== 0 && state.code !== null) {
57
+ dispatch.setModal("Ocorreu um erro!", `Erro: ${state.message}`);
58
+ dispatch.handleLoading();
59
+ }
60
+ setTimer(10);
61
+ dispatch.resetState();
62
+ }, [state.bpm, state.code, state.message, dispatch.handleLoading, dispatch.resetState, dispatch.setModal]);
63
+
64
+ const sendFile = useCallback(
65
+ async (file: VideoFile) => {
66
+ if (!UID) {
67
+ dispatch.setModal("Ocorreu um erro!", "Erro ao enviar o arquivo (id error)");
68
+ }
69
+ dispatch.sendLifeCertificate({
70
+ videoFile: file,
71
+ UID: UID,
72
+ exposure: state.exposure
73
+ });
74
+ },
75
+ [state.exposure, dispatch.sendLifeCertificate, dispatch.setModal, UID]
76
+ );
77
+
78
+ useEffect(() => {
79
+ return () => {
80
+ setTimer(0);
81
+ };
82
+ }, []);
83
+
84
+ useEffect(() => {
85
+ if (timer < 0 && intervalState != null) {
86
+ clearInterval(intervalState);
87
+ stopRecodingVideo();
88
+ }
89
+ }, [timer, intervalState]);
90
+
91
+ const startVideoRecording = useCallback(() => {
92
+ dispatch.setIsRecording(true);
93
+ camera.current?.startRecording({
94
+ flash: "off",
95
+ fileType: "mp4",
96
+ onRecordingFinished: (video) => sendFile(video),
97
+ onRecordingError: (error) => console.error(error)
98
+ });
99
+ }, [sendFile, dispatch.setIsRecording]);
100
+
101
+ const recordingVideo = useCallback(async () => {
102
+ startVideoRecording();
103
+ setIntervalState(
104
+ setInterval(() => {
105
+ setTimer((prevTimer) => prevTimer - 1);
106
+ }, 1000)
107
+ );
108
+ }, [startVideoRecording]);
109
+
110
+ const stopRecodingVideo = async () => {
111
+ dispatch.setIsRecording(false);
112
+ await camera.current?.stopRecording();
113
+ dispatch.handleLoading();
114
+ };
115
+
116
+ if (device == null || hasPermission === false)
117
+ return <DeviceNotFound hasPermission={hasPermission} cameraPermission={cameraPermission} />;
118
+
119
+ return (
120
+ <View style={styles.containerCamera}>
121
+ <StatusBar barStyle="light-content" />
122
+ <Camera
123
+ ref={camera}
124
+ style={styles.camera}
125
+ isActive={true}
126
+ device={device}
127
+ video={true}
128
+ torch={"on"}
129
+ format={format}
130
+ exposure={state.exposure}
131
+ zoom={state.zoom}
132
+ focusable={true}
133
+ photo={true}
134
+ enableHighQualityPhotos={true}
135
+ fps={30}
136
+ pixelFormat="native"
137
+ />
138
+ <View style={containerRecordStyled}>
139
+ <RecordButton
140
+ onPress={recordingVideo}
141
+ disabled={state.isRecording || state.loading}
142
+ timer={timer}
143
+ isRecording={state.isRecording}
144
+ />
145
+ </View>
146
+ {state.showButtonInfo && <CameraConfigInfo exposure={state.exposure} zoom={state.zoom} />}
147
+ <ModalMessage isLoading={state.loading} modal={state.modal} />
148
+ </View>
149
+ );
150
+ };
151
+
152
+ export default LifeCertificate;
@@ -0,0 +1,21 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ export const styles = StyleSheet.create({
4
+ containerCamera: {
5
+ flex: 1,
6
+ backgroundColor: "#0d0d0d"
7
+ },
8
+ camera: {
9
+ flex: 1
10
+ },
11
+ containerRecord: {
12
+ position: "absolute",
13
+ width: "100%",
14
+ alignItems: "center"
15
+ },
16
+ text: {
17
+ fontSize: 20,
18
+ fontWeight: "500",
19
+ color: "#000"
20
+ }
21
+ });
@@ -0,0 +1,5 @@
1
+ import FingerRegister from "./FingerRegister";
2
+ import LifeCertificate from "./LifeCertificate";
3
+ import FingerAuth from "./FingerAuth/FingerAuth";
4
+
5
+ export { FingerRegister, LifeCertificate, FingerAuth };
@@ -1,24 +1,19 @@
1
- import { Platform } from 'react-native';
2
- import axios from 'axios';
1
+ import { lifeCertificate, getConfigsApi, registerFingerImages, authFinger } from "./services";
3
2
 
4
- const BASE_URL = 'https://api.liveid.app.br';
3
+ const BASE_URL = "https://api.liveid.app.br";
5
4
  const TOKEN =
6
- 'eyJhbGciOiJIUzI1NiJ9.NmU5ZmQ0MzEtOTE0Yy00Njc1LWFkYjAtZjVjNjRlZDUxNDg0.9J8eydQk5fbkH5GKdXkmXpt6wdQWyw8bsbaP5POU6YA';
5
+ "eyJhbGciOiJIUzI1NiJ9.NmU5ZmQ0MzEtOTE0Yy00Njc1LWFkYjAtZjVjNjRlZDUxNDg0.9J8eydQk5fbkH5GKdXkmXpt6wdQWyw8bsbaP5POU6YA";
7
6
 
8
7
  const BASE_HEADER = {
9
- 'Content-Type': 'application/json',
10
- 'Authorization': `Bearer ${TOKEN}`,
8
+ "Content-Type": "application/json",
9
+ Authorization: `Bearer ${TOKEN}`
11
10
  };
12
11
 
13
- const axiosInstance = axios.create({
14
- baseURL: BASE_URL,
15
- });
16
-
17
12
  export const login = async (cpf: any, senha: any) => {
18
13
  const response = await fetch(`${BASE_URL}/login`, {
19
- method: 'POST',
14
+ method: "POST",
20
15
  headers: BASE_HEADER,
21
- body: JSON.stringify({ cpf, senha }),
16
+ body: JSON.stringify({ cpf, senha })
22
17
  });
23
18
  const data = await response.json();
24
19
  return data;
@@ -26,118 +21,22 @@ export const login = async (cpf: any, senha: any) => {
26
21
 
27
22
  export const cadastro = async (cpf: string, name: string, senha: string) => {
28
23
  const response = await fetch(`${BASE_URL}/signup`, {
29
- method: 'POST',
30
- headers: BASE_HEADER,
31
- body: JSON.stringify({ cpf, name, senha }),
32
- });
33
- const data = await response.json();
34
- return data;
35
- };
36
-
37
- export const sendImages = async (UID: any, finger: any, images: any) => {
38
- const response = await fetch(`${BASE_URL}/enroll-images`, {
39
- method: 'POST',
24
+ method: "POST",
40
25
  headers: BASE_HEADER,
41
- body: JSON.stringify({ UID, finger, images }),
26
+ body: JSON.stringify({ cpf, name, senha })
42
27
  });
43
28
  const data = await response.json();
44
29
  return data;
45
30
  };
46
31
 
47
- export const verifyDigital = async (UID: any, finger: any, image: any) => {
48
- const response = await fetch(`${BASE_URL}/verify`, {
49
- method: 'POST',
50
- headers: BASE_HEADER,
51
- body: JSON.stringify({ UID, finger, image }),
52
- });
53
- const data = await response.json();
54
- return data;
55
- };
56
-
57
- type GetConfigApi = {
58
- id: number;
59
- deviceModels: string[];
60
- deviceType: string;
61
- fps: number;
62
- exposure: number;
63
- zoom: number;
64
- serviceType: string;
65
- showButtonInfo: boolean;
66
- }[];
67
-
68
- export const getConfigsApi = async (): Promise<GetConfigApi> => {
69
- const { data } = await axiosInstance.get('/configs', {
70
- headers: {
71
- 'Content-Type': 'application/json',
72
- 'Authorization': `Bearer ${TOKEN}`,
73
- },
74
- });
75
- return data.deviceParamsConfig;
76
- };
77
-
78
32
  export const verificaCPF = async (cpf: any) => {
79
33
  const response = await fetch(`${BASE_URL}/validcpf`, {
80
- method: 'POST',
34
+ method: "POST",
81
35
  headers: BASE_HEADER,
82
- body: JSON.stringify({ cpf }),
36
+ body: JSON.stringify({ cpf })
83
37
  });
84
38
  const data = await response.json();
85
39
  return data;
86
40
  };
87
41
 
88
- export const provaVida = async (
89
- video: { path: any },
90
- UID: string,
91
- vlexposure: any
92
- ) => {
93
- const numeroAleatorio = gerarNumeroAleatorio();
94
-
95
- const formData = new FormData();
96
- formData.append('video', {
97
- uri: Platform.select({
98
- ios: video.path,
99
- android: `file://${video.path}`,
100
- }),
101
- type: 'video/mp4',
102
- name: `${UID}_${numeroAleatorio}.mp4`,
103
- });
104
-
105
- formData.append('video_key', numeroAleatorio);
106
- formData.append('person_id', UID);
107
- formData.append('exposure', vlexposure);
108
-
109
- const response = await fetch(`${BASE_URL}/liveness`, {
110
- method: 'POST',
111
- headers: {
112
- 'Content-Type': 'multipart/form-data',
113
- 'Authorization': `Bearer ${TOKEN}`,
114
- },
115
- body: formData,
116
- });
117
-
118
- if (response.status === 200) {
119
- const json = await response.json();
120
- return json;
121
- } else {
122
- const errorJson = {
123
- code: -1,
124
- message: 'Erro, por favor, verifique e tente novamente!',
125
- };
126
- return errorJson;
127
- }
128
- };
129
-
130
- const gerarNumeroAleatorio = () => {
131
- const min = 10000000; // Menor número de 8 dígitos (10 milhões)
132
- const max = 99999999; // Maior número de 8 dígitos (99 milhões 999 mil 999)
133
-
134
- // Gera um número aleatório entre min e max
135
- const numeroAleatorio = Math.floor(Math.random() * (max - min + 1)) + min;
136
-
137
- // Converte o número para string
138
- const numeroString = numeroAleatorio.toString();
139
-
140
- return numeroString;
141
- };
142
-
143
- //https://api.liveid.app.br/change_configs
42
+ export { lifeCertificate, getConfigsApi, registerFingerImages, authFinger };
@@ -0,0 +1,129 @@
1
+ import axios from "axios";
2
+ import { Platform } from "react-native";
3
+ import uuid from "react-native-uuid";
4
+ import type {
5
+ GetConfigApiResponse,
6
+ LifeCertificateResponse,
7
+ LifeCertificateType,
8
+ RegisterFingerResponse,
9
+ RegisterFingerImagesType,
10
+ AuthFingerType,
11
+ AuthFingerResponse
12
+ } from "./types";
13
+ import DeviceInfo from "react-native-device-info";
14
+
15
+ const API_URL = "https://api.liveid.app.br";
16
+ const TOKEN =
17
+ "eyJhbGciOiJIUzI1NiJ9.NmU5ZmQ0MzEtOTE0Yy00Njc1LWFkYjAtZjVjNjRlZDUxNDg0.9J8eydQk5fbkH5GKdXkmXpt6wdQWyw8bsbaP5POU6YA";
18
+
19
+ const axiosInstance = axios.create({
20
+ baseURL: API_URL
21
+ });
22
+
23
+ export const getConfigsApi = async (): Promise<GetConfigApiResponse> => {
24
+ const { data } = await axiosInstance.get("/configs", {
25
+ headers: {
26
+ "Content-Type": "application/json",
27
+ Authorization: `Bearer ${TOKEN}`
28
+ }
29
+ });
30
+ return data.deviceParamsConfig;
31
+ };
32
+
33
+ export const registerFingerImages = async ({
34
+ UID,
35
+ images
36
+ }: RegisterFingerImagesType): Promise<RegisterFingerResponse> => {
37
+ try {
38
+ const finger = "DI";
39
+ const { data } = await axiosInstance.post(
40
+ "/enroll-images",
41
+ { UID, finger, images },
42
+ {
43
+ headers: {
44
+ "Content-Type": "application/json",
45
+ Authorization: `Bearer ${TOKEN}`
46
+ }
47
+ }
48
+ );
49
+ return {
50
+ code: data.code,
51
+ message: data.message
52
+ };
53
+ } catch (error: any) {
54
+ console.error(error.response.data);
55
+ return {
56
+ code: error.response.data.code,
57
+ message: error.response.data.message
58
+ };
59
+ }
60
+ };
61
+
62
+ export const authFinger = async ({ UID, image }: AuthFingerType): Promise<AuthFingerResponse> => {
63
+ try {
64
+ const finger = "DI";
65
+ const { data } = await axiosInstance.post(
66
+ "/verify",
67
+ { UID, finger, image },
68
+ {
69
+ headers: {
70
+ "Content-Type": "application/json",
71
+ Authorization: `Bearer ${TOKEN}`
72
+ }
73
+ }
74
+ );
75
+ console.log(data);
76
+ return {
77
+ code: data.code,
78
+ message: data.message
79
+ };
80
+ } catch (error: any) {
81
+ console.error(error.response.data);
82
+ return {
83
+ code: error.response.data.code,
84
+ message: error.response.data.message
85
+ };
86
+ }
87
+ };
88
+
89
+ export const lifeCertificate = async ({
90
+ videoPath,
91
+ exposure,
92
+ UID
93
+ }: LifeCertificateType): Promise<LifeCertificateResponse> => {
94
+ try {
95
+ const uuidv4 = uuid.v4();
96
+ const deviceModel = DeviceInfo.getModel();
97
+ const formData = new FormData();
98
+ formData.append("video", {
99
+ uri: Platform.select({
100
+ ios: videoPath,
101
+ android: `file://${videoPath}`
102
+ }),
103
+ type: "video/mp4",
104
+ name: `${UID}_${uuidv4}.mp4`
105
+ });
106
+
107
+ formData.append("video_key", uuidv4);
108
+ formData.append("person_id", UID);
109
+ formData.append("device_model", deviceModel);
110
+ formData.append("exposure", exposure);
111
+
112
+ const { data } = await axiosInstance.post("/liveness", formData, {
113
+ headers: {
114
+ "Content-Type": "multipart/form-data",
115
+ Authorization: `Bearer ${TOKEN}`
116
+ }
117
+ });
118
+ return {
119
+ code: data.code,
120
+ bpm: data.bpm
121
+ };
122
+ } catch (error: any) {
123
+ console.error(error.response.data.message);
124
+ return {
125
+ code: error.response.data.code,
126
+ message: error.response.data.message
127
+ };
128
+ }
129
+ };
@@ -0,0 +1,42 @@
1
+ export type GetConfigApiResponse = {
2
+ id: number;
3
+ deviceModels: string[];
4
+ deviceType: string;
5
+ fps: number;
6
+ exposure: number;
7
+ zoom: number;
8
+ serviceType: string;
9
+ showButtonInfo: boolean;
10
+ }[];
11
+
12
+ export type RegisterFingerImagesType = {
13
+ UID: string;
14
+ images: string[];
15
+ };
16
+
17
+ export type RegisterFingerResponse = {
18
+ code: number;
19
+ message?: string;
20
+ };
21
+
22
+ export type AuthFingerType = {
23
+ UID: string;
24
+ image: string;
25
+ };
26
+
27
+ export type AuthFingerResponse = {
28
+ code: number;
29
+ message?: string;
30
+ };
31
+
32
+ export type LifeCertificateType = {
33
+ videoPath: string;
34
+ UID: string;
35
+ exposure: number;
36
+ };
37
+
38
+ export type LifeCertificateResponse = {
39
+ code: number;
40
+ bpm?: number;
41
+ message?: string;
42
+ };
@@ -0,0 +1,15 @@
1
+ import { StoreApi, UseBoundStore } from "zustand";
2
+
3
+ type WithSelectors<S> = S extends { getState: () => infer T } ? S & { use: { [K in keyof T]: () => T[K] } } : never;
4
+
5
+ const createSelectors = <S extends UseBoundStore<StoreApi<object>>>(_store: S) => {
6
+ let store = _store as WithSelectors<typeof _store>;
7
+ store.use = {};
8
+ for (let k of Object.keys(store.getState())) {
9
+ (store.use as any)[k] = () => store((s) => s[k as keyof typeof s]);
10
+ }
11
+
12
+ return store;
13
+ };
14
+
15
+ export default createSelectors;
@@ -0,0 +1,3 @@
1
+ import { useDispatch, useSelector } from "./selectors";
2
+
3
+ export { useDispatch, useSelector };
@@ -0,0 +1,7 @@
1
+ import createSelectors from "../../createSelectors";
2
+ import FingerAuthStore from "./slice";
3
+
4
+ const selector = createSelectors(FingerAuthStore);
5
+
6
+ export const useSelector = selector.use.state;
7
+ export const useDispatch = selector.use.dispatch;
@@ -0,0 +1,91 @@
1
+ import { create } from "zustand";
2
+ import { getConfigCamera } from "../../../utils";
3
+ import { FingerAuthState, InitialState } from "./type";
4
+ import { readFile } from "react-native-fs";
5
+ import { authFinger } from "../../../services";
6
+
7
+ const initialState: InitialState = {
8
+ state: {
9
+ exposure: 0,
10
+ zoom: 0,
11
+ showButtonInfo: false,
12
+ loading: false,
13
+ code: null,
14
+ message: "",
15
+ modal: {
16
+ title: "",
17
+ message: ""
18
+ }
19
+ }
20
+ };
21
+
22
+ const getConfig = async (serviceType: "finger" | "liveness") => {
23
+ const config = await getConfigCamera(serviceType);
24
+ slice.setState((state) => ({
25
+ state: {
26
+ ...state.state,
27
+ ...config
28
+ }
29
+ }));
30
+ };
31
+
32
+ const setModal = (title: string, message: string) => {
33
+ slice.setState((state) => ({
34
+ state: {
35
+ ...state.state,
36
+ modal: {
37
+ title,
38
+ message
39
+ }
40
+ }
41
+ }));
42
+ };
43
+
44
+ const handleLoading = () => {
45
+ slice.setState((state) => ({
46
+ state: {
47
+ ...state.state,
48
+ loading: !state.state.loading
49
+ }
50
+ }));
51
+ };
52
+
53
+ const sendImage = async (imagePath: string, UID: string) => {
54
+ try {
55
+ handleLoading();
56
+ const convertedImage = await readFile(imagePath, "base64");
57
+ const response = await authFinger({ UID, image: convertedImage });
58
+ slice.setState((state) => ({
59
+ state: {
60
+ ...state.state,
61
+ message: response.message ?? "",
62
+ code: response.code
63
+ }
64
+ }));
65
+ } catch (error) {
66
+ console.error("error:", error);
67
+ }
68
+ };
69
+
70
+ const resetState = () => {
71
+ slice.setState((state) => ({
72
+ state: {
73
+ ...state.state,
74
+ code: null,
75
+ message: ""
76
+ }
77
+ }));
78
+ };
79
+
80
+ const slice = create<FingerAuthState>(() => ({
81
+ ...initialState,
82
+ dispatch: {
83
+ getConfig,
84
+ sendImage,
85
+ resetState,
86
+ handleLoading,
87
+ setModal
88
+ }
89
+ }));
90
+
91
+ export default slice;
@@ -0,0 +1,29 @@
1
+ type State = {
2
+ exposure: number;
3
+ zoom: number;
4
+ showButtonInfo: boolean;
5
+ loading: boolean;
6
+ code: null | number;
7
+ message: string;
8
+ modal: {
9
+ title: string;
10
+ message: string;
11
+ };
12
+ };
13
+
14
+ type Dispatch = {
15
+ getConfig: (serviceType: "finger" | "liveness") => void;
16
+ handleLoading: () => void;
17
+ sendImage: (imagePath: string, UID: string) => void;
18
+ resetState: () => void;
19
+ setModal: (title: string, message: string) => void;
20
+ };
21
+
22
+ export type InitialState = {
23
+ state: State;
24
+ };
25
+
26
+ export type FingerAuthState = {
27
+ state: State;
28
+ dispatch: Dispatch;
29
+ };
@@ -0,0 +1,3 @@
1
+ import { useDispatch, useSelector } from "./selectors";
2
+
3
+ export { useDispatch, useSelector };
@@ -0,0 +1,7 @@
1
+ import createSelectors from "../../createSelectors";
2
+ import FingerRegisterStore from "./slice";
3
+
4
+ const selector = createSelectors(FingerRegisterStore);
5
+
6
+ export const useSelector = selector.use.state;
7
+ export const useDispatch = selector.use.dispatch;