@procivis/one-react-native-components 0.2.54 → 0.3.22

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 (874) hide show
  1. package/README.md +3 -8
  2. package/lib/commonjs/components/backup/index.js.map +1 -1
  3. package/lib/commonjs/components/backup/preview-credentials.js +18 -22
  4. package/lib/commonjs/components/backup/preview-credentials.js.map +1 -1
  5. package/lib/commonjs/components/credential/credential.js +11 -12
  6. package/lib/commonjs/components/credential/credential.js.map +1 -1
  7. package/lib/commonjs/components/credential/index.js.map +1 -1
  8. package/lib/commonjs/components/entity/EntityButtons.js +20 -25
  9. package/lib/commonjs/components/entity/EntityButtons.js.map +1 -1
  10. package/lib/commonjs/components/entity/entity-attributes.js +15 -17
  11. package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
  12. package/lib/commonjs/components/entity/entity-details-with-buttons.js +18 -19
  13. package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
  14. package/lib/commonjs/components/entity/entity-details.js +12 -14
  15. package/lib/commonjs/components/entity/entity-details.js.map +1 -1
  16. package/lib/commonjs/components/entity/index.js +2 -2
  17. package/lib/commonjs/components/entity/index.js.map +1 -1
  18. package/lib/commonjs/components/history/history-details-screen.js +67 -0
  19. package/lib/commonjs/components/history/history-details-screen.js.map +1 -0
  20. package/lib/commonjs/components/history/history-list-item-icon.js +94 -0
  21. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -0
  22. package/lib/commonjs/components/history/history-list-item.js +45 -0
  23. package/lib/commonjs/components/history/history-list-item.js.map +1 -0
  24. package/lib/commonjs/components/history/history-list-screen.js +121 -0
  25. package/lib/commonjs/components/history/history-list-screen.js.map +1 -0
  26. package/lib/commonjs/components/history/history-list-section-header.js +39 -0
  27. package/lib/commonjs/components/history/history-list-section-header.js.map +1 -0
  28. package/lib/commonjs/components/history/history-list.js +100 -0
  29. package/lib/commonjs/components/history/history-list.js.map +1 -0
  30. package/lib/commonjs/components/history/index.js +72 -0
  31. package/lib/commonjs/components/history/index.js.map +1 -0
  32. package/lib/commonjs/components/index.js +11 -0
  33. package/lib/commonjs/components/index.js.map +1 -1
  34. package/lib/commonjs/components/navigation/header-buttons.js +21 -25
  35. package/lib/commonjs/components/navigation/header-buttons.js.map +1 -1
  36. package/lib/commonjs/components/navigation/index.js.map +1 -1
  37. package/lib/commonjs/components/proof-request/group.js +4 -5
  38. package/lib/commonjs/components/proof-request/group.js.map +1 -1
  39. package/lib/commonjs/components/proof-request/index.js.map +1 -1
  40. package/lib/commonjs/components/proof-request/select-credential.js +11 -12
  41. package/lib/commonjs/components/proof-request/select-credential.js.map +1 -1
  42. package/lib/commonjs/components/proof-request/share-credential.js +23 -27
  43. package/lib/commonjs/components/proof-request/share-credential.js.map +1 -1
  44. package/lib/commonjs/index.js.map +1 -1
  45. package/lib/commonjs/normalize-color.d.js.map +1 -1
  46. package/lib/commonjs/ui-components/accessibility/accessibility.js +11 -7
  47. package/lib/commonjs/ui-components/accessibility/accessibility.js.map +1 -1
  48. package/lib/commonjs/ui-components/accessibility/accessibilityHistory.js +8 -12
  49. package/lib/commonjs/ui-components/accessibility/accessibilityHistory.js.map +1 -1
  50. package/lib/commonjs/ui-components/accessibility/accessibilityHistoryWrappers.js +15 -17
  51. package/lib/commonjs/ui-components/accessibility/accessibilityHistoryWrappers.js.map +1 -1
  52. package/lib/commonjs/ui-components/accessibility/accessibilityLanguage.js +8 -10
  53. package/lib/commonjs/ui-components/accessibility/accessibilityLanguage.js.map +1 -1
  54. package/lib/commonjs/ui-components/accessibility/index.js +1 -30
  55. package/lib/commonjs/ui-components/accessibility/index.js.map +1 -1
  56. package/lib/commonjs/ui-components/accessibility/locale/index.js +2 -3
  57. package/lib/commonjs/ui-components/accessibility/locale/index.js.map +1 -1
  58. package/lib/commonjs/ui-components/accessibility/locale.test.js.map +1 -1
  59. package/lib/commonjs/ui-components/action-modal/ActionModal.js +9 -11
  60. package/lib/commonjs/ui-components/action-modal/ActionModal.js.map +1 -1
  61. package/lib/commonjs/ui-components/action-modal/index.js +1 -1
  62. package/lib/commonjs/ui-components/action-modal/index.js.map +1 -1
  63. package/lib/commonjs/ui-components/activity-indicator/activity-indicator.js +10 -12
  64. package/lib/commonjs/ui-components/activity-indicator/activity-indicator.js.map +1 -1
  65. package/lib/commonjs/ui-components/activity-indicator/index.js +1 -1
  66. package/lib/commonjs/ui-components/activity-indicator/index.js.map +1 -1
  67. package/lib/commonjs/ui-components/blur/blur-view.js +13 -15
  68. package/lib/commonjs/ui-components/blur/blur-view.js.map +1 -1
  69. package/lib/commonjs/ui-components/blur/index.js +2 -2
  70. package/lib/commonjs/ui-components/blur/index.js.map +1 -1
  71. package/lib/commonjs/ui-components/buttons/back-button.js +12 -15
  72. package/lib/commonjs/ui-components/buttons/back-button.js.map +1 -1
  73. package/lib/commonjs/ui-components/buttons/button.js +19 -22
  74. package/lib/commonjs/ui-components/buttons/button.js.map +1 -1
  75. package/lib/commonjs/ui-components/buttons/connectivity-button.js +16 -18
  76. package/lib/commonjs/ui-components/buttons/connectivity-button.js.map +1 -1
  77. package/lib/commonjs/ui-components/buttons/filter-button.js +8 -10
  78. package/lib/commonjs/ui-components/buttons/filter-button.js.map +1 -1
  79. package/lib/commonjs/ui-components/buttons/ghost-button.js +12 -14
  80. package/lib/commonjs/ui-components/buttons/ghost-button.js.map +1 -1
  81. package/lib/commonjs/ui-components/buttons/hold-button.js +244 -0
  82. package/lib/commonjs/ui-components/buttons/hold-button.js.map +1 -0
  83. package/lib/commonjs/ui-components/buttons/index.js +9 -37
  84. package/lib/commonjs/ui-components/buttons/index.js.map +1 -1
  85. package/lib/commonjs/ui-components/buttons/scan-button.js +7 -9
  86. package/lib/commonjs/ui-components/buttons/scan-button.js.map +1 -1
  87. package/lib/commonjs/ui-components/camera/camera-overlay.js +11 -14
  88. package/lib/commonjs/ui-components/camera/camera-overlay.js.map +1 -1
  89. package/lib/commonjs/ui-components/camera/index.js +2 -2
  90. package/lib/commonjs/ui-components/camera/index.js.map +1 -1
  91. package/lib/commonjs/ui-components/camera/qr-code-scanner.js +12 -14
  92. package/lib/commonjs/ui-components/camera/qr-code-scanner.js.map +1 -1
  93. package/lib/commonjs/ui-components/control/checkbox.js +11 -12
  94. package/lib/commonjs/ui-components/control/checkbox.js.map +1 -1
  95. package/lib/commonjs/ui-components/control/index.js.map +1 -1
  96. package/lib/commonjs/ui-components/control/switch.js +10 -12
  97. package/lib/commonjs/ui-components/control/switch.js.map +1 -1
  98. package/lib/commonjs/ui-components/credential/card/credential-card.js +22 -26
  99. package/lib/commonjs/ui-components/credential/card/credential-card.js.map +1 -1
  100. package/lib/commonjs/ui-components/credential/card/credential-details-card.js +30 -35
  101. package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
  102. package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js +27 -20
  103. package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js.map +1 -1
  104. package/lib/commonjs/ui-components/credential/card/credential-header.js +25 -24
  105. package/lib/commonjs/ui-components/credential/card/credential-header.js.map +1 -1
  106. package/lib/commonjs/ui-components/credential/card/credential-image-carousel.js +27 -29
  107. package/lib/commonjs/ui-components/credential/card/credential-image-carousel.js.map +1 -1
  108. package/lib/commonjs/ui-components/credential/card/index.js +6 -41
  109. package/lib/commonjs/ui-components/credential/card/index.js.map +1 -1
  110. package/lib/commonjs/ui-components/credential/credential-attribute-item.js +51 -60
  111. package/lib/commonjs/ui-components/credential/credential-attribute-item.js.map +1 -1
  112. package/lib/commonjs/ui-components/credential/credential-carousel-images.js +18 -21
  113. package/lib/commonjs/ui-components/credential/credential-carousel-images.js.map +1 -1
  114. package/lib/commonjs/ui-components/credential/index.js +2 -25
  115. package/lib/commonjs/ui-components/credential/index.js.map +1 -1
  116. package/lib/commonjs/ui-components/credential/selector-status.js +3 -4
  117. package/lib/commonjs/ui-components/credential/selector-status.js.map +1 -1
  118. package/lib/commonjs/ui-components/credential/selector.js +8 -10
  119. package/lib/commonjs/ui-components/credential/selector.js.map +1 -1
  120. package/lib/commonjs/ui-components/detail/detail.js +12 -14
  121. package/lib/commonjs/ui-components/detail/detail.js.map +1 -1
  122. package/lib/commonjs/ui-components/detail/index.js +1 -1
  123. package/lib/commonjs/ui-components/detail/index.js.map +1 -1
  124. package/lib/commonjs/ui-components/entity/avatar.js +14 -16
  125. package/lib/commonjs/ui-components/entity/avatar.js.map +1 -1
  126. package/lib/commonjs/ui-components/entity/entity-cluster.js +15 -18
  127. package/lib/commonjs/ui-components/entity/entity-cluster.js.map +1 -1
  128. package/lib/commonjs/ui-components/entity/index.js +2 -2
  129. package/lib/commonjs/ui-components/entity/index.js.map +1 -1
  130. package/lib/commonjs/ui-components/header/focus-aware-status-bar.js +3 -4
  131. package/lib/commonjs/ui-components/header/focus-aware-status-bar.js.map +1 -1
  132. package/lib/commonjs/ui-components/header/foldable-header.js +14 -17
  133. package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
  134. package/lib/commonjs/ui-components/header/header.js +12 -14
  135. package/lib/commonjs/ui-components/header/header.js.map +1 -1
  136. package/lib/commonjs/ui-components/header/index.js +4 -24
  137. package/lib/commonjs/ui-components/header/index.js.map +1 -1
  138. package/lib/commonjs/ui-components/header/navigation-header.js +27 -33
  139. package/lib/commonjs/ui-components/header/navigation-header.js.map +1 -1
  140. package/lib/commonjs/ui-components/history/data-item.js +30 -23
  141. package/lib/commonjs/ui-components/history/data-item.js.map +1 -1
  142. package/lib/commonjs/ui-components/history/history-details.js +181 -0
  143. package/lib/commonjs/ui-components/history/history-details.js.map +1 -0
  144. package/lib/commonjs/ui-components/history/{history-list-item.js → history-item.js} +47 -26
  145. package/lib/commonjs/ui-components/history/history-item.js.map +1 -0
  146. package/lib/commonjs/ui-components/history/history-section-header.js +7 -9
  147. package/lib/commonjs/ui-components/history/history-section-header.js.map +1 -1
  148. package/lib/commonjs/ui-components/history/history-section-list-item.js +13 -12
  149. package/lib/commonjs/ui-components/history/history-section-list-item.js.map +1 -1
  150. package/lib/commonjs/ui-components/history/index.js +30 -9
  151. package/lib/commonjs/ui-components/history/index.js.map +1 -1
  152. package/lib/commonjs/ui-components/icons/connectivity.js +19 -24
  153. package/lib/commonjs/ui-components/icons/connectivity.js.map +1 -1
  154. package/lib/commonjs/ui-components/icons/credential.js +60 -71
  155. package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
  156. package/lib/commonjs/ui-components/icons/entity.js +7 -8
  157. package/lib/commonjs/ui-components/icons/entity.js.map +1 -1
  158. package/lib/commonjs/ui-components/icons/history.js +113 -133
  159. package/lib/commonjs/ui-components/icons/history.js.map +1 -1
  160. package/lib/commonjs/ui-components/icons/icons.js +73 -90
  161. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  162. package/lib/commonjs/ui-components/icons/index.js.map +1 -1
  163. package/lib/commonjs/ui-components/icons/input.js +3 -3
  164. package/lib/commonjs/ui-components/icons/input.js.map +1 -1
  165. package/lib/commonjs/ui-components/icons/keypad.js +69 -81
  166. package/lib/commonjs/ui-components/icons/keypad.js.map +1 -1
  167. package/lib/commonjs/ui-components/icons/loader.js +4 -4
  168. package/lib/commonjs/ui-components/icons/loader.js.map +1 -1
  169. package/lib/commonjs/ui-components/icons/nerd-view.js +6 -9
  170. package/lib/commonjs/ui-components/icons/nerd-view.js.map +1 -1
  171. package/lib/commonjs/ui-components/icons/selector.js +8 -9
  172. package/lib/commonjs/ui-components/icons/selector.js.map +1 -1
  173. package/lib/commonjs/ui-components/icons/wallet.js +16 -19
  174. package/lib/commonjs/ui-components/icons/wallet.js.map +1 -1
  175. package/lib/commonjs/ui-components/image/image-or-component.js +15 -18
  176. package/lib/commonjs/ui-components/image/image-or-component.js.map +1 -1
  177. package/lib/commonjs/ui-components/image/index.js +2 -9
  178. package/lib/commonjs/ui-components/image/index.js.map +1 -1
  179. package/lib/commonjs/ui-components/index.js.map +1 -1
  180. package/lib/commonjs/ui-components/input/index.js +2 -2
  181. package/lib/commonjs/ui-components/input/index.js.map +1 -1
  182. package/lib/commonjs/ui-components/input/radio-group.js +28 -25
  183. package/lib/commonjs/ui-components/input/radio-group.js.map +1 -1
  184. package/lib/commonjs/ui-components/input/selection-input.js +27 -38
  185. package/lib/commonjs/ui-components/input/selection-input.js.map +1 -1
  186. package/lib/commonjs/ui-components/input/text-input.js +25 -28
  187. package/lib/commonjs/ui-components/input/text-input.js.map +1 -1
  188. package/lib/commonjs/ui-components/list/index.js +20 -2
  189. package/lib/commonjs/ui-components/list/index.js.map +1 -1
  190. package/lib/commonjs/ui-components/list/list-page-loading-indicator.js +14 -0
  191. package/lib/commonjs/ui-components/list/list-page-loading-indicator.js.map +1 -0
  192. package/lib/commonjs/ui-components/list/list-section-header.js +10 -12
  193. package/lib/commonjs/ui-components/list/list-section-header.js.map +1 -1
  194. package/lib/commonjs/ui-components/list/list-title-header.js +6 -8
  195. package/lib/commonjs/ui-components/list/list-title-header.js.map +1 -1
  196. package/lib/commonjs/ui-components/list/wallet/empty-list.js +73 -0
  197. package/lib/commonjs/ui-components/list/wallet/empty-list.js.map +1 -0
  198. package/lib/commonjs/ui-components/list/wallet/empty-search-result.js +41 -0
  199. package/lib/commonjs/ui-components/list/wallet/empty-search-result.js.map +1 -0
  200. package/lib/commonjs/ui-components/list/wallet/index.js +21 -0
  201. package/lib/commonjs/ui-components/list/wallet/index.js.map +1 -0
  202. package/lib/commonjs/ui-components/loader/index.js +2 -2
  203. package/lib/commonjs/ui-components/loader/index.js.map +1 -1
  204. package/lib/commonjs/ui-components/loader/loader.js +17 -17
  205. package/lib/commonjs/ui-components/loader/loader.js.map +1 -1
  206. package/lib/commonjs/ui-components/loader/loading-result.js +22 -21
  207. package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
  208. package/lib/commonjs/ui-components/nerd-view/index.js +2 -8
  209. package/lib/commonjs/ui-components/nerd-view/index.js.map +1 -1
  210. package/lib/commonjs/ui-components/nerd-view/nerd-mode-item.js +37 -41
  211. package/lib/commonjs/ui-components/nerd-view/nerd-mode-item.js.map +1 -1
  212. package/lib/commonjs/ui-components/pin/index.js +2 -2
  213. package/lib/commonjs/ui-components/pin/index.js.map +1 -1
  214. package/lib/commonjs/ui-components/pin/keypad.js +19 -23
  215. package/lib/commonjs/ui-components/pin/keypad.js.map +1 -1
  216. package/lib/commonjs/ui-components/pin/pin-code-screen.js +19 -21
  217. package/lib/commonjs/ui-components/pin/pin-code-screen.js.map +1 -1
  218. package/lib/commonjs/ui-components/pin/pin-lock-animation.js +1 -2
  219. package/lib/commonjs/ui-components/pin/pin-lock-animation.js.map +1 -1
  220. package/lib/commonjs/ui-components/pin/pin-lock.js +10 -12
  221. package/lib/commonjs/ui-components/pin/pin-lock.js.map +1 -1
  222. package/lib/commonjs/ui-components/pin/pins.js +8 -9
  223. package/lib/commonjs/ui-components/pin/pins.js.map +1 -1
  224. package/lib/commonjs/ui-components/screens/backup-screen.js +15 -18
  225. package/lib/commonjs/ui-components/screens/backup-screen.js.map +1 -1
  226. package/lib/commonjs/ui-components/screens/image-preview-screen.js +12 -14
  227. package/lib/commonjs/ui-components/screens/image-preview-screen.js.map +1 -1
  228. package/lib/commonjs/ui-components/screens/index.js +8 -49
  229. package/lib/commonjs/ui-components/screens/index.js.map +1 -1
  230. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +34 -41
  231. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
  232. package/lib/commonjs/ui-components/screens/qr-code-scanner-screen.js +14 -16
  233. package/lib/commonjs/ui-components/screens/qr-code-scanner-screen.js.map +1 -1
  234. package/lib/commonjs/ui-components/screens/scroll-view-screen.js +12 -14
  235. package/lib/commonjs/ui-components/screens/scroll-view-screen.js.map +1 -1
  236. package/lib/commonjs/ui-components/screens/section-list-screen.js +13 -15
  237. package/lib/commonjs/ui-components/screens/section-list-screen.js.map +1 -1
  238. package/lib/commonjs/ui-components/searchbar/animated-search-bar.js +10 -12
  239. package/lib/commonjs/ui-components/searchbar/animated-search-bar.js.map +1 -1
  240. package/lib/commonjs/ui-components/searchbar/index.js +2 -2
  241. package/lib/commonjs/ui-components/searchbar/index.js.map +1 -1
  242. package/lib/commonjs/ui-components/searchbar/search-bar.js +15 -17
  243. package/lib/commonjs/ui-components/searchbar/search-bar.js.map +1 -1
  244. package/lib/commonjs/ui-components/settings/button-setting.js +14 -16
  245. package/lib/commonjs/ui-components/settings/button-setting.js.map +1 -1
  246. package/lib/commonjs/ui-components/settings/index.js +2 -2
  247. package/lib/commonjs/ui-components/settings/index.js.map +1 -1
  248. package/lib/commonjs/ui-components/settings/setting-item-separator.js +6 -8
  249. package/lib/commonjs/ui-components/settings/setting-item-separator.js.map +1 -1
  250. package/lib/commonjs/ui-components/settings/setting-item.js +11 -13
  251. package/lib/commonjs/ui-components/settings/setting-item.js.map +1 -1
  252. package/lib/commonjs/ui-components/settings/settings-button.js +7 -9
  253. package/lib/commonjs/ui-components/settings/settings-button.js.map +1 -1
  254. package/lib/commonjs/ui-components/settings/switch-setting.js +11 -13
  255. package/lib/commonjs/ui-components/settings/switch-setting.js.map +1 -1
  256. package/lib/commonjs/ui-components/state/error-screen.js +10 -12
  257. package/lib/commonjs/ui-components/state/error-screen.js.map +1 -1
  258. package/lib/commonjs/ui-components/state/index.js +2 -2
  259. package/lib/commonjs/ui-components/state/index.js.map +1 -1
  260. package/lib/commonjs/ui-components/text/base.js +14 -16
  261. package/lib/commonjs/ui-components/text/base.js.map +1 -1
  262. package/lib/commonjs/ui-components/text/font.js +11 -13
  263. package/lib/commonjs/ui-components/text/font.js.map +1 -1
  264. package/lib/commonjs/ui-components/text/index.js +2 -9
  265. package/lib/commonjs/ui-components/text/index.js.map +1 -1
  266. package/lib/commonjs/ui-components/text/typography.js +10 -13
  267. package/lib/commonjs/ui-components/text/typography.js.map +1 -1
  268. package/lib/commonjs/ui-components/theme/color-scheme-context.js +2 -1
  269. package/lib/commonjs/ui-components/theme/color-scheme-context.js.map +1 -1
  270. package/lib/commonjs/ui-components/theme/color-scheme.js.map +1 -1
  271. package/lib/commonjs/ui-components/theme/index.js.map +1 -1
  272. package/lib/commonjs/utils/array.js.map +1 -1
  273. package/lib/commonjs/utils/backup.js.map +1 -1
  274. package/lib/commonjs/utils/color.js +1 -1
  275. package/lib/commonjs/utils/color.js.map +1 -1
  276. package/lib/commonjs/utils/contrasting-status-bar.js +8 -10
  277. package/lib/commonjs/utils/contrasting-status-bar.js.map +1 -1
  278. package/lib/commonjs/utils/date.js +3 -3
  279. package/lib/commonjs/utils/date.js.map +1 -1
  280. package/lib/commonjs/utils/filtering.js +11 -0
  281. package/lib/commonjs/utils/filtering.js.map +1 -0
  282. package/lib/commonjs/utils/history.js +76 -0
  283. package/lib/commonjs/utils/history.js.map +1 -0
  284. package/lib/commonjs/utils/hooks/connectivity/connectivity.js +37 -23
  285. package/lib/commonjs/utils/hooks/connectivity/connectivity.js.map +1 -1
  286. package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js +6 -0
  287. package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js.map +1 -1
  288. package/lib/commonjs/utils/hooks/core/backup.js +31 -31
  289. package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
  290. package/lib/commonjs/utils/hooks/core/cache.js +44 -0
  291. package/lib/commonjs/utils/hooks/core/cache.js.map +1 -0
  292. package/lib/commonjs/utils/hooks/core/core-config.js +15 -1
  293. package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
  294. package/lib/commonjs/utils/hooks/core/core-context.js +15 -10
  295. package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
  296. package/lib/commonjs/utils/hooks/core/core-init.js +18 -12
  297. package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
  298. package/lib/commonjs/utils/hooks/core/credential-schemas.js +16 -27
  299. package/lib/commonjs/utils/hooks/core/credential-schemas.js.map +1 -1
  300. package/lib/commonjs/utils/hooks/core/credentials.js +27 -37
  301. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  302. package/lib/commonjs/utils/hooks/core/dids.js +4 -6
  303. package/lib/commonjs/utils/hooks/core/dids.js.map +1 -1
  304. package/lib/commonjs/utils/hooks/core/error-code.js +3 -4
  305. package/lib/commonjs/utils/hooks/core/error-code.js.map +1 -1
  306. package/lib/commonjs/utils/hooks/core/history.js +5 -37
  307. package/lib/commonjs/utils/hooks/core/history.js.map +1 -1
  308. package/lib/commonjs/utils/hooks/core/index.js +11 -0
  309. package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
  310. package/lib/commonjs/utils/hooks/core/proof-schemas.js +23 -38
  311. package/lib/commonjs/utils/hooks/core/proof-schemas.js.map +1 -1
  312. package/lib/commonjs/utils/hooks/core/proofs.js +107 -76
  313. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  314. package/lib/commonjs/utils/hooks/core/query.js +1 -2
  315. package/lib/commonjs/utils/hooks/core/query.js.map +1 -1
  316. package/lib/commonjs/utils/hooks/core/trust-entity.js +8 -4
  317. package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
  318. package/lib/commonjs/utils/hooks/credential-card/credential-card-expanding.js.map +1 -1
  319. package/lib/commonjs/utils/hooks/header/on-scroll-header-state.js +1 -2
  320. package/lib/commonjs/utils/hooks/header/on-scroll-header-state.js.map +1 -1
  321. package/lib/commonjs/utils/hooks/http/client.js.map +1 -1
  322. package/lib/commonjs/utils/hooks/index.js.map +1 -1
  323. package/lib/commonjs/utils/hooks/list/list-content-inset.js +9 -10
  324. package/lib/commonjs/utils/hooks/list/list-content-inset.js.map +1 -1
  325. package/lib/commonjs/utils/hooks/navigation/before-remove.js.map +1 -1
  326. package/lib/commonjs/utils/hooks/navigation/close-button-timeout.js.map +1 -1
  327. package/lib/commonjs/utils/hooks/navigation/deep-link.js +3 -4
  328. package/lib/commonjs/utils/hooks/navigation/deep-link.js.map +1 -1
  329. package/lib/commonjs/utils/hooks/navigation/index.js.map +1 -1
  330. package/lib/commonjs/utils/hooks/navigation/open-settings.js +1 -2
  331. package/lib/commonjs/utils/hooks/navigation/open-settings.js.map +1 -1
  332. package/lib/commonjs/utils/hooks/pin-security/pin-security.js +1 -2
  333. package/lib/commonjs/utils/hooks/pin-security/pin-security.js.map +1 -1
  334. package/lib/commonjs/utils/hooks/revocation/credential-status.js +17 -26
  335. package/lib/commonjs/utils/hooks/revocation/credential-status.js.map +1 -1
  336. package/lib/commonjs/utils/index.js +37 -1
  337. package/lib/commonjs/utils/index.js.map +1 -1
  338. package/lib/commonjs/utils/navigation.js +5 -5
  339. package/lib/commonjs/utils/navigation.js.map +1 -1
  340. package/lib/commonjs/utils/parsers/credential-images.js +1 -1
  341. package/lib/commonjs/utils/parsers/credential-images.js.map +1 -1
  342. package/lib/commonjs/utils/parsers/credential-sharing.js +16 -20
  343. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  344. package/lib/commonjs/utils/parsers/credential.js +16 -26
  345. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  346. package/lib/commonjs/utils/parsers/index.js +11 -0
  347. package/lib/commonjs/utils/parsers/index.js.map +1 -1
  348. package/lib/commonjs/utils/parsers/query.js +3 -2
  349. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  350. package/lib/commonjs/utils/parsers/universal-links.js +33 -0
  351. package/lib/commonjs/utils/parsers/universal-links.js.map +1 -0
  352. package/lib/commonjs/utils/parsers/universal-links.test.js +40 -0
  353. package/lib/commonjs/utils/parsers/universal-links.test.js.map +1 -0
  354. package/lib/commonjs/utils/ref.js.map +1 -1
  355. package/lib/commonjs/utils/reporting.js +4 -2
  356. package/lib/commonjs/utils/reporting.js.map +1 -1
  357. package/lib/commonjs/utils/string.js.map +1 -1
  358. package/lib/commonjs/utils/testID.js +1 -4
  359. package/lib/commonjs/utils/testID.js.map +1 -1
  360. package/lib/commonjs/utils/testID.test.js.map +1 -1
  361. package/lib/commonjs/utils/useMemoAsync.js +9 -0
  362. package/lib/commonjs/utils/useMemoAsync.js.map +1 -1
  363. package/lib/commonjs/utils/uuid.js +1 -1
  364. package/lib/commonjs/utils/uuid.js.map +1 -1
  365. package/lib/module/components/backup/index.js.map +1 -1
  366. package/lib/module/components/backup/preview-credentials.js +17 -21
  367. package/lib/module/components/backup/preview-credentials.js.map +1 -1
  368. package/lib/module/components/credential/credential.js +10 -11
  369. package/lib/module/components/credential/credential.js.map +1 -1
  370. package/lib/module/components/credential/index.js.map +1 -1
  371. package/lib/module/components/entity/EntityButtons.js +17 -21
  372. package/lib/module/components/entity/EntityButtons.js.map +1 -1
  373. package/lib/module/components/entity/entity-attributes.js +12 -13
  374. package/lib/module/components/entity/entity-attributes.js.map +1 -1
  375. package/lib/module/components/entity/entity-details-with-buttons.js +15 -15
  376. package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
  377. package/lib/module/components/entity/entity-details.js +8 -9
  378. package/lib/module/components/entity/entity-details.js.map +1 -1
  379. package/lib/module/components/entity/index.js.map +1 -1
  380. package/lib/module/components/history/history-details-screen.js +59 -0
  381. package/lib/module/components/history/history-details-screen.js.map +1 -0
  382. package/lib/module/components/history/history-list-item-icon.js +84 -0
  383. package/lib/module/components/history/history-list-item-icon.js.map +1 -0
  384. package/lib/module/components/history/history-list-item.js +36 -0
  385. package/lib/module/components/history/history-list-item.js.map +1 -0
  386. package/lib/module/components/history/history-list-screen.js +112 -0
  387. package/lib/module/components/history/history-list-screen.js.map +1 -0
  388. package/lib/module/components/history/history-list-section-header.js +29 -0
  389. package/lib/module/components/history/history-list-section-header.js.map +1 -0
  390. package/lib/module/components/history/history-list.js +90 -0
  391. package/lib/module/components/history/history-list.js.map +1 -0
  392. package/lib/module/components/history/index.js +7 -0
  393. package/lib/module/components/history/index.js.map +1 -0
  394. package/lib/module/components/index.js +1 -0
  395. package/lib/module/components/index.js.map +1 -1
  396. package/lib/module/components/navigation/header-buttons.js +19 -23
  397. package/lib/module/components/navigation/header-buttons.js.map +1 -1
  398. package/lib/module/components/navigation/index.js.map +1 -1
  399. package/lib/module/components/proof-request/group.js +3 -4
  400. package/lib/module/components/proof-request/group.js.map +1 -1
  401. package/lib/module/components/proof-request/index.js.map +1 -1
  402. package/lib/module/components/proof-request/select-credential.js +10 -11
  403. package/lib/module/components/proof-request/select-credential.js.map +1 -1
  404. package/lib/module/components/proof-request/share-credential.js +21 -25
  405. package/lib/module/components/proof-request/share-credential.js.map +1 -1
  406. package/lib/module/index.js.map +1 -1
  407. package/lib/module/normalize-color.d.js.map +1 -1
  408. package/lib/module/ui-components/accessibility/accessibility.js +5 -7
  409. package/lib/module/ui-components/accessibility/accessibility.js.map +1 -1
  410. package/lib/module/ui-components/accessibility/accessibilityHistory.js +4 -8
  411. package/lib/module/ui-components/accessibility/accessibilityHistory.js.map +1 -1
  412. package/lib/module/ui-components/accessibility/accessibilityHistoryWrappers.js +10 -8
  413. package/lib/module/ui-components/accessibility/accessibilityHistoryWrappers.js.map +1 -1
  414. package/lib/module/ui-components/accessibility/accessibilityLanguage.js +6 -8
  415. package/lib/module/ui-components/accessibility/accessibilityLanguage.js.map +1 -1
  416. package/lib/module/ui-components/accessibility/index.js +4 -4
  417. package/lib/module/ui-components/accessibility/index.js.map +1 -1
  418. package/lib/module/ui-components/accessibility/locale/index.js.map +1 -1
  419. package/lib/module/ui-components/accessibility/locale.test.js.map +1 -1
  420. package/lib/module/ui-components/action-modal/ActionModal.js +7 -8
  421. package/lib/module/ui-components/action-modal/ActionModal.js.map +1 -1
  422. package/lib/module/ui-components/action-modal/index.js.map +1 -1
  423. package/lib/module/ui-components/activity-indicator/activity-indicator.js +6 -7
  424. package/lib/module/ui-components/activity-indicator/activity-indicator.js.map +1 -1
  425. package/lib/module/ui-components/activity-indicator/index.js.map +1 -1
  426. package/lib/module/ui-components/blur/blur-view.js +10 -11
  427. package/lib/module/ui-components/blur/blur-view.js.map +1 -1
  428. package/lib/module/ui-components/blur/index.js.map +1 -1
  429. package/lib/module/ui-components/buttons/back-button.js +10 -11
  430. package/lib/module/ui-components/buttons/back-button.js.map +1 -1
  431. package/lib/module/ui-components/buttons/button.js +17 -18
  432. package/lib/module/ui-components/buttons/button.js.map +1 -1
  433. package/lib/module/ui-components/buttons/connectivity-button.js +14 -14
  434. package/lib/module/ui-components/buttons/connectivity-button.js.map +1 -1
  435. package/lib/module/ui-components/buttons/filter-button.js +6 -7
  436. package/lib/module/ui-components/buttons/filter-button.js.map +1 -1
  437. package/lib/module/ui-components/buttons/ghost-button.js +9 -10
  438. package/lib/module/ui-components/buttons/ghost-button.js.map +1 -1
  439. package/lib/module/ui-components/buttons/hold-button.js +236 -0
  440. package/lib/module/ui-components/buttons/hold-button.js.map +1 -0
  441. package/lib/module/ui-components/buttons/index.js +8 -7
  442. package/lib/module/ui-components/buttons/index.js.map +1 -1
  443. package/lib/module/ui-components/buttons/scan-button.js +5 -6
  444. package/lib/module/ui-components/buttons/scan-button.js.map +1 -1
  445. package/lib/module/ui-components/camera/camera-overlay.js +7 -9
  446. package/lib/module/ui-components/camera/camera-overlay.js.map +1 -1
  447. package/lib/module/ui-components/camera/index.js.map +1 -1
  448. package/lib/module/ui-components/camera/qr-code-scanner.js +8 -9
  449. package/lib/module/ui-components/camera/qr-code-scanner.js.map +1 -1
  450. package/lib/module/ui-components/control/checkbox.js +9 -10
  451. package/lib/module/ui-components/control/checkbox.js.map +1 -1
  452. package/lib/module/ui-components/control/index.js.map +1 -1
  453. package/lib/module/ui-components/control/switch.js +8 -9
  454. package/lib/module/ui-components/control/switch.js.map +1 -1
  455. package/lib/module/ui-components/credential/card/credential-card.js +16 -17
  456. package/lib/module/ui-components/credential/card/credential-card.js.map +1 -1
  457. package/lib/module/ui-components/credential/card/credential-details-card.js +26 -30
  458. package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
  459. package/lib/module/ui-components/credential/card/credential-details-list-item.js +23 -15
  460. package/lib/module/ui-components/credential/card/credential-details-list-item.js.map +1 -1
  461. package/lib/module/ui-components/credential/card/credential-header.js +21 -19
  462. package/lib/module/ui-components/credential/card/credential-header.js.map +1 -1
  463. package/lib/module/ui-components/credential/card/credential-image-carousel.js +23 -23
  464. package/lib/module/ui-components/credential/card/credential-image-carousel.js.map +1 -1
  465. package/lib/module/ui-components/credential/card/index.js +10 -10
  466. package/lib/module/ui-components/credential/card/index.js.map +1 -1
  467. package/lib/module/ui-components/credential/credential-attribute-item.js +47 -55
  468. package/lib/module/ui-components/credential/credential-attribute-item.js.map +1 -1
  469. package/lib/module/ui-components/credential/credential-carousel-images.js +15 -18
  470. package/lib/module/ui-components/credential/credential-carousel-images.js.map +1 -1
  471. package/lib/module/ui-components/credential/index.js +2 -2
  472. package/lib/module/ui-components/credential/index.js.map +1 -1
  473. package/lib/module/ui-components/credential/selector-status.js +3 -3
  474. package/lib/module/ui-components/credential/selector-status.js.map +1 -1
  475. package/lib/module/ui-components/credential/selector.js +5 -6
  476. package/lib/module/ui-components/credential/selector.js.map +1 -1
  477. package/lib/module/ui-components/detail/detail.js +9 -10
  478. package/lib/module/ui-components/detail/detail.js.map +1 -1
  479. package/lib/module/ui-components/detail/index.js.map +1 -1
  480. package/lib/module/ui-components/entity/avatar.js +10 -11
  481. package/lib/module/ui-components/entity/avatar.js.map +1 -1
  482. package/lib/module/ui-components/entity/entity-cluster.js +11 -13
  483. package/lib/module/ui-components/entity/entity-cluster.js.map +1 -1
  484. package/lib/module/ui-components/entity/index.js.map +1 -1
  485. package/lib/module/ui-components/header/focus-aware-status-bar.js +1 -1
  486. package/lib/module/ui-components/header/focus-aware-status-bar.js.map +1 -1
  487. package/lib/module/ui-components/header/foldable-header.js +10 -12
  488. package/lib/module/ui-components/header/foldable-header.js.map +1 -1
  489. package/lib/module/ui-components/header/header.js +10 -11
  490. package/lib/module/ui-components/header/header.js.map +1 -1
  491. package/lib/module/ui-components/header/index.js +6 -6
  492. package/lib/module/ui-components/header/index.js.map +1 -1
  493. package/lib/module/ui-components/header/navigation-header.js +23 -28
  494. package/lib/module/ui-components/header/navigation-header.js.map +1 -1
  495. package/lib/module/ui-components/history/data-item.js +23 -15
  496. package/lib/module/ui-components/history/data-item.js.map +1 -1
  497. package/lib/module/ui-components/history/history-details.js +171 -0
  498. package/lib/module/ui-components/history/history-details.js.map +1 -0
  499. package/lib/module/ui-components/history/{history-list-item.js → history-item.js} +44 -22
  500. package/lib/module/ui-components/history/history-item.js.map +1 -0
  501. package/lib/module/ui-components/history/history-section-header.js +6 -7
  502. package/lib/module/ui-components/history/history-section-header.js.map +1 -1
  503. package/lib/module/ui-components/history/history-section-list-item.js +8 -9
  504. package/lib/module/ui-components/history/history-section-list-item.js.map +1 -1
  505. package/lib/module/ui-components/history/index.js +5 -4
  506. package/lib/module/ui-components/history/index.js.map +1 -1
  507. package/lib/module/ui-components/icons/connectivity.js +16 -21
  508. package/lib/module/ui-components/icons/connectivity.js.map +1 -1
  509. package/lib/module/ui-components/icons/credential.js +57 -68
  510. package/lib/module/ui-components/icons/credential.js.map +1 -1
  511. package/lib/module/ui-components/icons/entity.js +4 -5
  512. package/lib/module/ui-components/icons/entity.js.map +1 -1
  513. package/lib/module/ui-components/icons/history.js +101 -128
  514. package/lib/module/ui-components/icons/history.js.map +1 -1
  515. package/lib/module/ui-components/icons/icons.js +70 -87
  516. package/lib/module/ui-components/icons/icons.js.map +1 -1
  517. package/lib/module/ui-components/icons/index.js.map +1 -1
  518. package/lib/module/ui-components/icons/input.js.map +1 -1
  519. package/lib/module/ui-components/icons/keypad.js +66 -78
  520. package/lib/module/ui-components/icons/keypad.js.map +1 -1
  521. package/lib/module/ui-components/icons/loader.js +1 -1
  522. package/lib/module/ui-components/icons/loader.js.map +1 -1
  523. package/lib/module/ui-components/icons/nerd-view.js.map +1 -1
  524. package/lib/module/ui-components/icons/selector.js +5 -6
  525. package/lib/module/ui-components/icons/selector.js.map +1 -1
  526. package/lib/module/ui-components/icons/wallet.js +13 -16
  527. package/lib/module/ui-components/icons/wallet.js.map +1 -1
  528. package/lib/module/ui-components/image/image-or-component.js +12 -14
  529. package/lib/module/ui-components/image/image-or-component.js.map +1 -1
  530. package/lib/module/ui-components/image/index.js +2 -2
  531. package/lib/module/ui-components/image/index.js.map +1 -1
  532. package/lib/module/ui-components/index.js.map +1 -1
  533. package/lib/module/ui-components/input/index.js.map +1 -1
  534. package/lib/module/ui-components/input/radio-group.js +26 -22
  535. package/lib/module/ui-components/input/radio-group.js.map +1 -1
  536. package/lib/module/ui-components/input/selection-input.js +21 -31
  537. package/lib/module/ui-components/input/selection-input.js.map +1 -1
  538. package/lib/module/ui-components/input/text-input.js +21 -22
  539. package/lib/module/ui-components/input/text-input.js.map +1 -1
  540. package/lib/module/ui-components/list/index.js +1 -0
  541. package/lib/module/ui-components/list/index.js.map +1 -1
  542. package/lib/module/ui-components/list/list-page-loading-indicator.js +7 -0
  543. package/lib/module/ui-components/list/list-page-loading-indicator.js.map +1 -0
  544. package/lib/module/ui-components/list/list-section-header.js +8 -9
  545. package/lib/module/ui-components/list/list-section-header.js.map +1 -1
  546. package/lib/module/ui-components/list/list-title-header.js +4 -5
  547. package/lib/module/ui-components/list/list-title-header.js.map +1 -1
  548. package/lib/module/ui-components/list/wallet/empty-list.js +66 -0
  549. package/lib/module/ui-components/list/wallet/empty-list.js.map +1 -0
  550. package/lib/module/ui-components/list/wallet/empty-search-result.js +34 -0
  551. package/lib/module/ui-components/list/wallet/empty-search-result.js.map +1 -0
  552. package/lib/module/ui-components/list/wallet/index.js +4 -0
  553. package/lib/module/ui-components/list/wallet/index.js.map +1 -0
  554. package/lib/module/ui-components/loader/index.js.map +1 -1
  555. package/lib/module/ui-components/loader/loader.js +14 -12
  556. package/lib/module/ui-components/loader/loader.js.map +1 -1
  557. package/lib/module/ui-components/loader/loading-result.js +21 -19
  558. package/lib/module/ui-components/loader/loading-result.js.map +1 -1
  559. package/lib/module/ui-components/nerd-view/index.js +2 -2
  560. package/lib/module/ui-components/nerd-view/index.js.map +1 -1
  561. package/lib/module/ui-components/nerd-view/nerd-mode-item.js +31 -34
  562. package/lib/module/ui-components/nerd-view/nerd-mode-item.js.map +1 -1
  563. package/lib/module/ui-components/pin/index.js.map +1 -1
  564. package/lib/module/ui-components/pin/keypad.js +17 -19
  565. package/lib/module/ui-components/pin/keypad.js.map +1 -1
  566. package/lib/module/ui-components/pin/pin-code-screen.js +16 -17
  567. package/lib/module/ui-components/pin/pin-code-screen.js.map +1 -1
  568. package/lib/module/ui-components/pin/pin-lock-animation.js.map +1 -1
  569. package/lib/module/ui-components/pin/pin-lock.js +6 -7
  570. package/lib/module/ui-components/pin/pin-lock.js.map +1 -1
  571. package/lib/module/ui-components/pin/pins.js +7 -8
  572. package/lib/module/ui-components/pin/pins.js.map +1 -1
  573. package/lib/module/ui-components/screens/backup-screen.js +13 -14
  574. package/lib/module/ui-components/screens/backup-screen.js.map +1 -1
  575. package/lib/module/ui-components/screens/image-preview-screen.js +9 -10
  576. package/lib/module/ui-components/screens/image-preview-screen.js.map +1 -1
  577. package/lib/module/ui-components/screens/index.js +12 -12
  578. package/lib/module/ui-components/screens/index.js.map +1 -1
  579. package/lib/module/ui-components/screens/nerd-mode-screen.js +29 -34
  580. package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
  581. package/lib/module/ui-components/screens/qr-code-scanner-screen.js +10 -11
  582. package/lib/module/ui-components/screens/qr-code-scanner-screen.js.map +1 -1
  583. package/lib/module/ui-components/screens/scroll-view-screen.js +10 -11
  584. package/lib/module/ui-components/screens/scroll-view-screen.js.map +1 -1
  585. package/lib/module/ui-components/screens/section-list-screen.js +11 -12
  586. package/lib/module/ui-components/screens/section-list-screen.js.map +1 -1
  587. package/lib/module/ui-components/searchbar/animated-search-bar.js +6 -7
  588. package/lib/module/ui-components/searchbar/animated-search-bar.js.map +1 -1
  589. package/lib/module/ui-components/searchbar/index.js.map +1 -1
  590. package/lib/module/ui-components/searchbar/search-bar.js +11 -12
  591. package/lib/module/ui-components/searchbar/search-bar.js.map +1 -1
  592. package/lib/module/ui-components/settings/button-setting.js +10 -11
  593. package/lib/module/ui-components/settings/button-setting.js.map +1 -1
  594. package/lib/module/ui-components/settings/index.js.map +1 -1
  595. package/lib/module/ui-components/settings/setting-item-separator.js +4 -5
  596. package/lib/module/ui-components/settings/setting-item-separator.js.map +1 -1
  597. package/lib/module/ui-components/settings/setting-item.js +7 -8
  598. package/lib/module/ui-components/settings/setting-item.js.map +1 -1
  599. package/lib/module/ui-components/settings/settings-button.js +5 -6
  600. package/lib/module/ui-components/settings/settings-button.js.map +1 -1
  601. package/lib/module/ui-components/settings/switch-setting.js +9 -10
  602. package/lib/module/ui-components/settings/switch-setting.js.map +1 -1
  603. package/lib/module/ui-components/state/error-screen.js +7 -8
  604. package/lib/module/ui-components/state/error-screen.js.map +1 -1
  605. package/lib/module/ui-components/state/index.js.map +1 -1
  606. package/lib/module/ui-components/text/base.js +12 -13
  607. package/lib/module/ui-components/text/base.js.map +1 -1
  608. package/lib/module/ui-components/text/font.js +10 -11
  609. package/lib/module/ui-components/text/font.js.map +1 -1
  610. package/lib/module/ui-components/text/index.js +2 -2
  611. package/lib/module/ui-components/text/index.js.map +1 -1
  612. package/lib/module/ui-components/text/typography.js +8 -10
  613. package/lib/module/ui-components/text/typography.js.map +1 -1
  614. package/lib/module/ui-components/theme/color-scheme-context.js +1 -0
  615. package/lib/module/ui-components/theme/color-scheme-context.js.map +1 -1
  616. package/lib/module/ui-components/theme/color-scheme.js.map +1 -1
  617. package/lib/module/ui-components/theme/index.js.map +1 -1
  618. package/lib/module/utils/array.js.map +1 -1
  619. package/lib/module/utils/backup.js.map +1 -1
  620. package/lib/module/utils/color.js.map +1 -1
  621. package/lib/module/utils/contrasting-status-bar.js +5 -6
  622. package/lib/module/utils/contrasting-status-bar.js.map +1 -1
  623. package/lib/module/utils/date.js +4 -4
  624. package/lib/module/utils/date.js.map +1 -1
  625. package/lib/module/utils/filtering.js +4 -0
  626. package/lib/module/utils/filtering.js.map +1 -0
  627. package/lib/module/utils/history.js +66 -0
  628. package/lib/module/utils/history.js.map +1 -0
  629. package/lib/module/utils/hooks/connectivity/connectivity.js +36 -19
  630. package/lib/module/utils/hooks/connectivity/connectivity.js.map +1 -1
  631. package/lib/module/utils/hooks/connectivity/connectivity.test.js +6 -0
  632. package/lib/module/utils/hooks/connectivity/connectivity.test.js.map +1 -1
  633. package/lib/module/utils/hooks/core/backup.js +31 -31
  634. package/lib/module/utils/hooks/core/backup.js.map +1 -1
  635. package/lib/module/utils/hooks/core/cache.js +37 -0
  636. package/lib/module/utils/hooks/core/cache.js.map +1 -0
  637. package/lib/module/utils/hooks/core/core-config.js +11 -0
  638. package/lib/module/utils/hooks/core/core-config.js.map +1 -1
  639. package/lib/module/utils/hooks/core/core-context.js +14 -9
  640. package/lib/module/utils/hooks/core/core-context.js.map +1 -1
  641. package/lib/module/utils/hooks/core/core-init.js +16 -8
  642. package/lib/module/utils/hooks/core/core-init.js.map +1 -1
  643. package/lib/module/utils/hooks/core/credential-schemas.js +12 -19
  644. package/lib/module/utils/hooks/core/credential-schemas.js.map +1 -1
  645. package/lib/module/utils/hooks/core/credentials.js +26 -36
  646. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  647. package/lib/module/utils/hooks/core/dids.js +3 -4
  648. package/lib/module/utils/hooks/core/dids.js.map +1 -1
  649. package/lib/module/utils/hooks/core/error-code.js +3 -3
  650. package/lib/module/utils/hooks/core/error-code.js.map +1 -1
  651. package/lib/module/utils/hooks/core/history.js +4 -35
  652. package/lib/module/utils/hooks/core/history.js.map +1 -1
  653. package/lib/module/utils/hooks/core/index.js +1 -0
  654. package/lib/module/utils/hooks/core/index.js.map +1 -1
  655. package/lib/module/utils/hooks/core/proof-schemas.js +19 -30
  656. package/lib/module/utils/hooks/core/proof-schemas.js.map +1 -1
  657. package/lib/module/utils/hooks/core/proofs.js +101 -67
  658. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  659. package/lib/module/utils/hooks/core/query.js.map +1 -1
  660. package/lib/module/utils/hooks/core/trust-entity.js +7 -3
  661. package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
  662. package/lib/module/utils/hooks/credential-card/credential-card-expanding.js.map +1 -1
  663. package/lib/module/utils/hooks/header/on-scroll-header-state.js +1 -2
  664. package/lib/module/utils/hooks/header/on-scroll-header-state.js.map +1 -1
  665. package/lib/module/utils/hooks/http/client.js.map +1 -1
  666. package/lib/module/utils/hooks/index.js.map +1 -1
  667. package/lib/module/utils/hooks/list/list-content-inset.js +9 -10
  668. package/lib/module/utils/hooks/list/list-content-inset.js.map +1 -1
  669. package/lib/module/utils/hooks/navigation/before-remove.js.map +1 -1
  670. package/lib/module/utils/hooks/navigation/close-button-timeout.js.map +1 -1
  671. package/lib/module/utils/hooks/navigation/deep-link.js +3 -4
  672. package/lib/module/utils/hooks/navigation/deep-link.js.map +1 -1
  673. package/lib/module/utils/hooks/navigation/index.js.map +1 -1
  674. package/lib/module/utils/hooks/navigation/open-settings.js +1 -2
  675. package/lib/module/utils/hooks/navigation/open-settings.js.map +1 -1
  676. package/lib/module/utils/hooks/pin-security/pin-security.js +1 -2
  677. package/lib/module/utils/hooks/pin-security/pin-security.js.map +1 -1
  678. package/lib/module/utils/hooks/revocation/credential-status.js +17 -26
  679. package/lib/module/utils/hooks/revocation/credential-status.js.map +1 -1
  680. package/lib/module/utils/index.js +3 -0
  681. package/lib/module/utils/index.js.map +1 -1
  682. package/lib/module/utils/navigation.js +5 -5
  683. package/lib/module/utils/navigation.js.map +1 -1
  684. package/lib/module/utils/parsers/credential-images.js.map +1 -1
  685. package/lib/module/utils/parsers/credential-sharing.js +15 -19
  686. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  687. package/lib/module/utils/parsers/credential.js +16 -25
  688. package/lib/module/utils/parsers/credential.js.map +1 -1
  689. package/lib/module/utils/parsers/index.js +1 -0
  690. package/lib/module/utils/parsers/index.js.map +1 -1
  691. package/lib/module/utils/parsers/query.js +3 -2
  692. package/lib/module/utils/parsers/query.js.map +1 -1
  693. package/lib/module/utils/parsers/universal-links.js +25 -0
  694. package/lib/module/utils/parsers/universal-links.js.map +1 -0
  695. package/lib/module/utils/parsers/universal-links.test.js +38 -0
  696. package/lib/module/utils/parsers/universal-links.test.js.map +1 -0
  697. package/lib/module/utils/ref.js.map +1 -1
  698. package/lib/module/utils/reporting.js +1 -0
  699. package/lib/module/utils/reporting.js.map +1 -1
  700. package/lib/module/utils/string.js.map +1 -1
  701. package/lib/module/utils/testID.js +1 -4
  702. package/lib/module/utils/testID.js.map +1 -1
  703. package/lib/module/utils/testID.test.js.map +1 -1
  704. package/lib/module/utils/useMemoAsync.js +10 -0
  705. package/lib/module/utils/useMemoAsync.js.map +1 -1
  706. package/lib/module/utils/uuid.js.map +1 -1
  707. package/lib/typescript/components/entity/entity-attributes.d.ts +1 -0
  708. package/lib/typescript/components/history/history-details-screen.d.ts +20 -0
  709. package/lib/typescript/components/history/history-list-item-icon.d.ts +8 -0
  710. package/lib/typescript/components/history/history-list-item.d.ts +20 -0
  711. package/lib/typescript/components/history/history-list-screen.d.ts +22 -0
  712. package/lib/typescript/components/history/history-list-section-header.d.ts +13 -0
  713. package/lib/typescript/components/history/history-list.d.ts +19 -0
  714. package/lib/typescript/components/history/index.d.ts +6 -0
  715. package/lib/typescript/components/index.d.ts +1 -0
  716. package/lib/typescript/ui-components/accessibility/accessibility.d.ts +2 -2
  717. package/lib/typescript/ui-components/accessibility/accessibilityHistory.d.ts +1 -1
  718. package/lib/typescript/ui-components/accessibility/accessibilityHistoryWrappers.d.ts +3 -3
  719. package/lib/typescript/ui-components/accessibility/index.d.ts +5 -3
  720. package/lib/typescript/ui-components/buttons/button.d.ts +2 -2
  721. package/lib/typescript/ui-components/buttons/hold-button.d.ts +16 -0
  722. package/lib/typescript/ui-components/buttons/index.d.ts +15 -7
  723. package/lib/typescript/ui-components/buttons/scan-button.d.ts +2 -2
  724. package/lib/typescript/ui-components/credential/card/credential-header.d.ts +1 -1
  725. package/lib/typescript/ui-components/credential/card/index.d.ts +10 -5
  726. package/lib/typescript/ui-components/credential/index.d.ts +2 -1
  727. package/lib/typescript/ui-components/header/index.d.ts +6 -3
  728. package/lib/typescript/ui-components/history/data-item.d.ts +2 -2
  729. package/lib/typescript/ui-components/history/history-details.d.ts +51 -0
  730. package/lib/typescript/ui-components/history/{history-list-item.d.ts → history-item.d.ts} +4 -3
  731. package/lib/typescript/ui-components/history/history-section-header.d.ts +2 -2
  732. package/lib/typescript/ui-components/history/history-section-list-item.d.ts +2 -2
  733. package/lib/typescript/ui-components/history/index.d.ts +5 -4
  734. package/lib/typescript/ui-components/icons/history.d.ts +20 -35
  735. package/lib/typescript/ui-components/image/index.d.ts +2 -1
  736. package/lib/typescript/ui-components/input/selection-input.d.ts +1 -1
  737. package/lib/typescript/ui-components/list/index.d.ts +1 -0
  738. package/lib/typescript/ui-components/list/list-page-loading-indicator.d.ts +4 -0
  739. package/lib/typescript/ui-components/list/wallet/empty-list.d.ts +10 -0
  740. package/lib/typescript/ui-components/list/wallet/empty-search-result.d.ts +7 -0
  741. package/lib/typescript/ui-components/list/wallet/index.d.ts +3 -0
  742. package/lib/typescript/ui-components/nerd-view/index.d.ts +2 -1
  743. package/lib/typescript/ui-components/pin/keypad.d.ts +2 -2
  744. package/lib/typescript/ui-components/screens/index.d.ts +12 -6
  745. package/lib/typescript/ui-components/text/index.d.ts +2 -1
  746. package/lib/typescript/ui-components/text/typography.d.ts +14 -14
  747. package/lib/typescript/ui-components/theme/color-scheme.d.ts +1 -0
  748. package/lib/typescript/utils/filtering.d.ts +1 -0
  749. package/lib/typescript/utils/history.d.ts +10 -0
  750. package/lib/typescript/utils/hooks/connectivity/connectivity.d.ts +1 -1
  751. package/lib/typescript/utils/hooks/core/backup.d.ts +2 -1
  752. package/lib/typescript/utils/hooks/core/cache.d.ts +2 -0
  753. package/lib/typescript/utils/hooks/core/core-config.d.ts +5 -1
  754. package/lib/typescript/utils/hooks/core/core-init.d.ts +10 -1
  755. package/lib/typescript/utils/hooks/core/credentials.d.ts +7 -3
  756. package/lib/typescript/utils/hooks/core/history.d.ts +2 -5
  757. package/lib/typescript/utils/hooks/core/index.d.ts +1 -0
  758. package/lib/typescript/utils/hooks/core/proofs.d.ts +14 -8
  759. package/lib/typescript/utils/hooks/core/trust-entity.d.ts +5 -0
  760. package/lib/typescript/utils/hooks/revocation/credential-status.d.ts +2 -1
  761. package/lib/typescript/utils/index.d.ts +3 -0
  762. package/lib/typescript/utils/parsers/index.d.ts +1 -0
  763. package/lib/typescript/utils/parsers/universal-links.d.ts +1 -0
  764. package/lib/typescript/utils/parsers/universal-links.test.d.ts +1 -0
  765. package/lib/typescript/utils/ref.d.ts +1 -1
  766. package/package.json +60 -46
  767. package/src/components/entity/entity-attributes.tsx +4 -3
  768. package/src/components/entity/entity-details-with-buttons.tsx +4 -3
  769. package/src/components/history/history-details-screen.tsx +89 -0
  770. package/src/components/history/history-list-item-icon.tsx +108 -0
  771. package/src/components/history/history-list-item.tsx +53 -0
  772. package/src/components/history/history-list-screen.tsx +154 -0
  773. package/src/components/history/history-list-section-header.tsx +42 -0
  774. package/src/components/history/history-list.tsx +116 -0
  775. package/src/components/history/index.tsx +6 -0
  776. package/src/components/index.ts +1 -0
  777. package/src/ui-components/accessibility/accessibility.ts +2 -2
  778. package/src/ui-components/accessibility/accessibilityHistory.tsx +2 -2
  779. package/src/ui-components/accessibility/accessibilityHistoryWrappers.tsx +3 -5
  780. package/src/ui-components/accessibility/index.ts +4 -3
  781. package/src/ui-components/action-modal/ActionModal.stories.tsx +7 -3
  782. package/src/ui-components/activity-indicator/activity-indicator.stories.tsx +3 -6
  783. package/src/ui-components/buttons/back-button.stories.tsx +7 -8
  784. package/src/ui-components/buttons/button.stories.tsx +9 -10
  785. package/src/ui-components/buttons/connectivity-button.stories.tsx +10 -11
  786. package/src/ui-components/buttons/connectivity-button.tsx +1 -1
  787. package/src/ui-components/buttons/ghost-button.stories.tsx +8 -8
  788. package/src/ui-components/buttons/hold-button.stories.tsx +29 -0
  789. package/src/ui-components/buttons/hold-button.tsx +276 -0
  790. package/src/ui-components/buttons/index.ts +16 -6
  791. package/src/ui-components/buttons/scan-button.stories.tsx +8 -4
  792. package/src/ui-components/control/checkbox.stories.tsx +8 -8
  793. package/src/ui-components/control/switch.stories.tsx +11 -8
  794. package/src/ui-components/credential/card/credential-card.stories.tsx +22 -25
  795. package/src/ui-components/credential/card/credential-details-card.stories.tsx +249 -245
  796. package/src/ui-components/credential/card/credential-details-card.tsx +2 -2
  797. package/src/ui-components/credential/card/credential-details-list-item.tsx +16 -6
  798. package/src/ui-components/credential/card/credential-header.stories.tsx +15 -17
  799. package/src/ui-components/credential/card/credential-header.tsx +4 -1
  800. package/src/ui-components/credential/card/credential-image-carousel.tsx +4 -0
  801. package/src/ui-components/credential/card/index.ts +11 -5
  802. package/src/ui-components/credential/index.ts +2 -1
  803. package/src/ui-components/credential/selector.stories.tsx +7 -7
  804. package/src/ui-components/detail/detail.stories.tsx +11 -8
  805. package/src/ui-components/entity/avatar.stories.tsx +10 -7
  806. package/src/ui-components/entity/entity-cluster.stories.tsx +11 -8
  807. package/src/ui-components/header/header.stories.tsx +10 -7
  808. package/src/ui-components/header/index.ts +6 -3
  809. package/src/ui-components/header/navigation-header.stories.tsx +11 -8
  810. package/src/ui-components/history/data-item.tsx +13 -4
  811. package/src/ui-components/history/history-details.tsx +247 -0
  812. package/src/ui-components/history/{history-list-item.tsx → history-item.tsx} +72 -33
  813. package/src/ui-components/history/history-section-header.tsx +2 -2
  814. package/src/ui-components/history/history-section-list-item.tsx +3 -3
  815. package/src/ui-components/history/index.ts +5 -4
  816. package/src/ui-components/icons/history.tsx +82 -131
  817. package/src/ui-components/image/index.tsx +2 -1
  818. package/src/ui-components/input/radio-group.stories.tsx +34 -0
  819. package/src/ui-components/input/radio-group.tsx +8 -2
  820. package/src/ui-components/input/selection-input.stories.tsx +20 -17
  821. package/src/ui-components/list/index.ts +1 -0
  822. package/src/ui-components/list/list-page-loading-indicator.tsx +8 -0
  823. package/src/ui-components/list/wallet/empty-list.tsx +75 -0
  824. package/src/ui-components/list/wallet/empty-search-result.tsx +39 -0
  825. package/src/ui-components/list/wallet/index.tsx +4 -0
  826. package/src/ui-components/loader/loader.stories.tsx +6 -9
  827. package/src/ui-components/loader/loader.tsx +6 -3
  828. package/src/ui-components/loader/loading-result.stories.tsx +13 -10
  829. package/src/ui-components/loader/loading-result.tsx +8 -4
  830. package/src/ui-components/nerd-view/index.ts +2 -1
  831. package/src/ui-components/nerd-view/nerd-mode-item.tsx +2 -2
  832. package/src/ui-components/pin/pin-code-screen.stories.tsx +20 -13
  833. package/src/ui-components/screens/image-preview-screen.stories.tsx +9 -6
  834. package/src/ui-components/screens/index.ts +12 -6
  835. package/src/ui-components/screens/nerd-mode-screen.tsx +1 -1
  836. package/src/ui-components/screens/qr-code-scanner-screen.stories.tsx +10 -7
  837. package/src/ui-components/searchbar/search-bar.stories.tsx +15 -8
  838. package/src/ui-components/searchbar/search-bar.tsx +2 -2
  839. package/src/ui-components/state/error-screen.stories.tsx +8 -9
  840. package/src/ui-components/state/error-screen.tsx +1 -1
  841. package/src/ui-components/text/index.ts +2 -1
  842. package/src/ui-components/text/typography.stories.tsx +19 -12
  843. package/src/ui-components/theme/color-scheme-context.tsx +1 -0
  844. package/src/ui-components/theme/color-scheme.ts +1 -0
  845. package/src/utils/date.ts +5 -5
  846. package/src/utils/filtering.ts +5 -0
  847. package/src/utils/history.ts +71 -0
  848. package/src/utils/hooks/connectivity/connectivity.test.ts +8 -0
  849. package/src/utils/hooks/connectivity/connectivity.ts +28 -4
  850. package/src/utils/hooks/core/backup.ts +25 -21
  851. package/src/utils/hooks/core/cache.ts +43 -0
  852. package/src/utils/hooks/core/core-config.ts +19 -0
  853. package/src/utils/hooks/core/core-context.tsx +15 -2
  854. package/src/utils/hooks/core/core-init.ts +21 -7
  855. package/src/utils/hooks/core/credential-schemas.ts +1 -1
  856. package/src/utils/hooks/core/credentials.ts +9 -14
  857. package/src/utils/hooks/core/history.ts +2 -57
  858. package/src/utils/hooks/core/index.ts +1 -0
  859. package/src/utils/hooks/core/proof-schemas.ts +1 -1
  860. package/src/utils/hooks/core/proofs.ts +107 -49
  861. package/src/utils/hooks/core/trust-entity.ts +7 -3
  862. package/src/utils/hooks/navigation/open-settings.ts +2 -3
  863. package/src/utils/hooks/revocation/credential-status.ts +3 -2
  864. package/src/utils/index.ts +3 -0
  865. package/src/utils/navigation.ts +4 -2
  866. package/src/utils/parsers/credential.ts +1 -1
  867. package/src/utils/parsers/index.ts +1 -0
  868. package/src/utils/parsers/query.tsx +2 -0
  869. package/src/utils/parsers/universal-links.test.ts +57 -0
  870. package/src/utils/parsers/universal-links.ts +26 -0
  871. package/src/utils/ref.ts +1 -1
  872. package/src/utils/reporting.ts +1 -0
  873. package/lib/commonjs/ui-components/history/history-list-item.js.map +0 -1
  874. package/lib/module/ui-components/history/history-list-item.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","format","MINUTE","DAY","systemLocale","_NativeModules$I18nMa","I18nManager","_NativeModules$I18nMa2","localeIdentifier","replace","split","formatDate","date","locale","options","toLocaleDateString","undefined","formatTime","toLocaleTimeString","hour","minute","formatDateTime","toLocaleString","year","month","day","hour12","formatMonth","getFullYear","formatTimeAgo","formatTimestamp","nowLabel","_formatDateTime2","now","Date","timestamp","getTime","_formatDateTime","pad","x","String","convertDateToUTCTimestamp","parse","getMonth","getDate","convertDateStrToLocalDate","select","android","timezoneOffset","getTimezoneOffset","default","formatDateOnlyFromUTCTimestamp","utcTimestamp","_formatDate","utcDate","getUTCFullYear","getUTCMonth","getUTCDate","OS","SettingsManager","settings","AppleLocale","formatDateTimeLocalized","formatDateLocalized"],"sources":["date.ts"],"sourcesContent":["// Date & Time formatted as specified in SW-610\n\nimport { NativeModules, Platform } from 'react-native';\nimport { format } from 'timeago.js';\n\nconst MINUTE = 60 * 1000;\nconst DAY = 24 * 60 * MINUTE;\n\n// OS locale\nconst systemLocale: string = NativeModules.I18nManager?.localeIdentifier\n ?.replace(/_/g, '-')\n .split('#')[0]\n .replace(/-$/, '');\n\n/**\n * Date only format\n */\nexport const formatDate = (date: Date, locale?: string, options?: Intl.DateTimeFormatOptions) => {\n try {\n return date.toLocaleDateString(locale || systemLocale, options);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Time only format\n */\nexport const formatTime = (date: Date, locale?: string) => {\n try {\n return date.toLocaleTimeString(locale || systemLocale, { hour: '2-digit', minute: '2-digit' });\n } catch {\n return undefined;\n }\n};\n\n/**\n * Date and time format\n */\nexport const formatDateTime = (date: Date, locale?: string) => {\n try {\n return date.toLocaleString(locale || systemLocale, {\n hour: '2-digit',\n minute: '2-digit',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour12: locale === 'en-US',\n });\n } catch {\n return undefined;\n }\n};\n\n/**\n * Month format\n */\nexport const formatMonth = (date: Date, locale: string): string => {\n return `${date.toLocaleString(locale, {\n month: 'long',\n })} ${date.getFullYear()}`;\n};\n\n/**\n * Time-ago format\n */\nexport const formatTimeAgo = (date: Date, locale: string): string => {\n return format(date, locale);\n};\n\n/**\n * Timestamp formatted for general use\n */\nexport const formatTimestamp = (date: Date, locale: string, nowLabel: string): string => {\n const now = Date.now();\n const timestamp = date.getTime();\n if (now < timestamp) {\n // in the future\n return formatDateTime(date, locale) ?? '';\n }\n\n // in the past\n if (now - timestamp < MINUTE) {\n // less than a minute ago\n return nowLabel;\n }\n\n // less than a day ago\n if (now - timestamp < DAY) {\n return formatTimeAgo(date, locale);\n }\n\n // longer ago\n return formatDateTime(date, locale) ?? '';\n};\n\nconst pad = (x: number) => (x >= 0 && x < 10 ? `0${x}` : String(x));\n\n/**\n * Utility function to deal with `date`-type attributes\n * @param {Date} date local timezone representation\n * @returns {number} the same day, but UTC timezone with midnight time\n */\nexport const convertDateToUTCTimestamp = (date: Date): number =>\n Date.parse(`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`);\n\n/**\n * Utility function to deal with `date`-type attributes\n * @param {string} date in YYYY-MM-DD representation\n * @returns {Date} the same day, but local timezone with midnight time\n */\nexport const convertDateStrToLocalDate = (date: string): Date =>\n Platform.select({\n // android conversion using the standard date parsing doesn't work, computing the timestamp manually\n android: (() => {\n const timestamp = Date.parse(date);\n const timezoneOffset = new Date(date).getTimezoneOffset();\n return new Date(timestamp + timezoneOffset * MINUTE);\n })(),\n default: new Date(`${date}T00:00:00`),\n });\n\n/**\n * Inverted function to {@link convertDateToUTCTimestamp}\n * @param {number} utcTimestamp date timestamp represented as midnight UTC time\n * @returns {string} formatted date (based on locale settings, e.g. `21/02/2021`)\n */\nexport const formatDateOnlyFromUTCTimestamp = (utcTimestamp: number): string => {\n const utcDate = new Date(utcTimestamp);\n return (\n formatDate(\n convertDateStrToLocalDate(\n `${utcDate.getUTCFullYear()}-${pad(utcDate.getUTCMonth() + 1)}-${pad(utcDate.getUTCDate())}`,\n ),\n ) ?? ''\n );\n};\n\nconst locale = (\n Platform.OS === 'ios'\n ? NativeModules.SettingsManager.settings.AppleLocale\n : NativeModules.I18nManager.localeIdentifier\n)\n .split('@')[0]\n .replace('_', '-');\n\nexport const formatDateTimeLocalized = (date: Date) => {\n return formatDateTime(date, locale);\n};\n\nexport const formatDateLocalized = (date: Date) => {\n return formatDate(date, locale);\n};\n"],"mappings":";AAAA;;AAEA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,MAAM,QAAQ,YAAY;AAEnC,MAAMC,MAAM,GAAG,EAAE,GAAG,IAAI;AACxB,MAAMC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAGD,MAAM;;AAE5B;AACA,MAAME,YAAoB,IAAAC,qBAAA,GAAGN,aAAa,CAACO,WAAW,cAAAD,qBAAA,wBAAAE,sBAAA,GAAzBF,qBAAA,CAA2BG,gBAAgB,cAAAD,sBAAA,uBAA3CA,sBAAA,CACzBE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CACnBC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACbD,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;;AAEpB;AACA;AACA;AACA,OAAO,MAAME,UAAU,GAAGA,CAACC,IAA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,CAAC"}
1
+ {"version":3,"names":["I18nManager","Platform","Settings","format","MINUTE","DAY","systemLocale","_I18nManager$getConst","getConstants","localeIdentifier","replace","split","formatDate","date","locale","options","toLocaleDateString","undefined","formatTime","toLocaleTimeString","hour","minute","formatDateTime","toLocaleString","year","month","day","hour12","formatMonth","getFullYear","formatTimeAgo","formatTimestamp","nowLabel","_formatDateTime2","now","Date","timestamp","getTime","_formatDateTime","pad","x","String","convertDateToUTCTimestamp","parse","getMonth","getDate","convertDateStrToLocalDate","select","android","timezoneOffset","getTimezoneOffset","default","formatDateOnlyFromUTCTimestamp","utcTimestamp","_formatDate","utcDate","getUTCFullYear","getUTCMonth","getUTCDate","_ref","OS","get","formatDateTimeLocalized","formatDateLocalized"],"sources":["date.ts"],"sourcesContent":["// Date & Time formatted as specified in SW-610\n\nimport { I18nManager, Platform, Settings } from 'react-native';\nimport { format } from 'timeago.js';\n\nconst MINUTE = 60 * 1000;\nconst DAY = 24 * 60 * MINUTE;\n\n// OS locale\nconst systemLocale: string | undefined = I18nManager.getConstants().localeIdentifier\n ?.replace(/_/g, '-')\n .split('#')[0]\n .replace(/-$/, '');\n\n/**\n * Date only format\n */\nexport const formatDate = (date: Date, locale?: string, options?: Intl.DateTimeFormatOptions) => {\n try {\n return date.toLocaleDateString(locale || systemLocale, options);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Time only format\n */\nexport const formatTime = (date: Date, locale?: string) => {\n try {\n return date.toLocaleTimeString(locale || systemLocale, { hour: '2-digit', minute: '2-digit' });\n } catch {\n return undefined;\n }\n};\n\n/**\n * Date and time format\n */\nexport const formatDateTime = (date: Date, locale?: string) => {\n try {\n return date.toLocaleString(locale || systemLocale, {\n hour: '2-digit',\n minute: '2-digit',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour12: locale === 'en-US',\n });\n } catch {\n return undefined;\n }\n};\n\n/**\n * Month format\n */\nexport const formatMonth = (date: Date, locale: string): string => {\n return `${date.toLocaleString(locale, {\n month: 'long',\n })} ${date.getFullYear()}`;\n};\n\n/**\n * Time-ago format\n */\nexport const formatTimeAgo = (date: Date, locale: string): string => {\n return format(date, locale);\n};\n\n/**\n * Timestamp formatted for general use\n */\nexport const formatTimestamp = (date: Date, locale: string, nowLabel: string): string => {\n const now = Date.now();\n const timestamp = date.getTime();\n if (now < timestamp) {\n // in the future\n return formatDateTime(date, locale) ?? '';\n }\n\n // in the past\n if (now - timestamp < MINUTE) {\n // less than a minute ago\n return nowLabel;\n }\n\n // less than a day ago\n if (now - timestamp < DAY) {\n return formatTimeAgo(date, locale);\n }\n\n // longer ago\n return formatDateTime(date, locale) ?? '';\n};\n\nconst pad = (x: number) => (x >= 0 && x < 10 ? `0${x}` : String(x));\n\n/**\n * Utility function to deal with `date`-type attributes\n * @param {Date} date local timezone representation\n * @returns {number} the same day, but UTC timezone with midnight time\n */\nexport const convertDateToUTCTimestamp = (date: Date): number =>\n Date.parse(`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`);\n\n/**\n * Utility function to deal with `date`-type attributes\n * @param {string} date in YYYY-MM-DD representation\n * @returns {Date} the same day, but local timezone with midnight time\n */\nexport const convertDateStrToLocalDate = (date: string): Date =>\n Platform.select({\n // android conversion using the standard date parsing doesn't work, computing the timestamp manually\n android: (() => {\n const timestamp = Date.parse(date);\n const timezoneOffset = new Date(date).getTimezoneOffset();\n return new Date(timestamp + timezoneOffset * MINUTE);\n })(),\n default: new Date(`${date}T00:00:00`),\n });\n\n/**\n * Inverted function to {@link convertDateToUTCTimestamp}\n * @param {number} utcTimestamp date timestamp represented as midnight UTC time\n * @returns {string} formatted date (based on locale settings, e.g. `21/02/2021`)\n */\nexport const formatDateOnlyFromUTCTimestamp = (utcTimestamp: number): string => {\n const utcDate = new Date(utcTimestamp);\n return (\n formatDate(\n convertDateStrToLocalDate(\n `${utcDate.getUTCFullYear()}-${pad(utcDate.getUTCMonth() + 1)}-${pad(utcDate.getUTCDate())}`,\n ),\n ) ?? ''\n );\n};\n\nconst locale = (\n Platform.OS === 'ios'\n ? Settings.get('AppleLocale')\n : I18nManager.getConstants().localeIdentifier\n)\n ?.split('@')[0]\n .replace('_', '-');\n\nexport const formatDateTimeLocalized = (date: Date) => {\n return formatDateTime(date, locale);\n};\n\nexport const formatDateLocalized = (date: Date) => {\n return formatDate(date, locale);\n};\n"],"mappings":";AAAA;;AAEA,SAASA,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAC9D,SAASC,MAAM,QAAQ,YAAY;AAEnC,MAAMC,MAAM,GAAG,EAAE,GAAG,IAAI;AACxB,MAAMC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAGD,MAAM;;AAE5B;AACA,MAAME,YAAgC,IAAAC,qBAAA,GAAGP,WAAW,CAACQ,YAAY,CAAC,CAAC,CAACC,gBAAgB,cAAAF,qBAAA,uBAA3CA,qBAAA,CACrCG,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CACnBC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACbD,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;;AAEpB;AACA;AACA;AACA,OAAO,MAAME,UAAU,GAAGA,CAACC,IAAU,EAAEC,MAAe,EAAEC,OAAoC,KAAK;EAC/F,IAAI;IACF,OAAOF,IAAI,CAACG,kBAAkB,CAACF,MAAM,IAAIR,YAAY,EAAES,OAAO,CAAC;EACjE,CAAC,CAAC,MAAM;IACN,OAAOE,SAAS;EAClB;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGA,CAACL,IAAU,EAAEC,MAAe,KAAK;EACzD,IAAI;IACF,OAAOD,IAAI,CAACM,kBAAkB,CAACL,MAAM,IAAIR,YAAY,EAAE;MAAEc,IAAI,EAAE,SAAS;MAAEC,MAAM,EAAE;IAAU,CAAC,CAAC;EAChG,CAAC,CAAC,MAAM;IACN,OAAOJ,SAAS;EAClB;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAA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AMC,OAAO,GAAG,IAAIpB,IAAI,CAACkB,YAAY,CAAC;EACtC,QAAAC,WAAA,GACE1C,UAAU,CACRkC,yBAAyB,CACvB,GAAGS,OAAO,CAACC,cAAc,CAAC,CAAC,IAAIjB,GAAG,CAACgB,OAAO,CAACE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAIlB,GAAG,CAACgB,OAAO,CAACG,UAAU,CAAC,CAAC,CAAC,EAC5F,CACF,CAAC,cAAAJ,WAAA,cAAAA,WAAA,GAAI,EAAE;AAEX,CAAC;AAED,MAAMxC,MAAM,IAAA6C,IAAA,GACV1D,QAAQ,CAAC2D,EAAE,KAAK,KAAK,GACjB1D,QAAQ,CAAC2D,GAAG,CAAC,aAAa,CAAC,GAC3B7D,WAAW,CAACQ,YAAY,CAAC,CAAC,CAACC,gBAAgB,cAAAkD,IAAA,uBAHlCA,IAAA,CAKXhD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACdD,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;AAEpB,OAAO,MAAMoD,uBAAuB,GAAIjD,IAAU,IAAK;EACrD,OAAOS,cAAc,CAACT,IAAI,EAAEC,MAAM,CAAC;AACrC,CAAC;AAED,OAAO,MAAMiD,mBAAmB,GAAIlD,IAAU,IAAK;EACjD,OAAOD,UAAU,CAACC,IAAI,EAAEC,MAAM,CAAC;AACjC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export const nonEmptyFilter = value => {
2
+ return value !== null && value !== undefined;
3
+ };
4
+ //# sourceMappingURL=filtering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["nonEmptyFilter","value","undefined"],"sources":["filtering.ts"],"sourcesContent":["export const nonEmptyFilter = <TValue>(\n value: TValue | null | undefined,\n): value is TValue => {\n return value !== null && value !== undefined;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GACzBC,KAAgC,IACZ;EACpB,OAAOA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKC,SAAS;AAC9C,CAAC","ignoreList":[]}
@@ -0,0 +1,66 @@
1
+ import { DataTypeEnum } from '@procivis/react-native-one-core';
2
+ import moment from 'moment';
3
+ import { nonEmptyFilter } from './filtering';
4
+ export const groupEntriesByDay = entries => {
5
+ const groupedEntries = entries.reduce((result, entry) => {
6
+ const entryDate = moment(entry.createdDate);
7
+ const matchingEntry = result.find(({
8
+ date
9
+ }) => date.isSame(entryDate, 'day'));
10
+ if (matchingEntry) {
11
+ matchingEntry.data.push(entry);
12
+ } else {
13
+ result.push({
14
+ data: [entry],
15
+ date: entryDate,
16
+ firstYearEntry: false
17
+ });
18
+ }
19
+ return result;
20
+ }, []);
21
+ return groupedEntries.sort(({
22
+ date: a
23
+ }, {
24
+ date: b
25
+ }) => b.valueOf() - a.valueOf()).map((item, index, list) => {
26
+ item.firstYearEntry = !index || !list[index - 1].date.isSame(item.date, 'year');
27
+ return item;
28
+ });
29
+ };
30
+ export const claimValueFromProofInputClaim = ({
31
+ schema,
32
+ value
33
+ }) => {
34
+ if (!value) {
35
+ return undefined;
36
+ }
37
+ if (Array.isArray(value)) {
38
+ const values = value.map(claimFromProofInputClaim).filter(nonEmptyFilter);
39
+ return schema.dataType === DataTypeEnum.Object ? {
40
+ array: schema.array,
41
+ dataType: DataTypeEnum.Object,
42
+ value: values
43
+ } : {
44
+ array: true,
45
+ dataType: schema.dataType,
46
+ value: values
47
+ };
48
+ }
49
+ return {
50
+ array: false,
51
+ dataType: schema.dataType,
52
+ value
53
+ };
54
+ };
55
+ export const claimFromProofInputClaim = input => {
56
+ const value = claimValueFromProofInputClaim(input);
57
+ if (!value) {
58
+ return undefined;
59
+ }
60
+ return {
61
+ ...value,
62
+ id: input.schema.id,
63
+ key: input.schema.key
64
+ };
65
+ };
66
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DataTypeEnum","moment","nonEmptyFilter","groupEntriesByDay","entries","groupedEntries","reduce","result","entry","entryDate","createdDate","matchingEntry","find","date","isSame","data","push","firstYearEntry","sort","a","b","valueOf","map","item","index","list","claimValueFromProofInputClaim","schema","value","undefined","Array","isArray","values","claimFromProofInputClaim","filter","dataType","Object","array","input","id","key"],"sources":["history.ts"],"sourcesContent":["import { Claim, ClaimValue, DataTypeEnum, HistoryListItem, ProofInputClaim } from '@procivis/react-native-one-core';\nimport moment, { Moment } from 'moment';\n\nimport { nonEmptyFilter } from './filtering';\n\nexport interface HistoryGroupByDaySection {\n data: HistoryListItem[];\n date: Moment;\n firstYearEntry: boolean;\n}\n\nexport const groupEntriesByDay = (entries: HistoryListItem[]) => {\n const groupedEntries = entries.reduce((result: HistoryGroupByDaySection[], entry: HistoryListItem) => {\n const entryDate = moment(entry.createdDate);\n\n const matchingEntry = result.find(({ date }) => date.isSame(entryDate, 'day'));\n if (matchingEntry) {\n matchingEntry.data.push(entry);\n } else {\n result.push({ data: [entry], date: entryDate, firstYearEntry: false });\n }\n\n return result;\n }, []);\n\n return groupedEntries\n .sort(({ date: a }, { date: b }) => b.valueOf() - a.valueOf())\n .map((item, index, list) => {\n item.firstYearEntry = !index || !list[index - 1].date.isSame(item.date, 'year');\n return item;\n });\n};\n\nexport const claimValueFromProofInputClaim = ({ schema, value }: ProofInputClaim): ClaimValue | undefined => {\n if (!value) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n const values = value.map(claimFromProofInputClaim).filter(nonEmptyFilter);\n return schema.dataType === (DataTypeEnum.Object as string)\n ? {\n array: schema.array,\n dataType: DataTypeEnum.Object,\n value: values,\n }\n : {\n array: true,\n dataType: schema.dataType,\n value: values,\n };\n }\n\n return {\n array: false,\n dataType: schema.dataType,\n value,\n };\n};\n\nexport const claimFromProofInputClaim = (input: ProofInputClaim): Claim | undefined => {\n const value = claimValueFromProofInputClaim(input);\n if (!value) {\n return undefined;\n }\n return {\n ...value,\n id: input.schema.id,\n key: input.schema.key,\n };\n};"],"mappings":"AAAA,SAA4BA,YAAY,QAA0C,iCAAiC;AACnH,OAAO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3G,IAAI,CAACA,KAAK,EAAE;IACV,OAAOC,SAAS;EAClB;EAEA,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACxB,MAAMI,MAAM,GAAGJ,KAAK,CAACN,GAAG,CAACW,wBAAwB,CAAC,CAACC,MAAM,CAAChC,cAAc,CAAC;IACzE,OAAOyB,MAAM,CAACQ,QAAQ,KAAMnC,YAAY,CAACoC,MAAiB,GACtD;MACEC,KAAK,EAAEV,MAAM,CAACU,KAAK;MACnBF,QAAQ,EAAEnC,YAAY,CAACoC,MAAM;MAC7BR,KAAK,EAAEI;IACT,CAAC,GACD;MACEK,KAAK,EAAE,IAAI;MACXF,QAAQ,EAAER,MAAM,CAACQ,QAAQ;MACzBP,KAAK,EAAEI;IACT,CAAC;EACP;EAEA,OAAO;IACLK,KAAK,EAAE,KAAK;IACZF,QAAQ,EAAER,MAAM,CAACQ,QAAQ;IACzBP;EACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMK,wBAAwB,GAAIK,KAAsB,IAAwB;EACrF,MAAMV,KAAK,GAAGF,6BAA6B,CAACY,KAAK,CAAC;EAClD,IAAI,CAACV,KAAK,EAAE;IACV,OAAOC,SAAS;EAClB;EACA,OAAO;IACL,GAAGD,KAAK;IACRW,EAAE,EAAED,KAAK,CAACX,MAAM,CAACY,EAAE;IACnBC,GAAG,EAAEF,KAAK,CAACX,MAAM,CAACa;EACpB,CAAC;AACH,CAAC","ignoreList":[]}
@@ -2,29 +2,43 @@ import { addEventListener as onNetworkStateChange, NetInfoStateType } from '@rea
2
2
  import parseUrl from 'parse-url';
3
3
  import { useEffect, useMemo, useState } from 'react';
4
4
  import BTStateManager from 'react-native-bluetooth-state-manager';
5
- export let InternetState;
6
- (function (InternetState) {
5
+ import { getEnabledTransports, useCoreConfig } from '../core/core-config';
6
+ export let InternetState = /*#__PURE__*/function (InternetState) {
7
7
  InternetState[InternetState["Available"] = 0] = "Available";
8
8
  InternetState[InternetState["Unreachable"] = 1] = "Unreachable";
9
9
  InternetState[InternetState["Disabled"] = 2] = "Disabled";
10
- })(InternetState || (InternetState = {}));
11
- export let BluetoothState;
12
- (function (BluetoothState) {
10
+ return InternetState;
11
+ }({});
12
+ export let BluetoothState = /*#__PURE__*/function (BluetoothState) {
13
13
  BluetoothState[BluetoothState["Available"] = 0] = "Available";
14
14
  BluetoothState[BluetoothState["Unauthorized"] = 1] = "Unauthorized";
15
15
  BluetoothState[BluetoothState["Disabled"] = 2] = "Disabled";
16
16
  BluetoothState[BluetoothState["Unavailable"] = 3] = "Unavailable";
17
- })(BluetoothState || (BluetoothState = {}));
18
- export let Transport;
19
- (function (Transport) {
17
+ return BluetoothState;
18
+ }({});
19
+ export let Transport = /*#__PURE__*/function (Transport) {
20
20
  Transport["Bluetooth"] = "BLE";
21
21
  Transport["HTTP"] = "HTTP";
22
22
  Transport["MQTT"] = "MQTT";
23
- })(Transport || (Transport = {}));
24
- export const useAvailableTransports = supportedTransports => {
23
+ return Transport;
24
+ }({});
25
+ export const useAvailableTransports = possibleTransports => {
25
26
  const [internetState, setInternetState] = useState();
26
27
  const [bluetoothState, setBluetoothState] = useState();
28
+ const {
29
+ data: coreConfig
30
+ } = useCoreConfig();
31
+ const supportedTransports = useMemo(() => {
32
+ if (!coreConfig) {
33
+ return;
34
+ }
35
+ const enabledTransports = getEnabledTransports(coreConfig);
36
+ return possibleTransports.filter(t => enabledTransports.includes(t));
37
+ }, [possibleTransports, coreConfig]);
27
38
  useEffect(() => {
39
+ if (!supportedTransports) {
40
+ return;
41
+ }
28
42
  let btSubscription;
29
43
  if (supportedTransports.includes(Transport.Bluetooth)) {
30
44
  btSubscription = BTStateManager.onStateChange(state => {
@@ -62,11 +76,17 @@ export const useAvailableTransports = supportedTransports => {
62
76
  }
63
77
  return () => {
64
78
  var _btSubscription, _netSubscription;
65
- (_btSubscription = btSubscription) === null || _btSubscription === void 0 ? void 0 : _btSubscription.remove();
66
- (_netSubscription = netSubscription) === null || _netSubscription === void 0 ? void 0 : _netSubscription();
79
+ (_btSubscription = btSubscription) === null || _btSubscription === void 0 || _btSubscription.remove();
80
+ (_netSubscription = netSubscription) === null || _netSubscription === void 0 || _netSubscription();
67
81
  };
68
82
  }, [supportedTransports]);
69
83
  const transportStatus = useMemo(() => {
84
+ if (!supportedTransports) {
85
+ return {
86
+ availableTransport: undefined,
87
+ transportError: {}
88
+ };
89
+ }
70
90
  const waitingForInternetState = (supportedTransports.includes(Transport.HTTP) || supportedTransports.includes(Transport.MQTT)) && internetState === undefined;
71
91
  const waitingForBluetoothState = supportedTransports.includes(Transport.Bluetooth) && bluetoothState === undefined;
72
92
  if (waitingForInternetState || waitingForBluetoothState) {
@@ -78,8 +98,8 @@ export const useAvailableTransports = supportedTransports => {
78
98
  const availableTransport = [];
79
99
  const transportError = {};
80
100
  if (internetState === InternetState.Available) {
81
- availableTransport.push(Transport.MQTT);
82
- availableTransport.push(Transport.HTTP);
101
+ supportedTransports.includes(Transport.MQTT) && availableTransport.push(Transport.MQTT);
102
+ supportedTransports.includes(Transport.HTTP) && availableTransport.push(Transport.HTTP);
83
103
  } else {
84
104
  transportError.internet = internetState;
85
105
  }
@@ -110,10 +130,7 @@ export const getInvitationUrlTransports = (url, customOpenIdUrlScheme) => {
110
130
  return [Transport.HTTP];
111
131
  }
112
132
  const query = parsedUrl.query;
113
- const hasAllParameters = function () {
114
- for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
115
- params[_key] = arguments[_key];
116
- }
133
+ const hasAllParameters = (...params) => {
117
134
  return params.every(param => param in query);
118
135
  };
119
136
  const transports = [];
@@ -122,7 +139,7 @@ export const getInvitationUrlTransports = (url, customOpenIdUrlScheme) => {
122
139
  if (hasAllParameters('name', 'key')) {
123
140
  transports.push(Transport.Bluetooth);
124
141
  }
125
- if (hasAllParameters('key', 'brokerUrl', 'topicId')) {
142
+ if (hasAllParameters('brokerUrl', 'topicId')) {
126
143
  transports.push(Transport.MQTT);
127
144
  }
128
145
  return transports;
@@ -1 +1 @@
1
- {"version":3,"names":["addEventListener","onNetworkStateChange","NetInfoStateType","parseUrl","useEffect","useMemo","useState","BTStateManager","InternetState","BluetoothState","Transport","useAvailableTransports","supportedTransports","internetState","setInternetState","bluetoothState","setBluetoothState","btSubscription","includes","Bluetooth","onStateChange","state","Available","Disabled","Unauthorized","Unavailable","netSubscription","HTTP","MQTT","type","none","isInternetReachable","Unreachable","_btSubscription","_netSubscription","remove","transportStatus","waitingForInternetState","undefined","waitingForBluetoothState","availableTransport","transportError","push","internet","ble","getInvitationUrlTransports","url","customOpenIdUrlScheme","parsedUrl","e","parse_failed","protocol","toLowerCase","query","hasAllParameters","_len","arguments","length","params","Array","_key","every","param","transports","host"],"sources":["connectivity.ts"],"sourcesContent":["import {\n addEventListener as onNetworkStateChange,\n NetInfoStateType,\n NetInfoSubscription,\n} from '@react-native-community/netinfo';\nimport parseUrl from 'parse-url';\nimport { useEffect, useMemo, useState } from 'react';\nimport { EventSubscription } from 'react-native';\nimport BTStateManager from 'react-native-bluetooth-state-manager';\n\nexport enum InternetState {\n Available,\n Unreachable,\n Disabled,\n}\n\nexport type InternetError = Exclude<InternetState, InternetState.Available>;\n\nexport enum BluetoothState {\n Available,\n Unauthorized,\n Disabled,\n Unavailable,\n}\n\nexport type BluetoothError = Exclude<BluetoothState, BluetoothState.Available>;\n\nexport enum Transport {\n Bluetooth = 'BLE',\n HTTP = 'HTTP',\n MQTT = 'MQTT',\n}\n\nexport type TransportError = {\n ble?: BluetoothError;\n internet?: InternetError;\n};\n\nexport const useAvailableTransports = (\n supportedTransports: Transport[],\n): {\n availableTransport: Transport[] | undefined;\n transportError: TransportError;\n} => {\n const [internetState, setInternetState] = useState<InternetState>();\n const [bluetoothState, setBluetoothState] = useState<BluetoothState>();\n\n useEffect(() => {\n let btSubscription: EventSubscription | undefined;\n if (supportedTransports.includes(Transport.Bluetooth)) {\n btSubscription = BTStateManager.onStateChange((state) => {\n switch (state) {\n case 'PoweredOn':\n setBluetoothState(BluetoothState.Available);\n break;\n case 'PoweredOff':\n setBluetoothState(BluetoothState.Disabled);\n break;\n case 'Unauthorized':\n setBluetoothState(BluetoothState.Unauthorized);\n break;\n default:\n setBluetoothState(BluetoothState.Unavailable);\n }\n }, true);\n }\n let netSubscription: NetInfoSubscription | undefined;\n if (supportedTransports.includes(Transport.HTTP) || supportedTransports.includes(Transport.MQTT)) {\n netSubscription = onNetworkStateChange((state) => {\n if (state.type === NetInfoStateType.none) {\n setInternetState(InternetState.Disabled);\n return;\n }\n if (state.isInternetReachable === null) {\n return;\n }\n if (state.isInternetReachable) {\n setInternetState(InternetState.Available);\n } else {\n setInternetState(InternetState.Unreachable);\n }\n });\n }\n return () => {\n btSubscription?.remove();\n netSubscription?.();\n };\n }, [supportedTransports]);\n\n const transportStatus = useMemo(() => {\n const waitingForInternetState =\n (supportedTransports.includes(Transport.HTTP) || supportedTransports.includes(Transport.MQTT)) &&\n internetState === undefined;\n const waitingForBluetoothState = supportedTransports.includes(Transport.Bluetooth) && bluetoothState === undefined;\n if (waitingForInternetState || waitingForBluetoothState) {\n return {\n availableTransport: undefined,\n transportError: {},\n };\n }\n const availableTransport: Transport[] = [];\n const transportError: TransportError = {};\n if (internetState === InternetState.Available) {\n availableTransport.push(Transport.MQTT);\n availableTransport.push(Transport.HTTP);\n } else {\n transportError.internet = internetState;\n }\n if (bluetoothState === BluetoothState.Available) {\n availableTransport.push(Transport.Bluetooth);\n } else {\n transportError.ble = bluetoothState;\n }\n return { availableTransport, transportError };\n }, [bluetoothState, internetState, supportedTransports]);\n\n return transportStatus;\n};\n\nexport const getInvitationUrlTransports = (url: string, customOpenIdUrlScheme?: string): Transport[] => {\n let parsedUrl: parseUrl.ParsedUrl;\n try {\n parsedUrl = parseUrl(url);\n } catch (e) {\n return [];\n }\n\n if (parsedUrl.parse_failed) {\n return [];\n }\n const protocol = parsedUrl.protocol as string;\n if (protocol !== 'openid4vp' && protocol !== customOpenIdUrlScheme?.toLowerCase()) {\n return [Transport.HTTP];\n }\n\n const query = parsedUrl.query as Record<string, string>;\n const hasAllParameters = (...params: string[]): boolean => {\n return params.every((param) => param in query);\n };\n\n const transports: Transport[] = [];\n // BLE/MQTT\n if (parsedUrl.host === 'connect') {\n if (hasAllParameters('name', 'key')) {\n transports.push(Transport.Bluetooth);\n }\n if (hasAllParameters('key', 'brokerUrl', 'topicId')) {\n transports.push(Transport.MQTT);\n }\n\n return transports;\n }\n // HTTP\n if (\n hasAllParameters('response_type', 'state', 'nonce', 'presentation_definition_uri') ||\n hasAllParameters('client_id', 'request_uri')\n ) {\n transports.push(Transport.HTTP);\n }\n\n return transports;\n};\n"],"mappings":"AAAA,SACEA,gBAAgB,IAAIC,oBAAoB,EACxCC,gBAAgB,QAEX,iCAAiC;AACxC,OAAOC,QAAQ,MAAM,WAAW;AAChC,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,OAAOC,cAAc,MAAM,sCAAsC;AAEjE,WAAYC,aAAa;AAIxB,WAJWA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;AAAA,GAAbA,aAAa,KAAbA,aAAa;AAQzB,WAAYC,cAAc;AAKzB,WALWA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;AAAA,GAAdA,cAAc,KAAdA,cAAc;AAS1B,WAAYC,SAAS;AAIpB,WAJWA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;AAAA,GAATA,SAAS,KAATA,SAAS;AAWrB,OAAO,MAAMC,sBAAsB,GACjCC,mBAAgC,IAI7B;EACH,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGR,QAAQ,EAAiB;EACnE,MAAM,CAACS,cAAc,EAAEC,iBAAiB,CAAC,GAAGV,QAAQ,EAAkB;EAEtEF,SAAS,CA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OAAO,EAAE,OAAO,EAAE,6BAA6B,CAAC,IAClFA,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,EAC5C;IACAS,UAAU,CAACrB,IAAI,CAAChC,SAAS,CAACiB,IAAI,CAAC;EACjC;EAEA,OAAOoC,UAAU;AACnB,CAAC"}
1
+ {"version":3,"names":["addEventListener","onNetworkStateChange","NetInfoStateType","parseUrl","useEffect","useMemo","useState","BTStateManager","getEnabledTransports","useCoreConfig","InternetState","BluetoothState","Transport","useAvailableTransports","possibleTransports","internetState","setInternetState","bluetoothState","setBluetoothState","data","coreConfig","supportedTransports","enabledTransports","filter","t","includes","btSubscription","Bluetooth","onStateChange","state","Available","Disabled","Unauthorized","Unavailable","netSubscription","HTTP","MQTT","type","none","isInternetReachable","Unreachable","_btSubscription","_netSubscription","remove","transportStatus","availableTransport","undefined","transportError","waitingForInternetState","waitingForBluetoothState","push","internet","ble","getInvitationUrlTransports","url","customOpenIdUrlScheme","parsedUrl","e","parse_failed","protocol","toLowerCase","query","hasAllParameters","params","every","param","transports","host"],"sources":["connectivity.ts"],"sourcesContent":["import {\n addEventListener as onNetworkStateChange,\n NetInfoStateType,\n NetInfoSubscription,\n} from '@react-native-community/netinfo';\nimport parseUrl from 'parse-url';\nimport { useEffect, useMemo, useState } from 'react';\nimport { EventSubscription } from 'react-native';\nimport BTStateManager from 'react-native-bluetooth-state-manager';\n\nimport { getEnabledTransports, useCoreConfig } from '../core/core-config';\n\nexport enum InternetState {\n Available,\n Unreachable,\n Disabled,\n}\n\nexport type InternetError = Exclude<InternetState, InternetState.Available>;\n\nexport enum BluetoothState {\n Available,\n Unauthorized,\n Disabled,\n Unavailable,\n}\n\nexport type BluetoothError = Exclude<BluetoothState, BluetoothState.Available>;\n\nexport enum Transport {\n Bluetooth = 'BLE',\n HTTP = 'HTTP',\n MQTT = 'MQTT',\n}\n\nexport type TransportError = {\n ble?: BluetoothError;\n internet?: InternetError;\n};\n\nexport const useAvailableTransports = (\n possibleTransports: Transport[],\n): {\n availableTransport: Transport[] | undefined;\n transportError: TransportError;\n} => {\n const [internetState, setInternetState] = useState<InternetState>();\n const [bluetoothState, setBluetoothState] = useState<BluetoothState>();\n\n const { data: coreConfig } = useCoreConfig();\n\n const supportedTransports = useMemo(() => {\n if (!coreConfig) {\n return;\n }\n const enabledTransports = getEnabledTransports(coreConfig);\n\n return possibleTransports.filter((t) => enabledTransports.includes(t));\n }, [possibleTransports, coreConfig]);\n\n useEffect(() => {\n if (!supportedTransports) {\n return;\n }\n\n let btSubscription: EventSubscription | undefined;\n if (supportedTransports.includes(Transport.Bluetooth)) {\n btSubscription = BTStateManager.onStateChange((state) => {\n switch (state) {\n case 'PoweredOn':\n setBluetoothState(BluetoothState.Available);\n break;\n case 'PoweredOff':\n setBluetoothState(BluetoothState.Disabled);\n break;\n case 'Unauthorized':\n setBluetoothState(BluetoothState.Unauthorized);\n break;\n default:\n setBluetoothState(BluetoothState.Unavailable);\n }\n }, true);\n }\n let netSubscription: NetInfoSubscription | undefined;\n if (supportedTransports.includes(Transport.HTTP) || supportedTransports.includes(Transport.MQTT)) {\n netSubscription = onNetworkStateChange((state) => {\n if (state.type === NetInfoStateType.none) {\n setInternetState(InternetState.Disabled);\n return;\n }\n if (state.isInternetReachable === null) {\n return;\n }\n if (state.isInternetReachable) {\n setInternetState(InternetState.Available);\n } else {\n setInternetState(InternetState.Unreachable);\n }\n });\n }\n return () => {\n btSubscription?.remove();\n netSubscription?.();\n };\n }, [supportedTransports]);\n\n const transportStatus = useMemo(() => {\n if (!supportedTransports) {\n return {\n availableTransport: undefined,\n transportError: {},\n };\n }\n\n const waitingForInternetState =\n (supportedTransports.includes(Transport.HTTP) || supportedTransports.includes(Transport.MQTT)) &&\n internetState === undefined;\n const waitingForBluetoothState = supportedTransports.includes(Transport.Bluetooth) && bluetoothState === undefined;\n if (waitingForInternetState || waitingForBluetoothState) {\n return {\n availableTransport: undefined,\n transportError: {},\n };\n }\n const availableTransport: Transport[] = [];\n const transportError: TransportError = {};\n if (internetState === InternetState.Available) {\n supportedTransports.includes(Transport.MQTT) && availableTransport.push(Transport.MQTT);\n supportedTransports.includes(Transport.HTTP) && availableTransport.push(Transport.HTTP);\n } else {\n transportError.internet = internetState;\n }\n if (bluetoothState === BluetoothState.Available) {\n availableTransport.push(Transport.Bluetooth);\n } else {\n transportError.ble = bluetoothState;\n }\n return { availableTransport, transportError };\n }, [bluetoothState, internetState, supportedTransports]);\n\n return transportStatus;\n};\n\nexport const getInvitationUrlTransports = (url: string, customOpenIdUrlScheme?: string): Transport[] => {\n let parsedUrl: parseUrl.ParsedUrl;\n try {\n parsedUrl = parseUrl(url);\n } catch (e) {\n return [];\n }\n\n if (parsedUrl.parse_failed) {\n return [];\n }\n const protocol = parsedUrl.protocol as string;\n if (protocol !== 'openid4vp' && protocol !== customOpenIdUrlScheme?.toLowerCase()) {\n return [Transport.HTTP];\n }\n\n const query = parsedUrl.query as Record<string, string>;\n const hasAllParameters = (...params: string[]): boolean => {\n return params.every((param) => param in query);\n };\n\n const transports: Transport[] = [];\n // BLE/MQTT\n if (parsedUrl.host === 'connect') {\n if (hasAllParameters('name', 'key')) {\n transports.push(Transport.Bluetooth);\n }\n if (hasAllParameters('brokerUrl', 'topicId')) {\n transports.push(Transport.MQTT);\n }\n\n return transports;\n }\n // HTTP\n if (\n hasAllParameters('response_type', 'state', 'nonce', 'presentation_definition_uri') ||\n hasAllParameters('client_id', 'request_uri')\n ) {\n transports.push(Transport.HTTP);\n }\n\n return transports;\n};\n"],"mappings":"AAAA,SACEA,gBAAgB,IAAIC,oBAAoB,EACxCC,gBAAgB,QAEX,iCAAiC;AACxC,OAAOC,QAAQ,MAAM,WAAW;AAChC,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,OAAOC,cAAc,MAAM,sCAAsC;AAEjE,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,qBAAqB;AAEzE,WAAYC,aAAa,0BAAbA,aAAa;EAAbA,aAAa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oreList":[]}
@@ -1,4 +1,10 @@
1
1
  import { getInvitationUrlTransports, Transport } from './connectivity';
2
+ jest.mock('@procivis/react-native-one-core', () => ({
3
+ initializeCore: () => Promise.resolve({})
4
+ }));
5
+ jest.mock('@sentry/react-native', () => ({
6
+ captureException: () => {}
7
+ }));
2
8
  jest.mock('@react-native-community/netinfo', () => ({
3
9
  addEventListener: () => {}
4
10
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["getInvitationUrlTransports","Transport","jest","mock","addEventListener","onStateChange","describe","test","transports","expect","toStrictEqual","Bluetooth","MQTT","HTTP"],"sources":["connectivity.test.ts"],"sourcesContent":["import { getInvitationUrlTransports, Transport } from './connectivity';\n\njest.mock('@react-native-community/netinfo', () => ({\n addEventListener: () => {},\n}));\n\njest.mock('react-native-bluetooth-state-manager', () => ({\n onStateChange: () => {},\n}));\n\ndescribe('getInvitationUrlTransports', () => {\n test('BLE OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth]);\n });\n test('MQTT OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.MQTT]);\n });\n test('Mixed BLE/MQTT OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth, Transport.MQTT]);\n });\n test('BLE OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth]);\n });\n test('MQTT OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.MQTT]);\n });\n test('Mixed BLE/MQTT OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth, Transport.MQTT]);\n });\n test('HTTP OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'openid4vp://?response_type=vp_token&state=25fdb134-487d-4bcd-9fdf-777e7f74f128&nonce=DZE2qP6FaDksHxkfOdYJC1LWgVyf5Ibc&client_id_scheme=redirect_uri&client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&response_mode=direct_post&response_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&client_metadata_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fclient-metadata&presentation_definition_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fpresentation-definition',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'mdoc-openid4vp://?response_type=vp_token&state=25fdb134-487d-4bcd-9fdf-777e7f74f128&nonce=DZE2qP6FaDksHxkfOdYJC1LWgVyf5Ibc&client_id_scheme=redirect_uri&client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&response_mode=direct_post&response_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&client_metadata_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fclient-metadata&presentation_definition_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fpresentation-definition',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID4VP url with requestUri', () => {\n const transports = getInvitationUrlTransports(\n 'openid4vp://?client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&request_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F6e442f9d-bc14-4362-8786-504d7b79c402%2Fclient-request',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID credential offer url', () => {\n const transports = getInvitationUrlTransports(\n 'openid-credential-offer://?credential_offer_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-issuer%2Fv1%2F0c2cd9a6-1eff-4536-9505-98d7bd87aad1%2Foffer%2F275c09b2-4f4f-4738-85fc-35399acad176',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n\n test('Invalid link', () => {\n const transports = getInvitationUrlTransports('invalid');\n expect(transports).toStrictEqual([]);\n });\n});\n"],"mappings":"AAAA,SAASA,0BAA0B,EAAEC,SAAS,QAAQ,gBAAgB;AAEtEC,IAAI,CAACC,IAAI,CAAC,iCAAiC,EAAE,OAAO;EAClDC,gBAAgB,EAAEA,CAAA,KAAM,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEHF,IAAI,CAACC,IAAI,CAAC,sCAAsC,EAAE,OAAO;EACvDE,aAAa,EAAEA,CAAA,KAAM,CAAC;AACxB,CAAC,CAAC,CAAC;AAEHC,QAAQ,CAAC,4BAA4B,EAAE,MAAM;EAC3CC,IAAI,CAAC,mBAAmB,EAAE,MAAM;IAC9B,MAAMC,UAAU,GAAGR,0BAA0B,CAC3C,wGAAwG,EACxG,gBAAgB,CACjB;IACDS,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACT,SAAS,CAACU,SAAS,CAAC,CAAC;EACzD,CAAC,CAAC;EACFJ,IAAI,CAAC,oBAAoB,EAAE,MAAM;IAC/B,MAAMC,UAAU,GAAGR,0BAA0B,CAC3C,6KAA6K,EAC7K,gBAAgB,CACjB;IACDS,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACT,SAAS,CAACW,IAAI,CAAC,CAAC;EACpD,CAAC,CAAC;EACFL,IAAI,CAAC,8BAA8B,EAAE,MAAM;IACzC,MAAMC,UAAU,GAAGR,0BAA0B,CAC3C,2LAA2L,EAC3L,gBAAgB,CACjB;IACDS,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACT,SAAS,CAACU,SAAS,EAAEV,SAAS,CAACW,IAAI,CAAC,CAAC;EACzE,CAAC,CAAC;EACFL,IAAI,CAAC,sCAAsC,EAAE,MAAM;IACjD,MAAMC,UAAU,GAAGR,0BAA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CAAC;EACFN,IAAI,CAAC,kCAAkC,EAAE,MAAM;IAC7C,MAAMC,UAAU,GAAGR,0BAA0B,CAC3C,wMAAwM,EACxM,gBAAgB,CACjB;IACDS,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACT,SAAS,CAACY,IAAI,CAAC,CAAC;EACpD,CAAC,CAAC;EAEFN,IAAI,CAAC,cAAc,EAAE,MAAM;IACzB,MAAMC,UAAU,GAAGR,0BAA0B,CAAC,SAAS,CAAC;IACxDS,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,EAAE,CAAC;EACtC,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["getInvitationUrlTransports","Transport","jest","mock","initializeCore","Promise","resolve","captureException","addEventListener","onStateChange","describe","test","transports","expect","toStrictEqual","Bluetooth","MQTT","HTTP"],"sources":["connectivity.test.ts"],"sourcesContent":["import { getInvitationUrlTransports, Transport } from './connectivity';\n\njest.mock('@procivis/react-native-one-core', () => ({\n initializeCore: () => Promise.resolve({} as any),\n}));\n\njest.mock('@sentry/react-native', () => ({\n captureException: () => {},\n}));\n\njest.mock('@react-native-community/netinfo', () => ({\n addEventListener: () => {},\n}));\n\njest.mock('react-native-bluetooth-state-manager', () => ({\n onStateChange: () => {},\n}));\n\ndescribe('getInvitationUrlTransports', () => {\n test('BLE OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth]);\n });\n test('MQTT OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.MQTT]);\n });\n test('Mixed BLE/MQTT OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth, Transport.MQTT]);\n });\n test('BLE OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth]);\n });\n test('MQTT OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.MQTT]);\n });\n test('Mixed BLE/MQTT OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth, Transport.MQTT]);\n });\n test('HTTP OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'openid4vp://?response_type=vp_token&state=25fdb134-487d-4bcd-9fdf-777e7f74f128&nonce=DZE2qP6FaDksHxkfOdYJC1LWgVyf5Ibc&client_id_scheme=redirect_uri&client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&response_mode=direct_post&response_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&client_metadata_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fclient-metadata&presentation_definition_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fpresentation-definition',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'mdoc-openid4vp://?response_type=vp_token&state=25fdb134-487d-4bcd-9fdf-777e7f74f128&nonce=DZE2qP6FaDksHxkfOdYJC1LWgVyf5Ibc&client_id_scheme=redirect_uri&client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&response_mode=direct_post&response_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&client_metadata_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fclient-metadata&presentation_definition_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fpresentation-definition',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID4VP url with requestUri', () => {\n const transports = getInvitationUrlTransports(\n 'openid4vp://?client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&request_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F6e442f9d-bc14-4362-8786-504d7b79c402%2Fclient-request',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID credential offer url', () => {\n const transports = getInvitationUrlTransports(\n 'openid-credential-offer://?credential_offer_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-issuer%2Fv1%2F0c2cd9a6-1eff-4536-9505-98d7bd87aad1%2Foffer%2F275c09b2-4f4f-4738-85fc-35399acad176',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n\n test('Invalid link', () => {\n const transports = getInvitationUrlTransports('invalid');\n expect(transports).toStrictEqual([]);\n });\n});\n"],"mappings":"AAAA,SAASA,0BAA0B,EAAEC,SAAS,QAAQ,gBAAgB;AAEtEC,IAAI,CAACC,IAAI,CAAC,iCAAiC,EAAE,OAAO;EAClDC,cAAc,EAAEA,CAAA,KAAMC,OAAO,CAACC,OAAO,CAAC,CAAC,CAAQ;AACjD,CAAC,CAAC,CAAC;AAEHJ,IAAI,CAACC,IAAI,CAAC,sBAAsB,EAAE,OAAO;EACvCI,gBAAgB,EAAEA,CAAA,KAAM,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEHL,IAAI,CAACC,IAAI,CAAC,iCAAiC,EAAE,OAAO;EAClDK,gBAAgB,EAAEA,CAAA,KAAM,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEHN,IAAI,CAACC,IAAI,CAAC,sCAAsC,EAAE,OAAO;EACvDM,aAAa,EAAEA,CAAA,KAAM,CAAC;AACxB,CAAC,CAAC,CAAC;AAEHC,QAAQ,CAAC,4BAA4B,EAAE,MAAM;EAC3CC,IAAI,CAAC,mBAAmB,EAAE,MAAM;IAC9B,MAAMC,UAAU,GAAGZ,0BAA0B,CAC3C,wGAAwG,EACxG,gBACF,CAAC;IACDa,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACb,SAAS,CAACc,SAAS,CAAC,CAAC;EACz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,CAAC;IACDa,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACb,SAAS,CAACgB,IAAI,CAAC,CAAC;EACpD,CAAC,CAAC;EACFN,IAAI,CAAC,uCAAuC,EAAE,MAAM;IAClD,MAAMC,UAAU,GAAGZ,0BAA0B,CAC3C,upBAAupB,EACvpB,gBACF,CAAC;IACDa,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACb,SAAS,CAACgB,IAAI,CAAC,CAAC;EACpD,CAAC,CAAC;EACFN,IAAI,CAAC,oCAAoC,EAAE,MAAM;IAC/C,MAAMC,UAAU,GAAGZ,0BAA0B,CAC3C,6OAA6O,EAC7O,gBACF,CAAC;IACDa,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACb,SAAS,CAACgB,IAAI,CAAC,CAAC;EACpD,CAAC,CAAC;EACFN,IAAI,CAAC,kCAAkC,EAAE,MAAM;IAC7C,MAAMC,UAAU,GAAGZ,0BAA0B,CAC3C,wMAAwM,EACxM,gBACF,CAAC;IACDa,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,CAACb,SAAS,CAACgB,IAAI,CAAC,CAAC;EACpD,CAAC,CAAC;EAEFN,IAAI,CAAC,cAAc,EAAE,MAAM;IACzB,MAAMC,UAAU,GAAGZ,0BAA0B,CAAC,SAAS,CAAC;IACxDa,MAAM,CAACD,UAAU,CAAC,CAACE,aAAa,CAAC,EAAE,CAAC;EACtC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -20,13 +20,10 @@ export const useCreateBackup = () => {
20
20
  const {
21
21
  core
22
22
  } = useONECore();
23
- return useMutation(async _ref => {
24
- let {
25
- password,
26
- outputPath
27
- } = _ref;
28
- return core.createBackup(password, outputPath);
29
- }, {
23
+ return useMutation(async ({
24
+ password,
25
+ outputPath
26
+ }) => core.createBackup(password, outputPath), {
30
27
  onSuccess: () => queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY)
31
28
  });
32
29
  };
@@ -35,13 +32,10 @@ export const useUnpackBackup = () => {
35
32
  const {
36
33
  core
37
34
  } = useONECore();
38
- return useMutation(async _ref2 => {
39
- let {
40
- password,
41
- inputPath
42
- } = _ref2;
43
- return core.unpackBackup(password, inputPath);
44
- }, {
35
+ return useMutation(async ({
36
+ password,
37
+ inputPath
38
+ }) => core.unpackBackup(password, inputPath), {
45
39
  onSuccess: () => queryClient.resetQueries()
46
40
  });
47
41
  };
@@ -63,7 +57,10 @@ export const useRollbackImport = () => {
63
57
  onSuccess: () => queryClient.resetQueries()
64
58
  });
65
59
  };
66
- export const useBackupFinalizeImportProcedure = () => {
60
+ export const useBackupFinalizeImportProcedure = ({
61
+ generateHwKey,
62
+ generateSwKey
63
+ }) => {
67
64
  const {
68
65
  mutateAsync: finalizeImport
69
66
  } = useFinalizeImport();
@@ -84,7 +81,7 @@ export const useBackupFinalizeImportProcedure = () => {
84
81
  type: DidTypeEnum.LOCAL
85
82
  });
86
83
  let swDidId = (_dids$values$find = dids.values.find(did => did.name.startsWith(SW_DID_NAME_PREFIX))) === null || _dids$values$find === void 0 ? void 0 : _dids$values$find.id;
87
- if (!swDidId) {
84
+ if (!swDidId && generateSwKey) {
88
85
  const swKeyId = await core.generateKey({
89
86
  keyParams: {},
90
87
  keyType: 'EDDSA',
@@ -107,21 +104,24 @@ export const useBackupFinalizeImportProcedure = () => {
107
104
  params: {}
108
105
  });
109
106
  }
107
+ let hwKeyId = null;
108
+ if (generateHwKey) {
109
+ hwKeyId = await core.generateKey({
110
+ keyParams: {},
111
+ keyType: 'ECDSA',
112
+ name: `holder-key-hw-${generateUUID()}`,
113
+ organisationId,
114
+ storageParams: {},
115
+ storageType: 'SECURE_ELEMENT'
116
+ }).catch(e => {
117
+ // ignore if HW keys not supported by device
118
+ if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {
119
+ return null;
120
+ }
121
+ throw e;
122
+ });
123
+ }
110
124
  let hwDidId = null;
111
- const hwKeyId = await core.generateKey({
112
- keyParams: {},
113
- keyType: 'ES256',
114
- name: `holder-key-hw-${generateUUID()}`,
115
- organisationId,
116
- storageParams: {},
117
- storageType: 'SECURE_ELEMENT'
118
- }).catch(e => {
119
- // ignore if HW keys not supported by device
120
- if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {
121
- return null;
122
- }
123
- throw e;
124
- });
125
125
  if (hwKeyId) {
126
126
  hwDidId = await core.createDid({
127
127
  didMethod: 'KEY',
@@ -138,6 +138,6 @@ export const useBackupFinalizeImportProcedure = () => {
138
138
  });
139
139
  }
140
140
  return [hwDidId, swDidId];
141
- }, [core, organisationId, finalizeImport]);
141
+ }, [core, organisationId, finalizeImport, generateHwKey, generateSwKey]);
142
142
  };
143
143
  //# sourceMappingURL=backup.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DidTypeEnum","OneError","useCallback","useMutation","useQuery","useQueryClient","generateUUID","useONECore","HW_DID_NAME_PREFIX","SW_DID_NAME_PREFIX","OneErrorCode","HISTORY_LIST_QUERY_KEY","BACKUP_INFO_QUERY_KEY","useBackupInfo","core","backupInfo","keepPreviousData","useCreateBackup","queryClient","_ref","password","outputPath","createBackup","onSuccess","invalidateQueries","useUnpackBackup","_ref2","inputPath","unpackBackup","resetQueries","useFinalizeImport","finalizeImport","useRollbackImport","rollbackImport","useBackupFinalizeImportProcedure","mutateAsync","organisationId","_dids$values$find","dids","getDids","deactivated","page","pageSize","type","LOCAL","swDidId","values","find","did","name","startsWith","id","swKeyId","generateKey","keyParams","keyType","storageParams","storageType","createDid","didMethod","keys","assertionMethod","authentication","capabilityDelegation","capabilityInvocation","keyAgreement","params","hwDidId","hwKeyId","catch","e","code","KeyStorageNotSupported"],"sources":["backup.ts"],"sourcesContent":["import { DidTypeEnum, OneError } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { generateUUID } from '../../uuid';\nimport { useONECore } from './core-context';\nimport { HW_DID_NAME_PREFIX, SW_DID_NAME_PREFIX } from './core-init';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\n\nconst BACKUP_INFO_QUERY_KEY = 'backup-info';\n\nexport const useBackupInfo = () => {\n const { core } = useONECore();\n\n return useQuery([BACKUP_INFO_QUERY_KEY], () => core.backupInfo(), {\n keepPreviousData: true,\n });\n};\n\nexport const useCreateBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, outputPath }: { outputPath: string; password: string }) =>\n core.createBackup(password, outputPath),\n {\n onSuccess: () => queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY),\n },\n );\n};\n\nexport const useUnpackBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, inputPath }: { inputPath: string; password: string }) => core.unpackBackup(password, inputPath),\n {\n onSuccess: () => queryClient.resetQueries(),\n },\n );\n};\n\nexport const useFinalizeImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.finalizeImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\nexport const useRollbackImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.rollbackImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\nexport const useBackupFinalizeImportProcedure = () => {\n const { mutateAsync: finalizeImport } = useFinalizeImport();\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n await finalizeImport();\n\n // update wallet did references\n const dids = await core.getDids({\n deactivated: false,\n organisationId,\n page: 0,\n pageSize: 1,\n type: DidTypeEnum.LOCAL,\n });\n let swDidId = dids.values.find((did) => did.name.startsWith(SW_DID_NAME_PREFIX))?.id;\n\n if (!swDidId) {\n const swKeyId = await core.generateKey({\n keyParams: {},\n keyType: 'EDDSA',\n name: `holder-key-sw-${generateUUID()}`,\n organisationId,\n storageParams: {},\n storageType: 'INTERNAL',\n });\n swDidId = await core.createDid({\n didMethod: 'KEY',\n keys: {\n assertionMethod: [swKeyId],\n authentication: [swKeyId],\n capabilityDelegation: [swKeyId],\n capabilityInvocation: [swKeyId],\n keyAgreement: [swKeyId],\n },\n name: `${SW_DID_NAME_PREFIX}-${generateUUID()}`,\n organisationId,\n params: {},\n });\n }\n\n let hwDidId: string | null = null;\n const hwKeyId = await core\n .generateKey({\n keyParams: {},\n keyType: 'ES256',\n name: `holder-key-hw-${generateUUID()}`,\n organisationId,\n storageParams: {},\n storageType: 'SECURE_ELEMENT',\n })\n .catch((e) => {\n // ignore if HW keys not supported by device\n if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {\n return null;\n }\n throw e;\n });\n if (hwKeyId) {\n hwDidId = await core.createDid({\n didMethod: 'KEY',\n keys: {\n assertionMethod: [hwKeyId],\n authentication: [hwKeyId],\n capabilityDelegation: [hwKeyId],\n capabilityInvocation: [hwKeyId],\n keyAgreement: [hwKeyId],\n },\n name: `${HW_DID_NAME_PREFIX}-${generateUUID()}`,\n organisationId,\n params: {},\n });\n }\n\n return [hwDidId, swDidId] as [string | null, string];\n }, [core, organisationId, finalizeImport]);\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,iCAAiC;AACvE,SAASC,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAEnE,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,aAAa;AACpE,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,sBAAsB,QAAQ,WAAW;AAElD,MAAMC,qBAAqB,GAAG,aAAa;AAE3C,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAM;IAAEC;EAAK,CAAC,GAAGP,UAAU,EAAE;EAE7B,OAAOH,QAAQ,CAAC,CAACQ,qBAAqB,CAAC,EAAE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AAM,EAAE,CAAC;MACX,CAAC,CAAC;IACJ;IAEA,OAAO,CAACC,OAAO,EAAEtB,OAAO,CAAC;EAC3B,CAAC,EAAE,CAAC/B,IAAI,EAAEsB,cAAc,EAAEL,cAAc,CAAC,CAAC;AAC5C,CAAC"}
1
+ {"version":3,"names":["DidTypeEnum","OneError","useCallback","useMutation","useQuery","useQueryClient","generateUUID","useONECore","HW_DID_NAME_PREFIX","SW_DID_NAME_PREFIX","OneErrorCode","HISTORY_LIST_QUERY_KEY","BACKUP_INFO_QUERY_KEY","useBackupInfo","core","backupInfo","keepPreviousData","useCreateBackup","queryClient","password","outputPath","createBackup","onSuccess","invalidateQueries","useUnpackBackup","inputPath","unpackBackup","resetQueries","useFinalizeImport","finalizeImport","useRollbackImport","rollbackImport","useBackupFinalizeImportProcedure","generateHwKey","generateSwKey","mutateAsync","organisationId","_dids$values$find","dids","getDids","deactivated","page","pageSize","type","LOCAL","swDidId","values","find","did","name","startsWith","id","swKeyId","generateKey","keyParams","keyType","storageParams","storageType","createDid","didMethod","keys","assertionMethod","authentication","capabilityDelegation","capabilityInvocation","keyAgreement","params","hwKeyId","catch","e","code","KeyStorageNotSupported","hwDidId"],"sources":["backup.ts"],"sourcesContent":["import { DidTypeEnum, OneError } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { generateUUID } from '../../uuid';\nimport { useONECore } from './core-context';\nimport { HW_DID_NAME_PREFIX, IdentifiersInitializationConfig, SW_DID_NAME_PREFIX } from './core-init';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\n\nconst BACKUP_INFO_QUERY_KEY = 'backup-info';\n\nexport const useBackupInfo = () => {\n const { core } = useONECore();\n\n return useQuery([BACKUP_INFO_QUERY_KEY], () => core.backupInfo(), {\n keepPreviousData: true,\n });\n};\n\nexport const useCreateBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, outputPath }: { outputPath: string; password: string }) =>\n core.createBackup(password, outputPath),\n {\n onSuccess: () => queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY),\n },\n );\n};\n\nexport const useUnpackBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, inputPath }: { inputPath: string; password: string }) => core.unpackBackup(password, inputPath),\n {\n onSuccess: () => queryClient.resetQueries(),\n },\n );\n};\n\nexport const useFinalizeImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.finalizeImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\nexport const useRollbackImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.rollbackImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\nexport const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {\n const { mutateAsync: finalizeImport } = useFinalizeImport();\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n await finalizeImport();\n\n // update wallet did references\n const dids = await core.getDids({\n deactivated: false,\n organisationId,\n page: 0,\n pageSize: 1,\n type: DidTypeEnum.LOCAL,\n });\n let swDidId = dids.values.find((did) => did.name.startsWith(SW_DID_NAME_PREFIX))?.id;\n\n if (!swDidId && generateSwKey) {\n const swKeyId = await core.generateKey({\n keyParams: {},\n keyType: 'EDDSA',\n name: `holder-key-sw-${generateUUID()}`,\n organisationId,\n storageParams: {},\n storageType: 'INTERNAL',\n });\n swDidId = await core.createDid({\n didMethod: 'KEY',\n keys: {\n assertionMethod: [swKeyId],\n authentication: [swKeyId],\n capabilityDelegation: [swKeyId],\n capabilityInvocation: [swKeyId],\n keyAgreement: [swKeyId],\n },\n name: `${SW_DID_NAME_PREFIX}-${generateUUID()}`,\n organisationId,\n params: {},\n });\n }\n\n let hwKeyId: string | null = null;\n if (generateHwKey) {\n hwKeyId = await core\n .generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: `holder-key-hw-${generateUUID()}`,\n organisationId,\n storageParams: {},\n storageType: 'SECURE_ELEMENT',\n })\n .catch((e) => {\n // ignore if HW keys not supported by device\n if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {\n return null;\n }\n throw e;\n });\n }\n\n let hwDidId: string | null = null;\n if (hwKeyId) {\n hwDidId = await core.createDid({\n didMethod: 'KEY',\n keys: {\n assertionMethod: [hwKeyId],\n authentication: [hwKeyId],\n capabilityDelegation: [hwKeyId],\n capabilityInvocation: [hwKeyId],\n keyAgreement: [hwKeyId],\n },\n name: `${HW_DID_NAME_PREFIX}-${generateUUID()}`,\n organisationId,\n params: {},\n });\n }\n\n return [hwDidId, swDidId] as [string | null, string | undefined];\n }, [core, organisationId, finalizeImport, generateHwKey, generateSwKey]);\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,iCAAiC;AACvE,SAASC,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAEnE,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,kBAAkB,EAAmCC,kBAAkB,QAAQ,aAAa;AACrG,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,sBAAsB,QAAQ,WAAW;AAElD,MAAMC,qBAAqB,GAAG,aAAa;AAE3C,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAM;IAAEC;EAAK,CAAC,GAAGP,UAAU,CAAC,CAAC;EAE7B,OAAOH,QAAQ,CAAC,CAACQ,qBAAqB,CAAC,EAAE,MAAME,IAAI,CAACC,UAAU,CAAC,CAAC,EAAE;IAChEC,gBAAgB,EAAE;EACpB,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACnC,MAAMC,WAAW,GAAGb,cAAc,CAAC,CAAC;EACpC,M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IAEA,OAAO,CAACM,OAAO,EAAE3B,OAAO,CAAC;EAC3B,CAAC,EAAE,CAAC/B,IAAI,EAAEsB,cAAc,EAAEP,cAAc,EAAEI,aAAa,EAAEC,aAAa,CAAC,CAAC;AAC1E,CAAC","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ import { CacheType } from '@procivis/react-native-one-core';
2
+ import { useMutation, useQueryClient } from 'react-query';
3
+ import { useONECore } from './core-context';
4
+ import { CREDENTIAL_DETAIL_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_LIST_QUERY_KEY } from './credentials';
5
+ import { REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, TRUST_ENTITY_DETAIL_QUERY_KEY } from './trust-entity';
6
+ const CREDENTIAL_QUERY_KEYS = [CREDENTIAL_LIST_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_DETAIL_QUERY_KEY];
7
+ const TRUST_ENTITY_QUERY_KEYS = [TRUST_ENTITY_DETAIL_QUERY_KEY, REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY];
8
+
9
+ // Map each CacheType to the query keys that should be invalidated when that cache is cleared.
10
+ const cacheTypeToQueryKeys = {
11
+ [CacheType.DID_DOCUMENT]: CREDENTIAL_QUERY_KEYS,
12
+ [CacheType.JSON_LD_CONTEXT]: CREDENTIAL_QUERY_KEYS,
13
+ [CacheType.STATUS_LIST_CREDENTIAL]: CREDENTIAL_QUERY_KEYS,
14
+ [CacheType.VCT_METADATA]: CREDENTIAL_QUERY_KEYS,
15
+ [CacheType.JSON_SCHEMA]: CREDENTIAL_QUERY_KEYS,
16
+ [CacheType.TRUST_LIST]: [...TRUST_ENTITY_QUERY_KEYS, ...CREDENTIAL_QUERY_KEYS]
17
+ };
18
+ export const useCacheClear = () => {
19
+ const queryClient = useQueryClient();
20
+ const {
21
+ core
22
+ } = useONECore();
23
+ return useMutation(async cacheTypes => {
24
+ await core.deleteCache(cacheTypes);
25
+ return cacheTypes;
26
+ }, {
27
+ onSuccess: async (_, cacheTypes) => {
28
+ const queryKeysToInvalidate = new Set();
29
+ cacheTypes.forEach(cacheType => {
30
+ const keys = cacheTypeToQueryKeys[cacheType] || [];
31
+ keys.forEach(key => queryKeysToInvalidate.add(key));
32
+ });
33
+ await Promise.all([...queryKeysToInvalidate].map(queryKey => queryClient.invalidateQueries(queryKey)));
34
+ }
35
+ });
36
+ };
37
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CacheType","useMutation","useQueryClient","useONECore","CREDENTIAL_DETAIL_QUERY_KEY","CREDENTIAL_LIST_PAGED_QUERY_KEY","CREDENTIAL_LIST_QUERY_KEY","REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY","TRUST_ENTITY_DETAIL_QUERY_KEY","CREDENTIAL_QUERY_KEYS","TRUST_ENTITY_QUERY_KEYS","cacheTypeToQueryKeys","DID_DOCUMENT","JSON_LD_CONTEXT","STATUS_LIST_CREDENTIAL","VCT_METADATA","JSON_SCHEMA","TRUST_LIST","useCacheClear","queryClient","core","cacheTypes","deleteCache","onSuccess","_","queryKeysToInvalidate","Set","forEach","cacheType","keys","key","add","Promise","all","map","queryKey","invalidateQueries"],"sources":["cache.ts"],"sourcesContent":["import { CacheType } from '@procivis/react-native-one-core';\nimport { useMutation, useQueryClient } from 'react-query';\n\nimport { useONECore } from './core-context';\nimport { CREDENTIAL_DETAIL_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_LIST_QUERY_KEY } from './credentials';\nimport { REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, TRUST_ENTITY_DETAIL_QUERY_KEY } from './trust-entity';\n\nconst CREDENTIAL_QUERY_KEYS = [CREDENTIAL_LIST_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_DETAIL_QUERY_KEY];\nconst TRUST_ENTITY_QUERY_KEYS = [TRUST_ENTITY_DETAIL_QUERY_KEY, REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY];\n\n// Map each CacheType to the query keys that should be invalidated when that cache is cleared.\nconst cacheTypeToQueryKeys: Record<CacheType, string[]> = {\n [CacheType.DID_DOCUMENT]: CREDENTIAL_QUERY_KEYS,\n [CacheType.JSON_LD_CONTEXT]: CREDENTIAL_QUERY_KEYS,\n [CacheType.STATUS_LIST_CREDENTIAL]: CREDENTIAL_QUERY_KEYS,\n [CacheType.VCT_METADATA]: CREDENTIAL_QUERY_KEYS,\n [CacheType.JSON_SCHEMA]: CREDENTIAL_QUERY_KEYS,\n [CacheType.TRUST_LIST]: [...TRUST_ENTITY_QUERY_KEYS, ...CREDENTIAL_QUERY_KEYS],\n};\n\nexport const useCacheClear = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (cacheTypes: CacheType[]) => {\n await core.deleteCache(cacheTypes);\n return cacheTypes;\n },\n {\n onSuccess: async (_, cacheTypes) => {\n const queryKeysToInvalidate = new Set<string>();\n\n cacheTypes.forEach((cacheType) => {\n const keys = cacheTypeToQueryKeys[cacheType] || [];\n keys.forEach((key) => queryKeysToInvalidate.add(key));\n });\n\n await Promise.all([...queryKeysToInvalidate].map((queryKey) => queryClient.invalidateQueries(queryKey)));\n },\n },\n );\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,iCAAiC;AAC3D,SAASC,WAAW,EAAEC,cAAc,QAAQ,aAAa;AAEzD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,2BAA2B,EAAEC,+BAA+B,EAAEC,yBAAyB,QAAQ,eAAe;AACvH,SAASC,oCAAoC,EAAEC,6BAA6B,QAAQ,gBAAgB;AAEpG,MAAMC,qBAAqB,GAAG,CAACH,yBAAyB,EAAED,+BAA+B,EAAED,2BAA2B,CAAC;AACvH,MAAMM,uBAAuB,GAAG,CAACF,6BAA6B,EAAED,oCAAoC,CAAC;;AAErG;AACA,MAAMI,oBAAiD,GAAG;EACxD,CAACX,SAAS,CAACY,YAAY,GAAGH,qBAAqB;EAC/C,CAACT,SAAS,CAACa,eAAe,GAAGJ,qBAAqB;EAClD,CAACT,SAAS,CAACc,sBAAsB,GAAGL,qBAAqB;EACzD,CAACT,SAAS,CAACe,YAAY,GAAGN,qBAAqB;EAC/C,CAACT,SAAS,CAACgB,WAAW,GAAGP,qBAAqB;EAC9C,CAACT,SAAS,CAACiB,UAAU,GAAG,CAAC,GAAGP,uBAAuB,EAAE,GAAGD,qBAAqB;AAC/E,CAAC;AAED,OAAO,MAAMS,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,WAAW,GAAGjB,cAAc,CAAC,CAAC;EACpC,MAAM;IAAEkB;EAAK,CAAC,GAAGjB,UAAU,CAAC,CAAC;EAE7B,OAAOF,WAAW,CAChB,MAAOoB,UAAuB,IAAK;IACjC,MAAMD,IAAI,CAACE,WAAW,CAACD,UAAU,CAAC;IAClC,OAAOA,UAAU;EACnB,CAAC,EACD;IACEE,SAAS,EAAE,MAAAA,CAAOC,CAAC,EAAEH,UAAU,KAAK;MAClC,MAAMI,qBAAqB,GAAG,IAAIC,GAAG,CAAS,CAAC;MAE/CL,UAAU,CAACM,OAAO,CAAEC,SAAS,IAAK;QAChC,MAAMC,IAAI,GAAGlB,oBAAoB,CAACiB,SAAS,CAAC,IAAI,EAAE;QAClDC,IAAI,CAACF,OAAO,CAAEG,GAAG,IAAKL,qBAAqB,CAACM,GAAG,CAACD,GAAG,CAAC,CAAC;MACvD,CAAC,CAAC;MAEF,MAAME,OAAO,CAACC,GAAG,CAAC,CAAC,GAAGR,qBAAqB,CAAC,CAACS,GAAG,CAAEC,QAAQ,IAAKhB,WAAW,CAACiB,iBAAiB,CAACD,QAAQ,CAAC,CAAC,CAAC;IAC1G;EACF,CACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -9,4 +9,15 @@ export const useCoreConfig = () => {
9
9
  keepPreviousData: true
10
10
  });
11
11
  };
12
+ export const getEnabledTransports = config => {
13
+ var _config$transport;
14
+ return Object.values((_config$transport = config === null || config === void 0 ? void 0 : config.transport) !== null && _config$transport !== void 0 ? _config$transport : {}).filter(t => t.enabled !== false).map(transport => transport.type);
15
+ };
16
+ export const getEnabledExchangeProtocols = exchangeProtocol => {
17
+ return Object.values(exchangeProtocol !== null && exchangeProtocol !== void 0 ? exchangeProtocol : {}).filter(t => t.enabled !== false).map(exchange => exchange.type);
18
+ };
19
+ export const getEnabledTrustManagement = config => {
20
+ var _config$trustManageme;
21
+ return Object.values((_config$trustManageme = config === null || config === void 0 ? void 0 : config.trustManagement) !== null && _config$trustManageme !== void 0 ? _config$trustManageme : {}).filter(t => t.enabled !== false).map(trustManagement => trustManagement.type);
22
+ };
12
23
  //# sourceMappingURL=core-config.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useQuery","useONECore","CONFIG_QUERY_KEY","useCoreConfig","core","getConfig","keepPreviousData"],"sources":["core-config.ts"],"sourcesContent":["import { useQuery } from 'react-query';\n\nimport { useONECore } from './core-context';\n\nconst CONFIG_QUERY_KEY = 'config';\n\nexport const useCoreConfig = () => {\n const { core } = useONECore();\n\n return useQuery([CONFIG_QUERY_KEY], () => core?.getConfig(), {\n keepPreviousData: true,\n });\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,aAAa;AAEtC,SAASC,UAAU,QAAQ,gBAAgB;AAE3C,MAAMC,gBAAgB,GAAG,QAAQ;AAEjC,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAM;IAAEC;EAAK,CAAC,GAAGH,UAAU,EAAE;EAE7B,OAAOD,QAAQ,CAAC,CAACE,gBAAgB,CAAC,EAAE,MAAME,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEC,SAAS,EAAE,EAAE;IAC3DC,gBAAgB,EAAE;EACpB,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["useQuery","useONECore","CONFIG_QUERY_KEY","useCoreConfig","core","getConfig","keepPreviousData","getEnabledTransports","config","_config$transport","Object","values","transport","filter","t","enabled","map","type","getEnabledExchangeProtocols","exchangeProtocol","exchange","getEnabledTrustManagement","_config$trustManageme","trustManagement"],"sources":["core-config.ts"],"sourcesContent":["import { Config, ConfigEntities } from '@procivis/react-native-one-core';\nimport { useQuery } from 'react-query';\n\nimport { useONECore } from './core-context';\n\nconst CONFIG_QUERY_KEY = 'config';\n\nexport const useCoreConfig = () => {\n const { core } = useONECore();\n\n return useQuery([CONFIG_QUERY_KEY], () => core?.getConfig(), {\n keepPreviousData: true,\n });\n};\n\nexport const getEnabledTransports = (config: Config): string[] => {\n return Object.values(config?.transport ?? {})\n .filter((t) => t.enabled !== false)\n .map((transport) => transport.type);\n};\n\nexport const getEnabledExchangeProtocols = (exchangeProtocol: ConfigEntities<any>): string[] => {\n return Object.values(exchangeProtocol ?? {})\n .filter((t) => t.enabled !== false)\n .map((exchange) => exchange.type);\n};\n\nexport const getEnabledTrustManagement = (config: Config): string[] => {\n return Object.values(config?.trustManagement ?? {})\n .filter((t) => t.enabled !== false)\n .map((trustManagement) => trustManagement.type);\n};\n"],"mappings":"AACA,SAASA,QAAQ,QAAQ,aAAa;AAEtC,SAASC,UAAU,QAAQ,gBAAgB;AAE3C,MAAMC,gBAAgB,GAAG,QAAQ;AAEjC,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAM;IAAEC;EAAK,CAAC,GAAGH,UAAU,CAAC,CAAC;EAE7B,OAAOD,QAAQ,CAAC,CAACE,gBAAgB,CAAC,EAAE,MAAME,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEC,SAAS,CAAC,CAAC,EAAE;IAC3DC,gBAAgB,EAAE;EACpB,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAIC,MAAc,IAAe;EAAA,IAAAC,iBAAA;EAChE,OAAOC,MAAM,CAACC,MAAM,EAAAF,iBAAA,GAACD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEI,SAAS,cAAAH,iBAAA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