@icure/api 8.6.19 → 8.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/icc-api/api/IccDocumentApi.d.ts +10 -2
  2. package/icc-api/api/IccDocumentApi.js +22 -4
  3. package/icc-api/api/IccDocumentApi.js.map +1 -1
  4. package/icc-api/api/IccReceiptApi.d.ts +17 -0
  5. package/icc-api/api/IccReceiptApi.js +52 -0
  6. package/icc-api/api/IccReceiptApi.js.map +1 -1
  7. package/icc-api/model/DataAttachment.d.ts +22 -0
  8. package/icc-api/model/DataAttachment.js.map +1 -1
  9. package/icc-api/model/Document.d.ts +6 -0
  10. package/icc-api/model/Document.js.map +1 -1
  11. package/icc-api/model/Receipt.d.ts +6 -0
  12. package/icc-api/model/Receipt.js.map +1 -1
  13. package/icc-x-api/crypto/BaseExchangeDataManager.js +2 -2
  14. package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
  15. package/icc-x-api/crypto/ExchangeDataManager.js +3 -3
  16. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
  17. package/icc-x-api/crypto/ExtendedApisUtils.d.ts +1 -1
  18. package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
  19. package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +1 -1
  20. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +8 -2
  21. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
  22. package/icc-x-api/crypto/RecoveryDataEncryption.js.map +1 -1
  23. package/icc-x-api/icc-accesslog-x-api.js +7 -7
  24. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  25. package/icc-x-api/icc-calendar-item-x-api.js +7 -7
  26. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  27. package/icc-x-api/icc-classification-x-api.js +4 -5
  28. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  29. package/icc-x-api/icc-code-x-api.d.ts +2 -2
  30. package/icc-x-api/icc-code-x-api.js +3 -33
  31. package/icc-x-api/icc-code-x-api.js.map +1 -1
  32. package/icc-x-api/icc-contact-x-api.js +20 -33
  33. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  34. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  35. package/icc-x-api/icc-document-x-api.d.ts +8 -7
  36. package/icc-x-api/icc-document-x-api.js +64 -22
  37. package/icc-x-api/icc-document-x-api.js.map +1 -1
  38. package/icc-x-api/icc-form-x-api.js +3 -4
  39. package/icc-x-api/icc-form-x-api.js.map +1 -1
  40. package/icc-x-api/icc-helement-x-api.js +11 -11
  41. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  42. package/icc-x-api/icc-invoice-x-api.js +3 -4
  43. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  44. package/icc-x-api/icc-maintenance-task-x-api.js +3 -3
  45. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  46. package/icc-x-api/icc-patient-x-api.js +29 -29
  47. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  48. package/icc-x-api/icc-receipt-x-api.d.ts +40 -0
  49. package/icc-x-api/icc-receipt-x-api.js +79 -1
  50. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  51. package/icc-x-api/icc-topic-x-api.js.map +1 -1
  52. package/icc-x-api/utils/code-util.d.ts +23 -0
  53. package/icc-x-api/utils/code-util.js +39 -2
  54. package/icc-x-api/utils/code-util.js.map +1 -1
  55. package/icc-x-api/utils/collection-utils.d.ts +13 -0
  56. package/icc-x-api/utils/collection-utils.js +69 -0
  57. package/icc-x-api/utils/collection-utils.js.map +1 -1
  58. package/icc-x-api/utils/compression-utils.d.ts +28 -0
  59. package/icc-x-api/utils/compression-utils.js +106 -0
  60. package/icc-x-api/utils/compression-utils.js.map +1 -0
  61. package/icc-x-api/utils/crypto-utils.js +7 -7
  62. package/icc-x-api/utils/crypto-utils.js.map +1 -1
  63. package/icc-x-api/utils/formatting-util.d.ts +1 -3
  64. package/icc-x-api/utils/formatting-util.js +15 -17
  65. package/icc-x-api/utils/formatting-util.js.map +1 -1
  66. package/icc-x-api/utils/hcp-util.js +2 -3
  67. package/icc-x-api/utils/hcp-util.js.map +1 -1
  68. package/icc-x-api/utils/insurability-util.js +10 -8
  69. package/icc-x-api/utils/insurability-util.js.map +1 -1
  70. package/icc-x-api/utils/lzma-wasm.d.ts +6 -0
  71. package/icc-x-api/utils/lzma-wasm.js +81 -0
  72. package/icc-x-api/utils/lzma-wasm.js.map +1 -0
  73. package/icc-x-api/utils/mutex.d.ts +12 -0
  74. package/icc-x-api/utils/mutex.js +26 -0
  75. package/icc-x-api/utils/mutex.js.map +1 -0
  76. package/icc-x-api/utils/websocket.js +7 -7
  77. package/icc-x-api/utils/websocket.js.map +1 -1
  78. package/icc-x-api/wasm/lzma/lzma.js +2 -0
  79. package/icc-x-api/wasm/lzma/lzma.wasm +0 -0
  80. package/package.json +2 -11
  81. package/icc-x-api/utils/uuid-encoder.d.ts +0 -44
  82. package/icc-x-api/utils/uuid-encoder.js +0 -114
  83. package/icc-x-api/utils/uuid-encoder.js.map +0 -1
  84. package/test/icc-api/api/IccAgendaApi.d.ts +0 -1
  85. package/test/icc-api/api/IccAgendaApi.js +0 -64
  86. package/test/icc-api/api/IccAgendaApi.js.map +0 -1
  87. package/test/icc-api/api/IccAnonymousAccessApi.d.ts +0 -1
  88. package/test/icc-api/api/IccAnonymousAccessApi.js +0 -58
  89. package/test/icc-api/api/IccAnonymousAccessApi.js.map +0 -1
  90. package/test/icc-api/api/IccCalendarItemApi.d.ts +0 -1
  91. package/test/icc-api/api/IccCalendarItemApi.js +0 -67
  92. package/test/icc-api/api/IccCalendarItemApi.js.map +0 -1
  93. package/test/icc-api/api/IccCalendarItemTypeApi.d.ts +0 -1
  94. package/test/icc-api/api/IccCalendarItemTypeApi.js +0 -96
  95. package/test/icc-api/api/IccCalendarItemTypeApi.js.map +0 -1
  96. package/test/icc-api/api/IccCodeApi.d.ts +0 -1
  97. package/test/icc-api/api/IccCodeApi.js +0 -38
  98. package/test/icc-api/api/IccCodeApi.js.map +0 -1
  99. package/test/icc-api/api/IccDocumentApi.d.ts +0 -1
  100. package/test/icc-api/api/IccDocumentApi.js +0 -199
  101. package/test/icc-api/api/IccDocumentApi.js.map +0 -1
  102. package/test/icc-api/api/IccGroupApi.d.ts +0 -1
  103. package/test/icc-api/api/IccGroupApi.js +0 -50
  104. package/test/icc-api/api/IccGroupApi.js.map +0 -1
  105. package/test/icc-api/api/IccKeywordApi.d.ts +0 -1
  106. package/test/icc-api/api/IccKeywordApi.js +0 -64
  107. package/test/icc-api/api/IccKeywordApi.js.map +0 -1
  108. package/test/icc-api/api/IccMedicalLocationApi.d.ts +0 -1
  109. package/test/icc-api/api/IccMedicalLocationApi.js +0 -64
  110. package/test/icc-api/api/IccMedicalLocationApi.js.map +0 -1
  111. package/test/icc-api/api/IccPlaceApi.d.ts +0 -1
  112. package/test/icc-api/api/IccPlaceApi.js +0 -64
  113. package/test/icc-api/api/IccPlaceApi.js.map +0 -1
  114. package/test/icc-api/api/IccRecoveryDataApi.d.ts +0 -1
  115. package/test/icc-api/api/IccRecoveryDataApi.js +0 -95
  116. package/test/icc-api/api/IccRecoveryDataApi.js.map +0 -1
  117. package/test/icc-api/api/IccRoleApi.d.ts +0 -1
  118. package/test/icc-api/api/IccRoleApi.js +0 -34
  119. package/test/icc-api/api/IccRoleApi.js.map +0 -1
  120. package/test/icc-api/api/IccUserApi.d.ts +0 -1
  121. package/test/icc-api/api/IccUserApi.js +0 -96
  122. package/test/icc-api/api/IccUserApi.js.map +0 -1
  123. package/test/icc-api/e2e/IccCalendarItemApi.d.ts +0 -1
  124. package/test/icc-api/e2e/IccCalendarItemApi.js +0 -46
  125. package/test/icc-api/e2e/IccCalendarItemApi.js.map +0 -1
  126. package/test/icc-api/model/modelHelpersTest.d.ts +0 -1
  127. package/test/icc-api/model/modelHelpersTest.js +0 -45
  128. package/test/icc-api/model/modelHelpersTest.js.map +0 -1
  129. package/test/icc-x-api/auth/group-switch-test.d.ts +0 -1
  130. package/test/icc-x-api/auth/group-switch-test.js +0 -81
  131. package/test/icc-x-api/auth/group-switch-test.js.map +0 -1
  132. package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +0 -2
  133. package/test/icc-x-api/auth/jwt-concurrency-test.js +0 -112
  134. package/test/icc-x-api/auth/jwt-concurrency-test.js.map +0 -1
  135. package/test/icc-x-api/auth/jwt-provider-test.d.ts +0 -1
  136. package/test/icc-x-api/auth/jwt-provider-test.js +0 -197
  137. package/test/icc-x-api/auth/jwt-provider-test.js.map +0 -1
  138. package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +0 -1
  139. package/test/icc-x-api/auth/smart-auth-provider-test.js +0 -224
  140. package/test/icc-x-api/auth/smart-auth-provider-test.js.map +0 -1
  141. package/test/icc-x-api/autofix-anonymity-test.d.ts +0 -1
  142. package/test/icc-x-api/autofix-anonymity-test.js +0 -122
  143. package/test/icc-x-api/autofix-anonymity-test.js.map +0 -1
  144. package/test/icc-x-api/confidential-entities-test.d.ts +0 -1
  145. package/test/icc-x-api/confidential-entities-test.js +0 -168
  146. package/test/icc-x-api/confidential-entities-test.js.map +0 -1
  147. package/test/icc-x-api/crud/comprehensive-crud-test.d.ts +0 -1
  148. package/test/icc-x-api/crud/comprehensive-crud-test.js +0 -276
  149. package/test/icc-x-api/crud/comprehensive-crud-test.js.map +0 -1
  150. package/test/icc-x-api/crud/entities-crud-test-interface.d.ts +0 -16
  151. package/test/icc-x-api/crud/entities-crud-test-interface.js +0 -408
  152. package/test/icc-x-api/crud/entities-crud-test-interface.js.map +0 -1
  153. package/test/icc-x-api/crypto/anonymous-delegations-test.d.ts +0 -1
  154. package/test/icc-x-api/crypto/anonymous-delegations-test.js +0 -587
  155. package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +0 -1
  156. package/test/icc-x-api/crypto/concurrency.d.ts +0 -1
  157. package/test/icc-x-api/crypto/concurrency.js +0 -35
  158. package/test/icc-x-api/crypto/concurrency.js.map +0 -1
  159. package/test/icc-x-api/crypto/crypto-utils.d.ts +0 -1
  160. package/test/icc-x-api/crypto/crypto-utils.js +0 -79
  161. package/test/icc-x-api/crypto/crypto-utils.js.map +0 -1
  162. package/test/icc-x-api/crypto/cryptoTest.d.ts +0 -2
  163. package/test/icc-x-api/crypto/cryptoTest.js +0 -402
  164. package/test/icc-x-api/crypto/cryptoTest.js.map +0 -1
  165. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +0 -1
  166. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +0 -166
  167. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +0 -1
  168. package/test/icc-x-api/crypto/exchange-data-manager-test.d.ts +0 -1
  169. package/test/icc-x-api/crypto/exchange-data-manager-test.js +0 -674
  170. package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +0 -1
  171. package/test/icc-x-api/crypto/full-crypto-test.d.ts +0 -1
  172. package/test/icc-x-api/crypto/full-crypto-test.js +0 -454
  173. package/test/icc-x-api/crypto/full-crypto-test.js.map +0 -1
  174. package/test/icc-x-api/crypto/legacy-metadata-migration-test.d.ts +0 -1
  175. package/test/icc-x-api/crypto/legacy-metadata-migration-test.js +0 -379
  176. package/test/icc-x-api/crypto/legacy-metadata-migration-test.js.map +0 -1
  177. package/test/icc-x-api/crypto/secure-delegations-manager-test.d.ts +0 -1
  178. package/test/icc-x-api/crypto/secure-delegations-manager-test.js +0 -278
  179. package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +0 -1
  180. package/test/icc-x-api/crypto/shamir.d.ts +0 -2
  181. package/test/icc-x-api/crypto/shamir.js +0 -167
  182. package/test/icc-x-api/crypto/shamir.js.map +0 -1
  183. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +0 -1
  184. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +0 -71
  185. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +0 -1
  186. package/test/icc-x-api/crypto/soft-deleted-data-owners.d.ts +0 -2
  187. package/test/icc-x-api/crypto/soft-deleted-data-owners.js +0 -113
  188. package/test/icc-x-api/crypto/soft-deleted-data-owners.js.map +0 -1
  189. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.d.ts +0 -1
  190. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js +0 -246
  191. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js.map +0 -1
  192. package/test/icc-x-api/entity-with-attachments-api-test.d.ts +0 -1
  193. package/test/icc-x-api/entity-with-attachments-api-test.js +0 -142
  194. package/test/icc-x-api/entity-with-attachments-api-test.js.map +0 -1
  195. package/test/icc-x-api/filters/filters.d.ts +0 -1
  196. package/test/icc-x-api/filters/filters.js +0 -49
  197. package/test/icc-x-api/filters/filters.js.map +0 -1
  198. package/test/icc-x-api/filters/healthelement.d.ts +0 -1
  199. package/test/icc-x-api/filters/healthelement.js +0 -333
  200. package/test/icc-x-api/filters/healthelement.js.map +0 -1
  201. package/test/icc-x-api/icc-accesslog-x-api.d.ts +0 -1
  202. package/test/icc-x-api/icc-accesslog-x-api.js +0 -106
  203. package/test/icc-x-api/icc-accesslog-x-api.js.map +0 -1
  204. package/test/icc-x-api/icc-application-settings-x-api.d.ts +0 -1
  205. package/test/icc-x-api/icc-application-settings-x-api.js +0 -91
  206. package/test/icc-x-api/icc-application-settings-x-api.js.map +0 -1
  207. package/test/icc-x-api/icc-auth-api.d.ts +0 -1
  208. package/test/icc-x-api/icc-auth-api.js +0 -47
  209. package/test/icc-x-api/icc-auth-api.js.map +0 -1
  210. package/test/icc-x-api/icc-calendar-item-x-api.d.ts +0 -1
  211. package/test/icc-x-api/icc-calendar-item-x-api.js +0 -150
  212. package/test/icc-x-api/icc-calendar-item-x-api.js.map +0 -1
  213. package/test/icc-x-api/icc-contact-x-api.d.ts +0 -1
  214. package/test/icc-x-api/icc-contact-x-api.js +0 -355
  215. package/test/icc-x-api/icc-contact-x-api.js.map +0 -1
  216. package/test/icc-x-api/icc-document-x-api.d.ts +0 -1
  217. package/test/icc-x-api/icc-document-x-api.js +0 -76
  218. package/test/icc-x-api/icc-document-x-api.js.map +0 -1
  219. package/test/icc-x-api/icc-form-x-api.d.ts +0 -1
  220. package/test/icc-x-api/icc-form-x-api.js +0 -413
  221. package/test/icc-x-api/icc-form-x-api.js.map +0 -1
  222. package/test/icc-x-api/icc-hcparty-x-api-test.d.ts +0 -1
  223. package/test/icc-x-api/icc-hcparty-x-api-test.js +0 -43
  224. package/test/icc-x-api/icc-hcparty-x-api-test.js.map +0 -1
  225. package/test/icc-x-api/icc-helement-x-api-test.d.ts +0 -1
  226. package/test/icc-x-api/icc-helement-x-api-test.js +0 -155
  227. package/test/icc-x-api/icc-helement-x-api-test.js.map +0 -1
  228. package/test/icc-x-api/icc-invoice-x-api.d.ts +0 -1
  229. package/test/icc-x-api/icc-invoice-x-api.js +0 -99
  230. package/test/icc-x-api/icc-invoice-x-api.js.map +0 -1
  231. package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +0 -1
  232. package/test/icc-x-api/icc-maintenance-task-x-api-test.js +0 -222
  233. package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +0 -1
  234. package/test/icc-x-api/icc-message-x-api.d.ts +0 -1
  235. package/test/icc-x-api/icc-message-x-api.js +0 -54
  236. package/test/icc-x-api/icc-message-x-api.js.map +0 -1
  237. package/test/icc-x-api/icc-patient-x-api-test.d.ts +0 -1
  238. package/test/icc-x-api/icc-patient-x-api-test.js +0 -165
  239. package/test/icc-x-api/icc-patient-x-api-test.js.map +0 -1
  240. package/test/icc-x-api/icc-recovery-x-api.d.ts +0 -1
  241. package/test/icc-x-api/icc-recovery-x-api.js +0 -175
  242. package/test/icc-x-api/icc-recovery-x-api.js.map +0 -1
  243. package/test/icc-x-api/icc-topic-x-api.d.ts +0 -1
  244. package/test/icc-x-api/icc-topic-x-api.js +0 -269
  245. package/test/icc-x-api/icc-topic-x-api.js.map +0 -1
  246. package/test/icc-x-api/icc-user-x-api-test.d.ts +0 -1
  247. package/test/icc-x-api/icc-user-x-api-test.js +0 -99
  248. package/test/icc-x-api/icc-user-x-api-test.js.map +0 -1
  249. package/test/icc-x-api/keyless-api.d.ts +0 -1
  250. package/test/icc-x-api/keyless-api.js +0 -125
  251. package/test/icc-x-api/keyless-api.js.map +0 -1
  252. package/test/icc-x-api/patient-user.d.ts +0 -2
  253. package/test/icc-x-api/patient-user.js +0 -103
  254. package/test/icc-x-api/patient-user.js.map +0 -1
  255. package/test/icc-x-api/storage/storage.d.ts +0 -1
  256. package/test/icc-x-api/storage/storage.js +0 -48
  257. package/test/icc-x-api/storage/storage.js.map +0 -1
  258. package/test/icc-x-api/test-api-no-parent.d.ts +0 -1
  259. package/test/icc-x-api/test-api-no-parent.js +0 -79
  260. package/test/icc-x-api/test-api-no-parent.js.map +0 -1
  261. package/test/icc-x-api/test-legacy-data-support.d.ts +0 -1
  262. package/test/icc-x-api/test-legacy-data-support.js +0 -375
  263. package/test/icc-x-api/test-legacy-data-support.js.map +0 -1
  264. package/test/icc-x-api/utils/graph-test.d.ts +0 -1
  265. package/test/icc-x-api/utils/graph-test.js +0 -54
  266. package/test/icc-x-api/utils/graph-test.js.map +0 -1
  267. package/test/icc-x-api/utils/lru-temporised-async-cache-test.d.ts +0 -1
  268. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js +0 -364
  269. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +0 -1
  270. package/test/support/CSM-185.d.ts +0 -1
  271. package/test/support/CSM-185.js +0 -124
  272. package/test/support/CSM-185.js.map +0 -1
  273. package/test/support/CSM-243.d.ts +0 -1
  274. package/test/support/CSM-243.js +0 -120
  275. package/test/support/CSM-243.js.map +0 -1
  276. package/test/support/CSM-543.d.ts +0 -1
  277. package/test/support/CSM-543.js +0 -164
  278. package/test/support/CSM-543.js.map +0 -1
  279. package/test/support/CSM-729.d.ts +0 -1
  280. package/test/support/CSM-729.js +0 -225
  281. package/test/support/CSM-729.js.map +0 -1
  282. package/test/support/CSM-87.d.ts +0 -0
  283. package/test/support/CSM-87.js +0 -21
  284. package/test/support/CSM-87.js.map +0 -1
  285. package/test/support/CSM-93.d.ts +0 -1
  286. package/test/support/CSM-93.js +0 -112
  287. package/test/support/CSM-93.js.map +0 -1
  288. package/test/utils/FakeDataOwnerApi.d.ts +0 -32
  289. package/test/utils/FakeDataOwnerApi.js +0 -136
  290. package/test/utils/FakeDataOwnerApi.js.map +0 -1
  291. package/test/utils/FakeEncryptionKeysManager.d.ts +0 -36
  292. package/test/utils/FakeEncryptionKeysManager.js +0 -98
  293. package/test/utils/FakeEncryptionKeysManager.js.map +0 -1
  294. package/test/utils/FakeExchangeDataApi.d.ts +0 -32
  295. package/test/utils/FakeExchangeDataApi.js +0 -92
  296. package/test/utils/FakeExchangeDataApi.js.map +0 -1
  297. package/test/utils/FakeExchangeDataManager.d.ts +0 -48
  298. package/test/utils/FakeExchangeDataManager.js +0 -82
  299. package/test/utils/FakeExchangeDataManager.js.map +0 -1
  300. package/test/utils/FakeExchangeDataMapManager.d.ts +0 -12
  301. package/test/utils/FakeExchangeDataMapManager.js +0 -38
  302. package/test/utils/FakeExchangeDataMapManager.js.map +0 -1
  303. package/test/utils/FakeGenericApi.d.ts +0 -16
  304. package/test/utils/FakeGenericApi.js +0 -65
  305. package/test/utils/FakeGenericApi.js.map +0 -1
  306. package/test/utils/KeylessCryptoStrategies.d.ts +0 -23
  307. package/test/utils/KeylessCryptoStrategies.js +0 -26
  308. package/test/utils/KeylessCryptoStrategies.js.map +0 -1
  309. package/test/utils/TestApi.d.ts +0 -3
  310. package/test/utils/TestApi.js +0 -30
  311. package/test/utils/TestApi.js.map +0 -1
  312. package/test/utils/TestCollectionUtils.d.ts +0 -1
  313. package/test/utils/TestCollectionUtils.js +0 -109
  314. package/test/utils/TestCollectionUtils.js.map +0 -1
  315. package/test/utils/TestCryptoStrategies.d.ts +0 -42
  316. package/test/utils/TestCryptoStrategies.js +0 -80
  317. package/test/utils/TestCryptoStrategies.js.map +0 -1
  318. package/test/utils/TestStorage.d.ts +0 -23
  319. package/test/utils/TestStorage.js +0 -61
  320. package/test/utils/TestStorage.js.map +0 -1
  321. package/test/utils/roles.d.ts +0 -14
  322. package/test/utils/roles.js +0 -345
  323. package/test/utils/roles.js.map +0 -1
  324. package/test/utils/test_utils.d.ts +0 -87
  325. package/test/utils/test_utils.js +0 -452
  326. package/test/utils/test_utils.js.map +0 -1
@@ -1,587 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const chai_1 = require("chai");
13
- const mocha_1 = require("mocha");
14
- const test_utils_1 = require("../../utils/test_utils");
15
- const crypto_1 = require("crypto");
16
- require("isomorphic-fetch");
17
- const icc_x_api_1 = require("../../../icc-x-api");
18
- const User_1 = require("../../../icc-api/model/User");
19
- const Patient_1 = require("../../../icc-api/model/Patient");
20
- const HealthcareParty_1 = require("../../../icc-api/model/HealthcareParty");
21
- const uuid_1 = require("uuid");
22
- const TestApi_1 = require("../../utils/TestApi");
23
- const FilterChainMaintenanceTask_1 = require("../../../icc-api/model/FilterChainMaintenanceTask");
24
- const MaintenanceTaskAfterDateFilter_1 = require("../../../icc-x-api/filters/MaintenanceTaskAfterDateFilter");
25
- const KeyPairUpdateRequest_1 = require("../../../icc-x-api/maintenance/KeyPairUpdateRequest");
26
- const EntityShareRequest_1 = require("../../../icc-api/model/requests/EntityShareRequest");
27
- const _ = require("lodash");
28
- const types_1 = require("@icure/test-setup/types");
29
- const SecureDelegation_1 = require("../../../icc-api/model/SecureDelegation");
30
- const DataOwnerTypeEnum_1 = require("../../../icc-api/model/DataOwnerTypeEnum");
31
- const IccSecureDelegationKeyMapApi_1 = require("../../../icc-api/api/internal/IccSecureDelegationKeyMapApi");
32
- var initMasterApi = test_utils_1.TestUtils.initMasterApi;
33
- var RequestedPermissionEnum = EntityShareRequest_1.EntityShareRequest.RequestedPermissionEnum;
34
- var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
35
- const FULL_WRITE = RequestedPermissionEnum.FULL_WRITE;
36
- const FULL_READ = RequestedPermissionEnum.FULL_READ;
37
- (0, test_utils_1.setLocalStorage)(fetch);
38
- const typeCombinations = [
39
- ['explicit', 'explicit'],
40
- ['anonymous', 'explicit'],
41
- ['explicit', 'anonymous'],
42
- ['anonymous', 'anonymous'],
43
- ];
44
- let env;
45
- let masterApi;
46
- let masterUser;
47
- const primitives = new icc_x_api_1.WebCryptoPrimitives(crypto_1.webcrypto);
48
- describe('Anonymous delegations', () => {
49
- (0, mocha_1.before)(function () {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- this.timeout(6000000);
52
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
53
- env = yield initializer.execute((0, types_1.getEnvVariables)());
54
- masterApi = yield initMasterApi(env);
55
- masterUser = yield masterApi.userApi.getCurrentUser();
56
- });
57
- });
58
- function createUserAndApi(userType) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- const dataOwner = userType === 'explicit'
61
- ? yield masterApi.healthcarePartyApi.createHealthcareParty(new HealthcareParty_1.HealthcareParty({ id: (0, uuid_1.v4)(), firstName: 'test', lastName: 'test' }))
62
- : yield masterApi.patientApi.createPatientWithUser(masterUser, yield masterApi.patientApi.newInstance(masterUser, new Patient_1.Patient({ id: (0, uuid_1.v4)(), firstName: 'test', lastName: 'test' })));
63
- const login = (0, uuid_1.v4)();
64
- const user = yield masterApi.userApi.createUser(new User_1.User({
65
- id: login,
66
- name: login,
67
- login: login,
68
- email: (0, test_utils_1.getTempEmail)(),
69
- status: 'ACTIVE',
70
- healthcarePartyId: userType === 'explicit' ? dataOwner.id : undefined,
71
- patientId: userType === 'anonymous' ? dataOwner.id : undefined,
72
- }));
73
- const pw = yield masterApi.userApi.getToken(user.id, (0, uuid_1.v4)());
74
- return {
75
- api: yield (0, TestApi_1.TestApi)(env.iCureUrl, login, pw, crypto_1.webcrypto),
76
- userInfo: { user, pw, dataOwnerId: dataOwner.id },
77
- };
78
- });
79
- }
80
- function dataOwnerIdsForSearch(apis, dataOwnerId, entityType) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- const delegationKeys = yield apis.cryptoApi.exchangeData.getAllDelegationKeys(entityType);
83
- if (delegationKeys) {
84
- return delegationKeys;
85
- }
86
- else {
87
- return [dataOwnerId];
88
- }
89
- });
90
- }
91
- function loseKeyAndGiveAccessBack(userThatLosesKey, apiToGiveAccessBack, userGivingAccessBack) {
92
- return __awaiter(this, void 0, void 0, function* () {
93
- const timeBeforeNewKey = new Date().getTime();
94
- const newKeyPair = yield primitives.RSA.generateKeyPair(icc_x_api_1.ShaVersion.Sha256);
95
- const newApi = yield (0, TestApi_1.TestApi)(env.iCureUrl, userThatLosesKey.user.login, userThatLosesKey.pw, crypto_1.webcrypto, newKeyPair, {
96
- createMaintenanceTasksOnNewKey: false,
97
- });
98
- yield newApi.icureMaintenanceTaskApi.createMaintenanceTasksForNewKeypair(userThatLosesKey.user, newKeyPair, [
99
- DataOwnerTypeEnum_1.DataOwnerTypeEnum.Patient,
100
- DataOwnerTypeEnum_1.DataOwnerTypeEnum.Hcp,
101
- ]);
102
- yield apiToGiveAccessBack.cryptoApi.forceReload();
103
- const searchIds = yield dataOwnerIdsForSearch(apiToGiveAccessBack, userGivingAccessBack.dataOwnerId, icc_x_api_1.EntityWithDelegationTypeName.MaintenanceTask);
104
- const keyPairUpdateRequests = yield searchIds
105
- .reduce((acc, searchId) => __awaiter(this, void 0, void 0, function* () {
106
- const awaitedAcc = yield acc;
107
- const currResult = yield apiToGiveAccessBack.maintenanceTaskApi.filterMaintenanceTasksByWithUser(userGivingAccessBack.user, undefined, undefined, new FilterChainMaintenanceTask_1.FilterChainMaintenanceTask({
108
- filter: new MaintenanceTaskAfterDateFilter_1.MaintenanceTaskAfterDateFilter({
109
- date: timeBeforeNewKey,
110
- healthcarePartyId: searchId,
111
- }),
112
- }));
113
- return [...awaitedAcc, ...currResult.rows];
114
- }), Promise.resolve([]))
115
- .then((tasks) => tasks.map((task) => KeyPairUpdateRequest_1.KeyPairUpdateRequest.fromMaintenanceTask(task)));
116
- const concernedRequest = keyPairUpdateRequests.filter((x) => x.concernedDataOwnerId === userThatLosesKey.dataOwnerId);
117
- (0, chai_1.expect)(concernedRequest).to.have.length(1);
118
- yield apiToGiveAccessBack.icureMaintenanceTaskApi.applyKeyPairUpdate(concernedRequest[0]);
119
- yield newApi.cryptoApi.forceReload();
120
- return newApi;
121
- });
122
- }
123
- function createAndShareData(creatorApis, creatorInfo, delegateInfo) {
124
- return __awaiter(this, void 0, void 0, function* () {
125
- const patient = yield masterApi.patientApi.createPatientWithUser(masterUser, yield masterApi.patientApi.newInstance(masterUser, new Patient_1.Patient({ id: (0, uuid_1.v4)(), firstName: 'test', lastName: 'test', note: 'Patient note' })));
126
- const secretIds = yield masterApi.patientApi.decryptSecretIdsOf(patient);
127
- const updatedPatient1 = yield masterApi.patientApi.shareWith(creatorInfo.dataOwnerId, patient, secretIds, { requestedPermissions: FULL_WRITE });
128
- yield creatorApis.cryptoApi.forceReload();
129
- const updatedPatient2 = yield creatorApis.patientApi.shareWith(delegateInfo.dataOwnerId, updatedPatient1, secretIds, {
130
- requestedPermissions: FULL_WRITE,
131
- });
132
- const healthElements = [];
133
- for (let i = 0; i < 5; i++) {
134
- const he = yield creatorApis.healthcareElementApi.createHealthElementWithUser(creatorInfo.user, yield creatorApis.healthcareElementApi.newInstance(creatorInfo.user, updatedPatient2, { note: `Health element note - ${i}` }));
135
- const sharedHe = yield creatorApis.healthcareElementApi.shareWith(delegateInfo.dataOwnerId, he, { requestedPermissions: FULL_WRITE });
136
- healthElements.push(sharedHe);
137
- }
138
- (0, chai_1.expect)(updatedPatient2.note).to.not.be.undefined;
139
- for (const he of healthElements) {
140
- (0, chai_1.expect)(he.note).to.not.be.undefined;
141
- }
142
- return { patient: updatedPatient2, healthElements };
143
- });
144
- }
145
- function checkCanFindAndDecrypt(apis, expected) {
146
- return __awaiter(this, void 0, void 0, function* () {
147
- const user = yield apis.userApi.getCurrentUser();
148
- const patient = yield apis.patientApi.getPatientWithUser(user, expected.patient.id);
149
- (0, chai_1.expect)(patient.note).to.equal(expected.patient.note);
150
- const searchIds = yield dataOwnerIdsForSearch(apis, apis.dataOwnerApi.getDataOwnerIdOf(user), icc_x_api_1.EntityWithDelegationTypeName.HealthElement);
151
- const patientKeys = yield apis.patientApi.decryptSecretIdsOf(patient);
152
- (0, chai_1.expect)(patientKeys).to.not.be.empty;
153
- const sfks = _.uniq(patientKeys).join(',');
154
- const retrievedHealthElements = _.uniqBy(yield searchIds.reduce((acc, searchId) => __awaiter(this, void 0, void 0, function* () {
155
- const awaitedAcc = yield acc;
156
- const currResult = yield apis.healthcareElementApi.findByHCPartyPatientSecretFKeys(searchId, sfks);
157
- return [...awaitedAcc, ...currResult];
158
- }), Promise.resolve([])), (x) => x.id);
159
- (0, chai_1.expect)(retrievedHealthElements.length).to.equal(expected.healthElements.length);
160
- for (const expectedHe of expected.healthElements) {
161
- const retrievedHe = retrievedHealthElements.find((x) => x.id === expectedHe.id);
162
- (0, chai_1.expect)(retrievedHe).to.not.be.undefined;
163
- (0, chai_1.expect)(retrievedHe.note).to.equal(expectedHe.note);
164
- }
165
- });
166
- }
167
- function checkAccessInfo(actualAccessInfo, expectedDataOwnersWithAccess, expectedHasUnknownAnonymousDataOwners) {
168
- return __awaiter(this, void 0, void 0, function* () {
169
- (0, chai_1.expect)(Object.keys(actualAccessInfo.permissionsByDataOwnerId)).to.have.members(Object.keys(expectedDataOwnersWithAccess));
170
- (0, chai_1.expect)(actualAccessInfo.hasUnknownAnonymousDataOwners).to.equal(expectedHasUnknownAnonymousDataOwners);
171
- for (const [dataOwnerId, expectedLevel] of Object.entries(expectedDataOwnersWithAccess)) {
172
- (0, chai_1.expect)(actualAccessInfo.permissionsByDataOwnerId[dataOwnerId]).to.equal(expectedLevel);
173
- }
174
- });
175
- }
176
- it('without de-anonymisation metadata the data owners should be able to identify anonymous delegates only if they are part of the delegation with that delegate.', () => __awaiter(void 0, void 0, void 0, function* () {
177
- const apiA = yield createUserAndApi('explicit');
178
- const apiB = yield createUserAndApi('explicit');
179
- const apiP1 = yield createUserAndApi('anonymous');
180
- const apiP2 = yield createUserAndApi('anonymous');
181
- let entity = yield apiA.api.calendarItemApi.createCalendarItemWithHcParty(apiA.userInfo.user, yield apiA.api.calendarItemApi.newInstance(apiA.userInfo.user, { note: 'Calendar item note' }));
182
- /*
183
- * A->A
184
- */
185
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), { [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE }, false);
186
- entity = yield apiA.api.calendarItemApi.shareWith(apiB.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
187
- /*
188
- * A->A A->B
189
- */
190
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
191
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
192
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
193
- }, false);
194
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
195
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
196
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
197
- }, false);
198
- /*
199
- * A->A A->B
200
- * A->P1
201
- */
202
- entity = yield apiA.api.calendarItemApi.shareWith(apiP1.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
203
- yield apiP1.api.cryptoApi.forceReload();
204
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
205
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
206
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
207
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
208
- }, false);
209
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
210
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
211
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
212
- }, true);
213
- yield checkAccessInfo(yield apiP1.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
214
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
215
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
216
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
217
- }, false);
218
- /*
219
- * A->A A->B B->P1
220
- * A->P1
221
- */
222
- entity = yield apiB.api.calendarItemApi.shareWith(apiP1.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_READ });
223
- yield apiP1.api.cryptoApi.forceReload();
224
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
225
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
226
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
227
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
228
- }, true);
229
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
230
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
231
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
232
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.READ,
233
- }, true);
234
- yield checkAccessInfo(yield apiP1.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
235
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
236
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
237
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
238
- }, false);
239
- /*
240
- * A->A A->B B->P1
241
- * A->P1 P1->P2
242
- */
243
- entity = yield apiP1.api.calendarItemApi.shareWith(apiP2.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_READ });
244
- yield apiP2.api.cryptoApi.forceReload();
245
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
246
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
247
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
248
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
249
- }, true);
250
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
251
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
252
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
253
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.READ,
254
- }, true);
255
- yield checkAccessInfo(yield apiP1.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
256
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
257
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
258
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
259
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.READ,
260
- }, false);
261
- yield checkAccessInfo(yield apiP2.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
262
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
263
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
264
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.READ, // P2 is only aware of the P1->P2 delegation
265
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.READ,
266
- }, true);
267
- /*
268
- * A->A A->B B->P1
269
- * A->P1 P1->P2
270
- * A->P2
271
- */
272
- entity = yield apiA.api.calendarItemApi.shareWith(apiP2.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
273
- yield apiP2.api.cryptoApi.forceReload();
274
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
275
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
276
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
277
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
278
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
279
- }, true);
280
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
281
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
282
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
283
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.READ,
284
- }, true);
285
- yield checkAccessInfo(yield apiP1.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
286
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
287
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
288
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
289
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.READ,
290
- }, true);
291
- yield checkAccessInfo(yield apiP2.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
292
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
293
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
294
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.READ, // P2 is only aware of the P1->P2 delegation
295
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
296
- }, true);
297
- }));
298
- it('without de-anonymisation metadata the data owners should be able to identify anonymous delegates only if their parent is part of the delegation with that delegate.', () => __awaiter(void 0, void 0, void 0, function* () {
299
- const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env); // Want to use only hcp with one parent
300
- const patientInfo = yield createUserAndApi('anonymous');
301
- let entity = yield parentApi.messageApi.createMessageWithUser(parentUser, yield parentApi.messageApi.newInstanceWithPatient(parentUser, null, { subject: 'A simple subject' }));
302
- entity = yield parentApi.messageApi.shareWith(patientInfo.userInfo.dataOwnerId, entity, [], { requestedPermissions: FULL_WRITE });
303
- yield patientInfo.api.cryptoApi.forceReload();
304
- const expectedAccess = {
305
- // No child user: has no direct access, only access through parent delegation
306
- [parentUser.healthcarePartyId]: AccessLevelEnum.WRITE,
307
- [patientInfo.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
308
- };
309
- yield checkAccessInfo(yield childApi.messageApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
310
- yield checkAccessInfo(yield parentApi.messageApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
311
- yield checkAccessInfo(yield patientInfo.api.messageApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
312
- }));
313
- it('de-anonymisation metadata should allow data owners that are not part of a delegation to figure out the members of that delegation.', () => __awaiter(void 0, void 0, void 0, function* () {
314
- const apiA = yield createUserAndApi('explicit');
315
- const apiB = yield createUserAndApi('explicit');
316
- const apiP1 = yield createUserAndApi('anonymous');
317
- const apiP2 = yield createUserAndApi('anonymous');
318
- let entity = yield apiA.api.calendarItemApi.createCalendarItemWithHcParty(apiA.userInfo.user, yield apiA.api.calendarItemApi.newInstance(apiA.userInfo.user, { note: 'Calendar item note' }));
319
- entity = yield apiA.api.calendarItemApi.shareWith(apiB.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
320
- entity = yield apiA.api.calendarItemApi.shareWith(apiP1.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
321
- entity = yield apiB.api.calendarItemApi.shareWith(apiP1.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_READ });
322
- yield apiP1.api.cryptoApi.forceReload();
323
- entity = yield apiP1.api.calendarItemApi.shareWith(apiP2.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_READ });
324
- entity = yield apiA.api.calendarItemApi.shareWith(apiP2.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
325
- /*
326
- * A->A A->B B->?P1
327
- * A->?P1 P1->?P2
328
- * A->?P2
329
- */
330
- yield apiA.api.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiB.userInfo.dataOwnerId, apiP1.userInfo.dataOwnerId, apiP2.userInfo.dataOwnerId]);
331
- /*
332
- * A can create de-anonymization metadata for his delegations.
333
- * A->A A->B B->?P1
334
- * A->P1 P1->?P2
335
- * A->P2
336
- */
337
- yield apiP1.api.cryptoApi.forceReload();
338
- yield apiP2.api.cryptoApi.forceReload();
339
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
340
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
341
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
342
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
343
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
344
- }, true);
345
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
346
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
347
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
348
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
349
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
350
- }, true);
351
- yield checkAccessInfo(yield apiP1.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
352
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
353
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
354
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
355
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
356
- }, false);
357
- yield checkAccessInfo(yield apiP2.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
358
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
359
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
360
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
361
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
362
- }, true);
363
- yield apiP1.api.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiB.userInfo.dataOwnerId, apiA.userInfo.dataOwnerId, apiP2.userInfo.dataOwnerId]);
364
- /* Both delegator and delegate can create de-anonymization metadata for a delegation.
365
- * A->A A->B B->P1
366
- * A->P1 P1->P2
367
- * A->P2
368
- */
369
- yield apiP1.api.cryptoApi.forceReload();
370
- yield apiP2.api.cryptoApi.forceReload();
371
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
372
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
373
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
374
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
375
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
376
- }, false);
377
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
378
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
379
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
380
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
381
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
382
- }, false);
383
- yield checkAccessInfo(yield apiP1.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
384
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
385
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
386
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
387
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
388
- }, false);
389
- yield checkAccessInfo(yield apiP2.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
390
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
391
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
392
- [apiP1.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
393
- [apiP2.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
394
- }, false);
395
- }));
396
- it('Hcp should be able to use de-anonymization metadata for parent', () => __awaiter(void 0, void 0, void 0, function* () {
397
- const hierarchy = yield (0, test_utils_1.createHcpHierarchyApis)(env);
398
- const patientInfo = yield createUserAndApi('anonymous');
399
- let entity = yield hierarchy.parentApi.calendarItemApi.createCalendarItemWithHcParty(hierarchy.parentUser, yield hierarchy.parentApi.calendarItemApi.newInstance(hierarchy.parentUser, { note: 'Calendar item note' })); // Auto-shared with grandApi, but no de-anonymization metadata
400
- entity = yield hierarchy.parentApi.calendarItemApi.shareWith(patientInfo.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
401
- yield hierarchy.parentApi.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [hierarchy.grandUser.healthcarePartyId]);
402
- yield patientInfo.api.cryptoApi.forceReload();
403
- const expectedAccess = {
404
- [hierarchy.parentUser.healthcarePartyId]: AccessLevelEnum.WRITE,
405
- [hierarchy.grandUser.healthcarePartyId]: AccessLevelEnum.WRITE,
406
- [patientInfo.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
407
- };
408
- yield checkAccessInfo(yield hierarchy.parentApi.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
409
- yield checkAccessInfo(yield hierarchy.grandApi.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
410
- yield checkAccessInfo(yield hierarchy.child2Api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
411
- yield checkAccessInfo(yield patientInfo.api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
412
- }));
413
- it('De-anonymization metadata should encrypt delegator and delegate, and its creation should be optimised', () => __awaiter(void 0, void 0, void 0, function* () {
414
- const apiA = yield createUserAndApi('explicit');
415
- const apiB = yield createUserAndApi('explicit');
416
- const apiP = yield createUserAndApi('anonymous');
417
- let entity = yield apiA.api.calendarItemApi.createCalendarItemWithHcParty(apiA.userInfo.user, yield apiA.api.calendarItemApi.newInstance(apiA.userInfo.user, { note: 'Calendar item note' }));
418
- entity = yield apiA.api.calendarItemApi.shareWith(apiB.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
419
- entity = yield apiA.api.calendarItemApi.shareWith(apiP.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
420
- yield apiA.api.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiB.userInfo.dataOwnerId, apiP.userInfo.dataOwnerId]);
421
- const secureDelegationKeyMapApi = new IccSecureDelegationKeyMapApi_1.IccSecureDelegationKeyMapApi(env.iCureUrl, {}, apiA.api.authApi.authenticationProvider, fetch);
422
- const secureDelegationKeyMaps = yield secureDelegationKeyMapApi.getByDelegationKeys({ ids: Object.keys(entity.securityMetadata.secureDelegations) }, []);
423
- (0, chai_1.expect)(secureDelegationKeyMaps).to.have.length(1); // Only 1 is necessary -> only 1 is created
424
- (0, chai_1.expect)(secureDelegationKeyMaps[0].delegator).to.be.undefined;
425
- (0, chai_1.expect)(secureDelegationKeyMaps[0].delegate).to.be.undefined;
426
- const delegationKeyToPatient = Object.entries(entity.securityMetadata.secureDelegations).find(([_, v]) => v.delegate === undefined)[0];
427
- (0, chai_1.expect)(delegationKeyToPatient).to.not.be.undefined;
428
- (0, chai_1.expect)(delegationKeyToPatient).to.not.be.empty;
429
- (0, chai_1.expect)(secureDelegationKeyMaps[0].delegationKey).to.equal(delegationKeyToPatient);
430
- }));
431
- it('De-anonymization metadata should be usable for different entities of the same type', () => __awaiter(void 0, void 0, void 0, function* () {
432
- const apiA = yield createUserAndApi('explicit');
433
- const apiB = yield createUserAndApi('explicit');
434
- const apiP = yield createUserAndApi('anonymous');
435
- let entity1 = yield apiA.api.calendarItemApi.createCalendarItemWithHcParty(apiA.userInfo.user, yield apiA.api.calendarItemApi.newInstance(apiA.userInfo.user, { note: 'Calendar item note' }));
436
- entity1 = yield apiA.api.calendarItemApi.shareWith(apiB.userInfo.dataOwnerId, entity1, { requestedPermissions: FULL_WRITE });
437
- entity1 = yield apiA.api.calendarItemApi.shareWith(apiP.userInfo.dataOwnerId, entity1, { requestedPermissions: FULL_WRITE });
438
- let entity2 = yield apiA.api.calendarItemApi.createCalendarItemWithHcParty(apiA.userInfo.user, yield apiA.api.calendarItemApi.newInstance(apiA.userInfo.user, { note: 'Calendar item note' }));
439
- entity2 = yield apiA.api.calendarItemApi.shareWith(apiB.userInfo.dataOwnerId, entity2, { requestedPermissions: FULL_WRITE });
440
- entity2 = yield apiA.api.calendarItemApi.shareWith(apiP.userInfo.dataOwnerId, entity2, { requestedPermissions: FULL_WRITE });
441
- yield apiA.api.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity: entity1, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiB.userInfo.dataOwnerId]);
442
- const expectedAccess = {
443
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
444
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
445
- [apiP.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
446
- };
447
- yield apiP.api.cryptoApi.forceReload();
448
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity1), expectedAccess, false);
449
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity1), expectedAccess, false);
450
- yield checkAccessInfo(yield apiP.api.calendarItemApi.getDataOwnersWithAccessTo(entity1), expectedAccess, false);
451
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity2), expectedAccess, false);
452
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity2), expectedAccess, false);
453
- yield checkAccessInfo(yield apiP.api.calendarItemApi.getDataOwnersWithAccessTo(entity2), expectedAccess, false);
454
- }));
455
- it('De-anonymization metadata optimization: the metadata should not be re-shared with the anonymous delegator/delegate by third parties', () => __awaiter(void 0, void 0, void 0, function* () {
456
- const apiP1 = yield createUserAndApi('anonymous');
457
- const apiP2 = yield createUserAndApi('anonymous');
458
- const apiA = yield createUserAndApi('explicit');
459
- let entity = yield apiP1.api.calendarItemApi.createCalendarItemWithHcParty(apiP1.userInfo.user, yield apiP1.api.calendarItemApi.newInstance(apiP1.userInfo.user, { note: 'Calendar item note' }));
460
- entity = yield apiP1.api.calendarItemApi.shareWith(apiP2.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
461
- entity = yield apiP1.api.calendarItemApi.shareWith(apiA.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
462
- yield apiP1.api.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiP2.userInfo.dataOwnerId, apiA.userInfo.dataOwnerId]);
463
- const p1ToP2DelegationKey = Object.entries(entity.securityMetadata.secureDelegations).find(([_, v]) => v.delegate === undefined && v.delegator === undefined && v.parentDelegations !== undefined)[0];
464
- (0, chai_1.expect)(p1ToP2DelegationKey).to.not.be.undefined;
465
- (0, chai_1.expect)(p1ToP2DelegationKey).to.not.be.empty;
466
- const delegationMapApi = new IccSecureDelegationKeyMapApi_1.IccSecureDelegationKeyMapApi(env.iCureUrl, {}, apiA.api.authApi.authenticationProvider, fetch);
467
- const delegationMapBeforeAttemptedResharingByA = (yield delegationMapApi.getByDelegationKeys({ ids: [p1ToP2DelegationKey] }, []))[0];
468
- (0, chai_1.expect)(delegationMapBeforeAttemptedResharingByA).to.not.be.undefined;
469
- (0, chai_1.expect)(Object.keys(delegationMapBeforeAttemptedResharingByA.securityMetadata.secureDelegations)).to.have.length(3);
470
- yield apiA.api.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiP2.userInfo.dataOwnerId, apiP1.userInfo.dataOwnerId]);
471
- const delegationMapAfterAttemptedResharingByA = (yield delegationMapApi.getByDelegationKeys({ ids: [p1ToP2DelegationKey] }, []))[0];
472
- (0, chai_1.expect)(delegationMapAfterAttemptedResharingByA).to.not.be.undefined;
473
- (0, chai_1.expect)(Object.keys(delegationMapAfterAttemptedResharingByA.securityMetadata.secureDelegations)).to.have.length(3);
474
- (0, chai_1.expect)(delegationMapAfterAttemptedResharingByA.rev).to.equal(delegationMapBeforeAttemptedResharingByA.rev);
475
- }));
476
- it('De-anonymization metadata should be shared only with selected data owners', () => __awaiter(void 0, void 0, void 0, function* () {
477
- const apiA = yield createUserAndApi('explicit');
478
- const apiB = yield createUserAndApi('explicit');
479
- const apiC = yield createUserAndApi('explicit');
480
- const apiP = yield createUserAndApi('anonymous');
481
- let entity = yield apiA.api.calendarItemApi.createCalendarItemWithHcParty(apiA.userInfo.user, yield apiA.api.calendarItemApi.newInstance(apiA.userInfo.user, { note: 'Calendar item note' }));
482
- entity = yield apiA.api.calendarItemApi.shareWith(apiB.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
483
- entity = yield apiA.api.calendarItemApi.shareWith(apiC.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
484
- entity = yield apiA.api.calendarItemApi.shareWith(apiP.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
485
- yield apiA.api.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiB.userInfo.dataOwnerId]);
486
- const expectedAccess = {
487
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
488
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
489
- [apiC.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
490
- [apiP.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
491
- };
492
- yield apiP.api.cryptoApi.forceReload();
493
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
494
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
495
- yield checkAccessInfo(yield apiP.api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
496
- // Except C does not know about P, because he was not given access to the relevant metadata.
497
- yield checkAccessInfo(yield apiC.api.calendarItemApi.getDataOwnersWithAccessTo(entity), {
498
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
499
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
500
- [apiC.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
501
- }, true);
502
- }));
503
- it('A member of a delegation should be able to update the corresponding de-anonymization metadata even if he was not the original creator', () => __awaiter(void 0, void 0, void 0, function* () {
504
- const hierarchy = yield (0, test_utils_1.createHcpHierarchyApis)(env);
505
- const apiA = yield createUserAndApi('explicit');
506
- const apiB = yield createUserAndApi('explicit');
507
- const apiC = yield createUserAndApi('explicit');
508
- const apiP = yield createUserAndApi('anonymous');
509
- // Parent -> A, B, C, P
510
- let entity = yield hierarchy.grandApi.calendarItemApi.createCalendarItemWithHcParty(hierarchy.grandUser, yield hierarchy.grandApi.calendarItemApi.newInstance(hierarchy.grandUser, { note: 'Calendar item note' }));
511
- entity = yield hierarchy.grandApi.calendarItemApi.shareWith(apiA.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
512
- entity = yield hierarchy.grandApi.calendarItemApi.shareWith(apiB.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
513
- entity = yield hierarchy.grandApi.calendarItemApi.shareWith(apiC.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
514
- entity = yield hierarchy.grandApi.calendarItemApi.shareWith(apiP.userInfo.dataOwnerId, entity, { requestedPermissions: FULL_WRITE });
515
- // Child shares deanon info with A
516
- yield hierarchy.parentApi.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiA.userInfo.dataOwnerId]);
517
- // P shares with B
518
- yield apiP.api.cryptoApi.forceReload();
519
- yield apiP.api.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiB.userInfo.dataOwnerId]);
520
- // Parent shares with C
521
- yield hierarchy.grandApi.cryptoApi.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: icc_x_api_1.EntityWithDelegationTypeName.CalendarItem }, [apiC.userInfo.dataOwnerId]);
522
- const expectedAccess = {
523
- [hierarchy.grandUser.healthcarePartyId]: AccessLevelEnum.WRITE,
524
- [apiA.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
525
- [apiB.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
526
- [apiC.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
527
- [apiP.userInfo.dataOwnerId]: AccessLevelEnum.WRITE,
528
- };
529
- yield checkAccessInfo(yield hierarchy.grandApi.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
530
- yield checkAccessInfo(yield hierarchy.parentApi.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
531
- yield checkAccessInfo(yield apiA.api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
532
- yield checkAccessInfo(yield apiB.api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
533
- yield checkAccessInfo(yield apiC.api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
534
- yield checkAccessInfo(yield apiP.api.calendarItemApi.getDataOwnersWithAccessTo(entity), expectedAccess, false);
535
- const delegationKeyMapApi = new IccSecureDelegationKeyMapApi_1.IccSecureDelegationKeyMapApi(env.iCureUrl, {}, hierarchy.grandApi.authApi.authenticationProvider, fetch);
536
- const delegationKeyToP = Object.entries(entity.securityMetadata.secureDelegations).find(([_, v]) => v.delegate === undefined)[0];
537
- (0, chai_1.expect)(delegationKeyToP).to.not.be.undefined;
538
- (0, chai_1.expect)(delegationKeyToP).to.not.be.empty;
539
- const delegationKeyMaps = yield delegationKeyMapApi.getByDelegationKeys({ ids: Object.keys(entity.securityMetadata.secureDelegations) }, []);
540
- (0, chai_1.expect)(delegationKeyMaps).to.have.length(1); // Only 1 anonymous, shared by everyone
541
- }));
542
- typeCombinations.forEach(([delegatorType, delegateType]) => {
543
- it(`should allow delegate to find and decrypt an entity shared with him (${delegatorType}->${delegateType})`, () => __awaiter(void 0, void 0, void 0, function* () {
544
- const delegatorApi = yield createUserAndApi(delegatorType);
545
- const delegateApi = yield createUserAndApi(delegateType);
546
- const data = yield createAndShareData(delegatorApi.api, delegatorApi.userInfo, delegateApi.userInfo);
547
- yield delegateApi.api.cryptoApi.forceReload();
548
- yield checkCanFindAndDecrypt(delegateApi.api, data);
549
- yield checkCanFindAndDecrypt(delegatorApi.api, data);
550
- }));
551
- it(`should allow delegator to find and decrypt an entity shared with others after give-access-back (${delegatorType}->${delegateType})`, function () {
552
- return __awaiter(this, void 0, void 0, function* () {
553
- if (delegatorType == delegateType || delegatorType != 'explicit') {
554
- const delegatorApi = yield createUserAndApi(delegatorType);
555
- const delegateApi = yield createUserAndApi(delegateType);
556
- const data = yield createAndShareData(delegatorApi.api, delegatorApi.userInfo, delegateApi.userInfo);
557
- const delegatorApiAfterGiveAccessBack = yield loseKeyAndGiveAccessBack(delegatorApi.userInfo, delegateApi.api, delegateApi.userInfo);
558
- yield delegateApi.api.cryptoApi.forceReload();
559
- yield checkCanFindAndDecrypt(delegateApi.api, data);
560
- yield checkCanFindAndDecrypt(delegatorApi.api, data);
561
- yield checkCanFindAndDecrypt(delegatorApiAfterGiveAccessBack, data);
562
- }
563
- else {
564
- console.warn('Currently not supported, will be in future');
565
- }
566
- });
567
- });
568
- it(`should allow delegate to find and decrypt an entity shared with him after give-access-back (${delegatorType}->${delegateType})`, function () {
569
- return __awaiter(this, void 0, void 0, function* () {
570
- if (delegatorType == delegateType || delegateType != 'explicit') {
571
- const delegatorApi = yield createUserAndApi(delegatorType);
572
- const delegateApi = yield createUserAndApi(delegateType);
573
- const data = yield createAndShareData(delegatorApi.api, delegatorApi.userInfo, delegateApi.userInfo);
574
- const delegateApiAfterGiveAccessBack = yield loseKeyAndGiveAccessBack(delegateApi.userInfo, delegatorApi.api, delegatorApi.userInfo);
575
- yield delegateApi.api.cryptoApi.forceReload();
576
- yield checkCanFindAndDecrypt(delegateApi.api, data);
577
- yield checkCanFindAndDecrypt(delegatorApi.api, data);
578
- yield checkCanFindAndDecrypt(delegateApiAfterGiveAccessBack, data);
579
- }
580
- else {
581
- console.warn('Currently not supported, will be in future');
582
- }
583
- });
584
- });
585
- });
586
- });
587
- //# sourceMappingURL=anonymous-delegations-test.js.map