@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,402 +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
- require("isomorphic-fetch");
13
- const chai_1 = require("chai");
14
- require("mocha");
15
- const Patient_1 = require("../../../icc-api/model/Patient");
16
- const test_utils_1 = require("../../utils/test_utils");
17
- const types_1 = require("@icure/test-setup/types");
18
- const icc_x_api_1 = require("../../../icc-x-api");
19
- var initApi = test_utils_1.TestUtils.initApi;
20
- const SecretIdUseOption_1 = require("../../../icc-x-api/crypto/SecretIdUseOption");
21
- var UseAnyConfidential = SecretIdUseOption_1.SecretIdUseOption.UseAnyConfidential;
22
- const icc_api_1 = require("../../../icc-api");
23
- const crypto_1 = require("crypto");
24
- (0, chai_1.use)(require('chai-as-promised'));
25
- let env;
26
- (0, test_utils_1.setLocalStorage)(fetch);
27
- describe('Create a patient from scratch', () => {
28
- before(function () {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- this.timeout(600000);
31
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
32
- env = yield initializer.execute((0, types_1.getEnvVariables)());
33
- });
34
- });
35
- it('should create a patient in the database', () => __awaiter(void 0, void 0, void 0, function* () {
36
- const api = yield initApi(env, test_utils_1.hcp1Username);
37
- const user = yield api.userApi.getCurrentUser();
38
- const note = 'A secured note that is encrypted';
39
- const patient = yield api.patientApi.createPatientWithUser(user, yield api.patientApi.newInstance(user, new Patient_1.Patient({
40
- lastName: 'Biden',
41
- firstName: 'Joe',
42
- note,
43
- })));
44
- (0, chai_1.expect)(patient.note).to.equal(note);
45
- console.log(`Created patient (decrypted): ${patient.id}: ${patient.firstName} ${patient.lastName} [note:${patient.note}, encryptedSelf:${patient.encryptedSelf}]`);
46
- const fetched = yield api.patientApi.getPatientWithUser(user, patient.id);
47
- console.log(`Fetched patient (decrypted): ${fetched.id}: ${fetched.firstName} ${fetched.lastName} [note:${fetched.note}, encryptedSelf:${fetched.encryptedSelf}]`);
48
- (0, chai_1.expect)(fetched.id).to.equal(patient.id);
49
- (0, chai_1.expect)(fetched.note).to.equal(note);
50
- const fetchedWithoutDecryption = yield new icc_api_1.IccPatientApi(env.iCureUrl, {}, new icc_x_api_1.BasicAuthenticationProvider(env.dataOwnerDetails[test_utils_1.hcp1Username].user, env.dataOwnerDetails[test_utils_1.hcp1Username].password), fetch).getPatient(patient.id);
51
- console.log(`Fetched patient (encrypted):${fetchedWithoutDecryption.id}: ${fetchedWithoutDecryption.firstName} ${fetchedWithoutDecryption.lastName} [note: ${fetchedWithoutDecryption.note}]`);
52
- (0, chai_1.expect)(fetchedWithoutDecryption.id).to.equal(patient.id);
53
- (0, chai_1.expect)(fetchedWithoutDecryption.note).to.be.undefined;
54
- }));
55
- });
56
- describe('Entity encryption', () => __awaiter(void 0, void 0, void 0, function* () {
57
- it('encrypted self should not change after re-encryption if encrypted data do not change', () => __awaiter(void 0, void 0, void 0, function* () {
58
- const api = yield initApi(env, test_utils_1.hcp1Username);
59
- const user = yield api.userApi.getCurrentUser();
60
- const note = 'A secured note that is encrypted';
61
- const patient = yield api.patientApi.createPatientWithUser(user, yield api.patientApi.newInstance(user, new Patient_1.Patient({
62
- lastName: 'Biden',
63
- firstName: 'Joe',
64
- note,
65
- })));
66
- (0, chai_1.expect)(patient.note).to.equal(note);
67
- (0, chai_1.expect)(patient.encryptedSelf).to.not.be.empty;
68
- const updatedPatient = yield api.patientApi.modifyPatientWithUser(user, Object.assign(Object.assign({}, patient), { firstName: 'John' }));
69
- (0, chai_1.expect)(updatedPatient === null || updatedPatient === void 0 ? void 0 : updatedPatient.firstName).to.equal('John');
70
- (0, chai_1.expect)(updatedPatient === null || updatedPatient === void 0 ? void 0 : updatedPatient.note).to.equal(patient.note);
71
- (0, chai_1.expect)(updatedPatient === null || updatedPatient === void 0 ? void 0 : updatedPatient.encryptedSelf).to.equal(patient.encryptedSelf);
72
- const contactWithBasicContent = (yield api.contactApi.createContactWithUser(user, yield api.contactApi.newInstance(user, patient, {
73
- services: [
74
- {
75
- id: (0, crypto_1.randomUUID)(),
76
- valueDate: 20250101000000,
77
- content: {
78
- en: {
79
- stringValue: 'A service with only basic content',
80
- numberValue: 1234,
81
- },
82
- },
83
- },
84
- ],
85
- descr: 'Demo',
86
- })));
87
- (0, chai_1.expect)(contactWithBasicContent.encryptedSelf).to.not.be.empty;
88
- (0, chai_1.expect)(contactWithBasicContent.services[0].encryptedSelf).to.not.be.empty;
89
- const updatedContactWithBasicContent = yield api.contactApi.modifyContactWithUser(user, Object.assign(Object.assign({}, contactWithBasicContent), { services: [
90
- Object.assign(Object.assign({}, contactWithBasicContent.services[0]), { valueDate: 20250101120000 }),
91
- ] }));
92
- (0, chai_1.expect)(updatedContactWithBasicContent === null || updatedContactWithBasicContent === void 0 ? void 0 : updatedContactWithBasicContent.services[0].valueDate).to.equal(20250101120000);
93
- (0, chai_1.expect)(updatedContactWithBasicContent === null || updatedContactWithBasicContent === void 0 ? void 0 : updatedContactWithBasicContent.services[0].encryptedSelf).to.equal(contactWithBasicContent.services[0].encryptedSelf);
94
- (0, chai_1.expect)(updatedContactWithBasicContent === null || updatedContactWithBasicContent === void 0 ? void 0 : updatedContactWithBasicContent.encryptedSelf).to.equal(contactWithBasicContent.encryptedSelf);
95
- const contactWithCompoundContent = (yield api.contactApi.createContactWithUser(user, yield api.contactApi.newInstance(user, patient, {
96
- services: [
97
- {
98
- id: (0, crypto_1.randomUUID)(),
99
- valueDate: 20250101000000,
100
- content: {
101
- en: {
102
- compoundValue: [
103
- {
104
- id: (0, crypto_1.randomUUID)(),
105
- content: {
106
- en: {
107
- stringValue: 'Compound service sub 1',
108
- numberValue: 1,
109
- },
110
- },
111
- comment: 'A comment on the compound service sub 1',
112
- },
113
- {
114
- id: (0, crypto_1.randomUUID)(),
115
- content: {
116
- en: {
117
- stringValue: 'Compound service sub 2',
118
- numberValue: 2,
119
- },
120
- },
121
- comment: 'A comment on the compound service sub 2',
122
- },
123
- ],
124
- },
125
- },
126
- },
127
- ],
128
- descr: 'Demo 2',
129
- })));
130
- (0, chai_1.expect)(contactWithCompoundContent.encryptedSelf).to.not.be.empty;
131
- (0, chai_1.expect)(contactWithCompoundContent.services[0].encryptedSelf).to.not.be.empty; // Still going to encrypt {}
132
- (0, chai_1.expect)(contactWithCompoundContent.services[0].content.en.compoundValue[0].encryptedSelf).to.not.be.empty;
133
- (0, chai_1.expect)(contactWithCompoundContent.services[0].content.en.compoundValue[1].encryptedSelf).to.not.be.empty;
134
- // Modify compound values comment and check that encryptedSelf does not change since the content does not change
135
- const updatedContactWithCompoundContent = (yield api.contactApi.modifyContactWithUser(user, Object.assign(Object.assign({}, contactWithCompoundContent), { services: [
136
- Object.assign(Object.assign({}, contactWithCompoundContent.services[0]), { content: {
137
- en: {
138
- compoundValue: [
139
- Object.assign(Object.assign({}, contactWithCompoundContent.services[0].content.en.compoundValue[0]), { comment: 'An updated comment on the compound service sub 1' }),
140
- Object.assign(Object.assign({}, contactWithCompoundContent.services[0].content.en.compoundValue[1]), { comment: 'An updated comment on the compound service sub 2' }),
141
- ],
142
- },
143
- } }),
144
- ] })));
145
- (0, chai_1.expect)(updatedContactWithCompoundContent.services[0].content.en.compoundValue[0].comment).to.equal('An updated comment on the compound service sub 1');
146
- (0, chai_1.expect)(updatedContactWithCompoundContent.services[0].content.en.compoundValue[1].comment).to.equal('An updated comment on the compound service sub 2');
147
- (0, chai_1.expect)(updatedContactWithCompoundContent.encryptedSelf).to.equal(contactWithCompoundContent.encryptedSelf);
148
- (0, chai_1.expect)(updatedContactWithCompoundContent.services[0].encryptedSelf).to.equal(contactWithCompoundContent.services[0].encryptedSelf);
149
- (0, chai_1.expect)(updatedContactWithCompoundContent.services[0].content.en.compoundValue[0].encryptedSelf).to.equal(contactWithCompoundContent.services[0].content.en.compoundValue[0].encryptedSelf);
150
- (0, chai_1.expect)(updatedContactWithCompoundContent.services[0].content.en.compoundValue[1].encryptedSelf).to.equal(contactWithCompoundContent.services[0].content.en.compoundValue[1].encryptedSelf);
151
- }));
152
- }));
153
- describe('Init confidential delegation in patient', () => {
154
- before(function () {
155
- return __awaiter(this, void 0, void 0, function* () {
156
- this.timeout(600000);
157
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
158
- env = yield initializer.execute((0, types_1.getEnvVariables)());
159
- });
160
- });
161
- it('should return a patient with a confidential delegation', () => __awaiter(void 0, void 0, void 0, function* () {
162
- const { grandApi, grandUser, childApi, childUser, parentApi, parentUser, child2Api, child2User } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
163
- const others = [
164
- { api: child2Api, user: child2User },
165
- { api: parentApi, user: parentUser },
166
- { api: grandApi, user: grandUser },
167
- ];
168
- const note = 'Some note';
169
- const pat = yield childApi.patientApi.createPatientWithUser(childUser, yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe', note }));
170
- // All parents and siblings should have access to the decrypted data and to the initial secret id
171
- (0, chai_1.expect)(yield childApi.patientApi.decryptSecretIdsOf(pat)).to.have.length(1);
172
- (0, chai_1.expect)((yield childApi.patientApi.getPatientWithUser(childUser, pat.id)).note).to.equal(note);
173
- const originalSecretId = (yield childApi.patientApi.decryptSecretIdsOf(pat))[0];
174
- for (const { api, user } of others) {
175
- (0, chai_1.expect)(yield api.patientApi.decryptSecretIdsOf(pat)).to.have.length(1);
176
- (0, chai_1.expect)((yield api.patientApi.decryptSecretIdsOf(pat))[0]).to.equal(originalSecretId);
177
- (0, chai_1.expect)((yield api.patientApi.getPatientWithUser(user, pat.id)).note).to.equal(note);
178
- }
179
- // Initially there shouldn't be any secret confidential secret id
180
- (0, chai_1.expect)(yield childApi.patientApi.decryptConfidentialSecretIdsOf(pat)).to.be.empty;
181
- // Now create a confidential delegation
182
- const patWithConfidential = yield childApi.patientApi.initConfidentialSecretId(pat, childUser);
183
- // Confidential secret id should be different from the original secret id
184
- const confidentialDelegationKeys = yield childApi.patientApi.decryptConfidentialSecretIdsOf(patWithConfidential);
185
- const nonConfidentialDelegationKeys = yield childApi.patientApi.decryptNonConfidentialSecretIdsOf(patWithConfidential);
186
- (0, chai_1.expect)(confidentialDelegationKeys).to.have.length(1);
187
- (0, chai_1.expect)(nonConfidentialDelegationKeys).to.have.length(1);
188
- (0, chai_1.expect)(confidentialDelegationKeys[0]).to.not.equal(nonConfidentialDelegationKeys);
189
- (0, chai_1.expect)(nonConfidentialDelegationKeys[0]).to.equal(originalSecretId);
190
- // Child has access to confidential and not confidential secret ids.
191
- const childSecretIds = yield childApi.patientApi.decryptSecretIdsOf(patWithConfidential);
192
- (0, chai_1.expect)(childSecretIds).to.have.length(2);
193
- (0, chai_1.expect)(childSecretIds).to.have.contain(nonConfidentialDelegationKeys[0]);
194
- (0, chai_1.expect)(childSecretIds).to.have.contain(confidentialDelegationKeys[0]);
195
- // All parents and siblings should have access to the decrypted data even after initialising confidential delegations...
196
- (0, chai_1.expect)((yield childApi.patientApi.getPatientWithUser(childUser, pat.id)).note).to.equal(note);
197
- for (const { api, user } of others) {
198
- (0, chai_1.expect)((yield api.patientApi.getPatientWithUser(user, pat.id)).note).to.equal(note);
199
- }
200
- // ...but not to the confidential secret id
201
- for (const { api } of others) {
202
- const secretIds = yield api.patientApi.decryptSecretIdsOf(patWithConfidential);
203
- (0, chai_1.expect)(secretIds).to.have.length(1);
204
- (0, chai_1.expect)(secretIds).to.contain(nonConfidentialDelegationKeys[0]);
205
- }
206
- // If a secret delegation is already available there is no need to create a new one
207
- const patWithConfidentialAgain = yield childApi.patientApi.initConfidentialSecretId(patWithConfidential, childUser);
208
- (0, chai_1.expect)(patWithConfidentialAgain.rev).to.equal(patWithConfidentialAgain.rev);
209
- (0, chai_1.expect)(yield childApi.patientApi.decryptSecretIdsOf(patWithConfidentialAgain)).to.have.length(2);
210
- // Different users will have different confidential secret ids...
211
- (0, chai_1.expect)(yield child2Api.patientApi.decryptConfidentialSecretIdsOf(patWithConfidential)).to.be.empty;
212
- const patWithMoreConfidentialIds = yield child2Api.patientApi.initConfidentialSecretId(patWithConfidential, child2User);
213
- // ...child continues to know the same secret ids...
214
- const childSecretIdsRepeat = yield childApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds);
215
- (0, chai_1.expect)(childSecretIdsRepeat).to.have.length(2);
216
- (0, chai_1.expect)(childSecretIdsRepeat).to.have.contain(nonConfidentialDelegationKeys[0]);
217
- (0, chai_1.expect)(childSecretIdsRepeat).to.have.contain(confidentialDelegationKeys[0]);
218
- // ...but child2 now also knows a different secret id...
219
- const child2secretIds = yield child2Api.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds);
220
- const child2confidential = yield child2Api.patientApi.decryptConfidentialSecretIdsOf(patWithMoreConfidentialIds);
221
- (0, chai_1.expect)(child2confidential).to.have.length(1);
222
- (0, chai_1.expect)(child2confidential[0]).to.not.equal(confidentialDelegationKeys[0]);
223
- (0, chai_1.expect)(child2confidential[0]).to.not.equal(nonConfidentialDelegationKeys[0]);
224
- (0, chai_1.expect)(child2secretIds).to.have.length(2);
225
- (0, chai_1.expect)(child2secretIds).to.contain(nonConfidentialDelegationKeys[0]);
226
- (0, chai_1.expect)(child2secretIds).to.contain(child2confidential[0]);
227
- // ...and their parents still don't know them
228
- (0, chai_1.expect)(yield grandApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)).to.have.length(1);
229
- (0, chai_1.expect)(yield grandApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)).to.have.contain(nonConfidentialDelegationKeys[0]);
230
- (0, chai_1.expect)(yield parentApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)).to.have.length(1);
231
- (0, chai_1.expect)(yield parentApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)).to.have.contain(nonConfidentialDelegationKeys[0]);
232
- }));
233
- });
234
- describe('Test that contact information can be decrypted', () => {
235
- before(function () {
236
- return __awaiter(this, void 0, void 0, function* () {
237
- this.timeout(600000);
238
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
239
- env = yield initializer.execute((0, types_1.getEnvVariables)());
240
- });
241
- });
242
- it('should return a contact with decrypted information', () => __awaiter(void 0, void 0, void 0, function* () {
243
- const { grandApi, grandUser, childApi, childUser, parentApi, parentUser, child2Api, child2User } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
244
- const allApis = [
245
- { api: childApi, user: childUser },
246
- { api: child2Api, user: child2User },
247
- { api: parentApi, user: parentUser },
248
- { api: grandApi, user: grandUser },
249
- ];
250
- const pat = yield childApi.patientApi.createPatientWithUser(childUser, yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' }));
251
- const idFlat = childApi.cryptoApi.primitives.randomUuid();
252
- const idCompound = childApi.cryptoApi.primitives.randomUuid();
253
- const idSalut = childApi.cryptoApi.primitives.randomUuid();
254
- const idAtoi = childApi.cryptoApi.primitives.randomUuid();
255
- const instance = yield childApi.contactApi.newInstance(childUser, pat, {
256
- services: [
257
- {
258
- id: idFlat,
259
- content: { fr: { stringValue: 'Salut' }, nl: { stringValue: 'Halo' } },
260
- },
261
- {
262
- id: idCompound,
263
- content: {
264
- fr: {
265
- compoundValue: [
266
- { id: idSalut, content: { fr: { stringValue: 'Salut' } } },
267
- { id: idAtoi, content: { fr: { stringValue: 'à toi' } } },
268
- ],
269
- },
270
- },
271
- },
272
- ],
273
- });
274
- const created = yield childApi.contactApi.createContactWithUser(childUser, instance);
275
- const createdFlat = created.services.find((x) => x.id === idFlat);
276
- const createdCompound = created.services.find((x) => x.id === idCompound);
277
- const createdSalut = createdCompound.content.fr.compoundValue.find((x) => x.id === idSalut);
278
- const createdAtoi = createdCompound.content.fr.compoundValue.find((x) => x.id === idAtoi);
279
- for (const { api, user } of allApis) {
280
- console.log('Trying with user: ' + user.login);
281
- const check = yield api.contactApi.getContactWithUser(user, created.id);
282
- const checkFlat = check.services.find((x) => x.id == idFlat);
283
- const checkCompound = check.services.find((x) => x.id == idCompound);
284
- const checkSalut = checkCompound.content.fr.compoundValue.find((x) => x.id === idSalut);
285
- const checkAtoi = checkCompound.content.fr.compoundValue.find((x) => x.id === idAtoi);
286
- (0, chai_1.expect)(checkFlat).to.not.be.undefined;
287
- (0, chai_1.expect)(checkFlat).to.not.be.null;
288
- (0, chai_1.expect)(checkSalut).to.not.be.undefined;
289
- (0, chai_1.expect)(checkSalut).to.not.be.null;
290
- (0, chai_1.expect)(checkAtoi).to.not.be.undefined;
291
- (0, chai_1.expect)(checkAtoi).to.not.be.null;
292
- (0, chai_1.expect)(checkFlat.content.fr.stringValue).to.equal(createdFlat.content.fr.stringValue);
293
- (0, chai_1.expect)(checkFlat.content.nl.stringValue).to.equal(createdFlat.content.nl.stringValue);
294
- (0, chai_1.expect)(checkFlat.content.encryptedSelf).to.not.be.null;
295
- (0, chai_1.expect)(checkSalut.content.fr.stringValue).to.equal(createdSalut.content.fr.stringValue);
296
- (0, chai_1.expect)(checkSalut.encryptedSelf).to.not.be.null;
297
- (0, chai_1.expect)(checkAtoi.content.fr.stringValue).to.equal(createdAtoi.content.fr.stringValue);
298
- (0, chai_1.expect)(checkAtoi.encryptedSelf).to.not.be.null;
299
- }
300
- }));
301
- });
302
- describe('test that confidential helement information cannot be retrieved at MH level', () => {
303
- before(function () {
304
- return __awaiter(this, void 0, void 0, function* () {
305
- this.timeout(600000);
306
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
307
- env = yield initializer.execute((0, types_1.getEnvVariables)());
308
- });
309
- });
310
- it('should find the confidential data only when logged as the user', () => __awaiter(void 0, void 0, void 0, function* () {
311
- const { grandApi, grandUser, childApi, childUser, parentApi, parentUser, child2Api, child2User } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
312
- const others = [
313
- { api: child2Api, user: child2User },
314
- { api: parentApi, user: parentUser },
315
- { api: grandApi, user: grandUser },
316
- ];
317
- const pat = yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' });
318
- const modifiedPatient = (yield childApi.patientApi.initConfidentialSecretId(pat, childUser));
319
- const confidentialHe = yield childApi.healthcareElementApi.createHealthElementWithUser(childUser, yield childApi.healthcareElementApi.newInstance(childUser, modifiedPatient, { descr: 'Confidential info' }, { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }));
320
- const retrievedHesAsUser = yield childApi.healthcareElementApi.findBy(childUser.healthcarePartyId, modifiedPatient);
321
- (0, chai_1.expect)(retrievedHesAsUser.length).to.equal(1, 'User should see its confidential data');
322
- for (const { api, user } of others) {
323
- const retrievedHesAsMh = yield api.healthcareElementApi.findBy(user.healthcarePartyId, modifiedPatient);
324
- (0, chai_1.expect)(retrievedHesAsMh.length).to.equal(0, 'MH should not see confidential data');
325
- let failedToRetrieve = false;
326
- try {
327
- yield api.healthcareElementApi.getHealthElementWithUser(user, confidentialHe.id);
328
- }
329
- catch (e) {
330
- console.log(e);
331
- failedToRetrieve = true;
332
- }
333
- if (!(0, test_utils_1.isLiteTest)()) {
334
- (0, chai_1.expect)(failedToRetrieve).to.equal(true, 'MH should fail to retrieve confidential data');
335
- }
336
- // Even if in some way I could get the contact I should not be able to decrypt it
337
- (0, chai_1.expect)(yield api.cryptoApi.xapi.encryptionKeysOf({ entity: confidentialHe, type: icc_x_api_1.EntityWithDelegationTypeName.HealthElement }, undefined)).to.have.length(0);
338
- }
339
- }));
340
- });
341
- describe('test that confidential contact information cannot be retrieved at MH level', () => {
342
- before(function () {
343
- return __awaiter(this, void 0, void 0, function* () {
344
- this.timeout(600000);
345
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
346
- env = yield initializer.execute((0, types_1.getEnvVariables)());
347
- });
348
- });
349
- it('should find the confidential data only when logged as the user', () => __awaiter(void 0, void 0, void 0, function* () {
350
- const { grandApi, grandUser, childApi, childUser, parentApi, parentUser, child2Api, child2User } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
351
- const others = [
352
- { api: child2Api, user: child2User },
353
- { api: parentApi, user: parentUser },
354
- { api: grandApi, user: grandUser },
355
- ];
356
- const pat = yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' });
357
- const modifiedPatient = (yield childApi.patientApi.initConfidentialSecretId(pat, childUser));
358
- const confidentialCtc = yield childApi.contactApi.createContactWithUser(childUser, yield childApi.contactApi.newInstance(childUser, modifiedPatient, { descr: 'Confidential info', services: [], subContacts: [] }, { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }));
359
- yield childApi.contactApi.createContactWithUser(childUser, yield childApi.contactApi.newInstance(childUser, modifiedPatient, { descr: 'Non confidential info', services: [], subContacts: [] }));
360
- const retrievedCtcsAsUser = yield childApi.contactApi.findBy(childUser.healthcarePartyId, modifiedPatient);
361
- (0, chai_1.expect)(retrievedCtcsAsUser.length).to.equal(2, 'User should see its confidential data');
362
- for (const { api, user } of others) {
363
- const retrievedCtcsAsMh = yield api.contactApi.findBy(user.healthcarePartyId, modifiedPatient);
364
- (0, chai_1.expect)(retrievedCtcsAsMh.length).to.equal(1, 'MH should not see confidential data');
365
- // Even if in some way I could get the contact id I should not be able to get it
366
- let failedToRetrieve = false;
367
- try {
368
- yield api.contactApi.getContactWithUser(user, confidentialCtc.id);
369
- }
370
- catch (e) {
371
- console.log(e);
372
- failedToRetrieve = true;
373
- }
374
- if (!(0, test_utils_1.isLiteTest)()) {
375
- (0, chai_1.expect)(failedToRetrieve).to.equal(true, 'MH should fail to retrieve confidential data');
376
- }
377
- // Even if in some way I could get the contact I should not be able to decrypt it
378
- (0, chai_1.expect)(yield api.cryptoApi.xapi.encryptionKeysOf({ entity: confidentialCtc, type: icc_x_api_1.EntityWithDelegationTypeName.Contact }, undefined)).to.have.length(0);
379
- }
380
- }));
381
- });
382
- describe('Share entity behaviour', () => {
383
- before(function () {
384
- return __awaiter(this, void 0, void 0, function* () {
385
- this.timeout(600000);
386
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
387
- env = yield initializer.execute((0, types_1.getEnvVariables)());
388
- });
389
- });
390
- it("share method should fail if the user attempts to share an entity he can't access", () => __awaiter(void 0, void 0, void 0, function* () {
391
- const hcp1 = yield (0, test_utils_1.createNewHcpApi)(env);
392
- const hcp2 = yield (0, test_utils_1.createNewHcpApi)(env);
393
- const hcp3 = yield (0, test_utils_1.createNewHcpApi)(env);
394
- const patient = yield hcp1.api.patientApi.createPatientWithUser(hcp1.user, yield hcp1.api.patientApi.newInstance(hcp1.user, { firstName: 'John', lastName: 'Doe', note: 'Secret' }));
395
- const encryptedPatient = yield new icc_api_1.IccPatientApi(env.iCureUrl, {}, hcp1.api.authApi.authenticationProvider, fetch).getPatient(patient.id);
396
- yield (0, chai_1.expect)(hcp2.api.patientApi.shareWith(hcp3.credentials.dataOwnerId, encryptedPatient, [], { requestedPermissions: 'FULL_WRITE' })).to.be
397
- .rejected;
398
- const shared = yield hcp1.api.patientApi.shareWith(hcp2.credentials.dataOwnerId, patient, [], { requestedPermissions: 'FULL_WRITE' });
399
- yield hcp2.api.patientApi.shareWith(hcp3.credentials.dataOwnerId, shared, [], { requestedPermissions: 'FULL_WRITE' });
400
- }));
401
- });
402
- //# sourceMappingURL=cryptoTest.js.map
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,CAAC,CAAA;QACrI,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC,CAAA;IACvH,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import 'isomorphic-fetch'\nimport { expect, use as chaiUse } from 'chai'\nimport 'mocha'\nimport { Patient } from '../../../icc-api/model/Patient'\nimport {\n createHcpHierarchyApis,\n createNewHcpApi,\n getEnvironmentInitializer,\n hcp1Username,\n isLiteTest,\n setLocalStorage,\n TestUtils,\n} from '../../utils/test_utils'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { BasicAuthenticationProvider, EntityWithDelegationTypeName } from '../../../icc-x-api'\nimport initApi = TestUtils.initApi\nimport { SecretIdUseOption } from '../../../icc-x-api/crypto/SecretIdUseOption'\nimport UseAnyConfidential = SecretIdUseOption.UseAnyConfidential\nimport { IccPatientApi } from '../../../icc-api'\nimport { Contact } from '../../../icc-api/model/Contact'\nimport { randomUUID } from 'crypto'\n\nchaiUse(require('chai-as-promised'))\n\nlet env: TestVars\n\nsetLocalStorage(fetch)\n\ndescribe('Create a patient from scratch', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('should create a patient in the database', async () => {\n const api = await initApi(env, hcp1Username)\n const user = await api.userApi.getCurrentUser()\n\n const note = 'A secured note that is encrypted'\n const patient = await api.patientApi.createPatientWithUser(\n user,\n await api.patientApi.newInstance(\n user,\n new Patient({\n lastName: 'Biden',\n firstName: 'Joe',\n note,\n })\n )\n )\n expect(patient.note).to.equal(note)\n\n console.log(\n `Created patient (decrypted): ${patient.id}: ${patient.firstName} ${patient.lastName} [note:${patient.note}, encryptedSelf:${patient.encryptedSelf}]`\n )\n\n const fetched = await api.patientApi.getPatientWithUser(user, patient.id)\n console.log(\n `Fetched patient (decrypted): ${fetched.id}: ${fetched.firstName} ${fetched.lastName} [note:${fetched.note}, encryptedSelf:${fetched.encryptedSelf}]`\n )\n expect(fetched.id).to.equal(patient.id)\n expect(fetched.note).to.equal(note)\n\n const fetchedWithoutDecryption = await new IccPatientApi(\n env.iCureUrl,\n {},\n new BasicAuthenticationProvider(env.dataOwnerDetails[hcp1Username].user, env.dataOwnerDetails[hcp1Username].password),\n fetch as any\n ).getPatient(patient.id)\n\n console.log(\n `Fetched patient (encrypted):${fetchedWithoutDecryption.id}: ${fetchedWithoutDecryption.firstName} ${fetchedWithoutDecryption.lastName} [note: ${fetchedWithoutDecryption.note}]`\n )\n expect(fetchedWithoutDecryption.id).to.equal(patient.id)\n expect(fetchedWithoutDecryption.note).to.be.undefined\n })\n})\n\ndescribe('Entity encryption', async () => {\n it('encrypted self should not change after re-encryption if encrypted data do not change', async () => {\n const api = await initApi(env, hcp1Username)\n const user = await api.userApi.getCurrentUser()\n\n const note = 'A secured note that is encrypted'\n const patient = await api.patientApi.createPatientWithUser(\n user,\n await api.patientApi.newInstance(\n user,\n new Patient({\n lastName: 'Biden',\n firstName: 'Joe',\n note,\n })\n )\n )\n expect(patient.note).to.equal(note)\n expect(patient.encryptedSelf).to.not.be.empty\n const updatedPatient = await api.patientApi.modifyPatientWithUser(user, { ...patient, firstName: 'John' })\n expect(updatedPatient?.firstName).to.equal('John')\n expect(updatedPatient?.note).to.equal(patient.note)\n expect(updatedPatient?.encryptedSelf).to.equal(patient.encryptedSelf)\n const contactWithBasicContent = (await api.contactApi.createContactWithUser(\n user,\n await api.contactApi.newInstance(user, patient, {\n services: [\n {\n id: randomUUID(),\n valueDate: 20250101000000,\n content: {\n en: {\n stringValue: 'A service with only basic content',\n numberValue: 1234,\n },\n },\n },\n ],\n descr: 'Demo',\n })\n ))!\n expect(contactWithBasicContent.encryptedSelf).to.not.be.empty\n expect(contactWithBasicContent.services![0].encryptedSelf).to.not.be.empty\n const updatedContactWithBasicContent = await api.contactApi.modifyContactWithUser(user, {\n ...contactWithBasicContent,\n services: [\n {\n ...contactWithBasicContent.services![0],\n valueDate: 20250101120000,\n },\n ],\n })\n expect(updatedContactWithBasicContent?.services![0].valueDate).to.equal(20250101120000)\n expect(updatedContactWithBasicContent?.services![0].encryptedSelf).to.equal(contactWithBasicContent.services![0].encryptedSelf)\n expect(updatedContactWithBasicContent?.encryptedSelf).to.equal(contactWithBasicContent.encryptedSelf)\n const contactWithCompoundContent = (await api.contactApi.createContactWithUser(\n user,\n await api.contactApi.newInstance(user, patient, {\n services: [\n {\n id: randomUUID(),\n valueDate: 20250101000000,\n content: {\n en: {\n compoundValue: [\n {\n id: randomUUID(),\n content: {\n en: {\n stringValue: 'Compound service sub 1',\n numberValue: 1,\n },\n },\n comment: 'A comment on the compound service sub 1',\n },\n {\n id: randomUUID(),\n content: {\n en: {\n stringValue: 'Compound service sub 2',\n numberValue: 2,\n },\n },\n comment: 'A comment on the compound service sub 2',\n },\n ],\n },\n },\n },\n ],\n descr: 'Demo 2',\n })\n ))!\n expect(contactWithCompoundContent.encryptedSelf).to.not.be.empty\n expect(contactWithCompoundContent.services![0].encryptedSelf).to.not.be.empty // Still going to encrypt {}\n expect(contactWithCompoundContent.services![0].content!.en.compoundValue![0].encryptedSelf).to.not.be.empty\n expect(contactWithCompoundContent.services![0].content!.en.compoundValue![1].encryptedSelf).to.not.be.empty\n\n // Modify compound values comment and check that encryptedSelf does not change since the content does not change\n const updatedContactWithCompoundContent = (await api.contactApi.modifyContactWithUser(user, {\n ...contactWithCompoundContent,\n services: [\n {\n ...contactWithCompoundContent.services![0],\n content: {\n en: {\n compoundValue: [\n {\n ...contactWithCompoundContent.services![0].content!.en.compoundValue![0],\n comment: 'An updated comment on the compound service sub 1',\n },\n {\n ...contactWithCompoundContent.services![0].content!.en.compoundValue![1],\n comment: 'An updated comment on the compound service sub 2',\n },\n ],\n },\n },\n },\n ],\n }))!\n expect(updatedContactWithCompoundContent.services![0].content!.en.compoundValue![0].comment).to.equal(\n 'An updated comment on the compound service sub 1'\n )\n expect(updatedContactWithCompoundContent.services![0].content!.en.compoundValue![1].comment).to.equal(\n 'An updated comment on the compound service sub 2'\n )\n expect(updatedContactWithCompoundContent.encryptedSelf).to.equal(contactWithCompoundContent.encryptedSelf)\n expect(updatedContactWithCompoundContent.services![0].encryptedSelf).to.equal(contactWithCompoundContent.services![0].encryptedSelf)\n expect(updatedContactWithCompoundContent.services![0].content!.en.compoundValue![0].encryptedSelf).to.equal(\n contactWithCompoundContent.services![0].content!.en.compoundValue![0].encryptedSelf\n )\n expect(updatedContactWithCompoundContent.services![0].content!.en.compoundValue![1].encryptedSelf).to.equal(\n contactWithCompoundContent.services![0].content!.en.compoundValue![1].encryptedSelf\n )\n })\n})\n\ndescribe('Init confidential delegation in patient', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('should return a patient with a confidential delegation', async () => {\n const { grandApi, grandUser, childApi, childUser, parentApi, parentUser, child2Api, child2User } = await createHcpHierarchyApis(env!)\n const others = [\n { api: child2Api, user: child2User },\n { api: parentApi, user: parentUser },\n { api: grandApi, user: grandUser },\n ]\n\n const note = 'Some note'\n const pat = await childApi.patientApi.createPatientWithUser(\n childUser,\n await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe', note })\n )\n\n // All parents and siblings should have access to the decrypted data and to the initial secret id\n expect(await childApi.patientApi.decryptSecretIdsOf(pat)).to.have.length(1)\n expect((await childApi.patientApi.getPatientWithUser(childUser, pat.id)).note).to.equal(note)\n const originalSecretId = (await childApi.patientApi.decryptSecretIdsOf(pat))[0]\n for (const { api, user } of others) {\n expect(await api.patientApi.decryptSecretIdsOf(pat)).to.have.length(1)\n expect((await api.patientApi.decryptSecretIdsOf(pat))[0]).to.equal(originalSecretId)\n expect((await api.patientApi.getPatientWithUser(user, pat.id)).note).to.equal(note)\n }\n\n // Initially there shouldn't be any secret confidential secret id\n expect(await childApi.patientApi.decryptConfidentialSecretIdsOf(pat)).to.be.empty\n\n // Now create a confidential delegation\n const patWithConfidential = await childApi.patientApi.initConfidentialSecretId(pat, childUser)\n\n // Confidential secret id should be different from the original secret id\n const confidentialDelegationKeys = await childApi.patientApi.decryptConfidentialSecretIdsOf(patWithConfidential)\n const nonConfidentialDelegationKeys = await childApi.patientApi.decryptNonConfidentialSecretIdsOf(patWithConfidential)\n expect(confidentialDelegationKeys).to.have.length(1)\n expect(nonConfidentialDelegationKeys).to.have.length(1)\n expect(confidentialDelegationKeys[0]).to.not.equal(nonConfidentialDelegationKeys)\n expect(nonConfidentialDelegationKeys[0]).to.equal(originalSecretId)\n\n // Child has access to confidential and not confidential secret ids.\n const childSecretIds = await childApi.patientApi.decryptSecretIdsOf(patWithConfidential)\n expect(childSecretIds).to.have.length(2)\n expect(childSecretIds).to.have.contain(nonConfidentialDelegationKeys[0])\n expect(childSecretIds).to.have.contain(confidentialDelegationKeys[0])\n\n // All parents and siblings should have access to the decrypted data even after initialising confidential delegations...\n expect((await childApi.patientApi.getPatientWithUser(childUser, pat.id)).note).to.equal(note)\n for (const { api, user } of others) {\n expect((await api.patientApi.getPatientWithUser(user, pat.id)).note).to.equal(note)\n }\n\n // ...but not to the confidential secret id\n for (const { api } of others) {\n const secretIds = await api.patientApi.decryptSecretIdsOf(patWithConfidential)\n expect(secretIds).to.have.length(1)\n expect(secretIds).to.contain(nonConfidentialDelegationKeys[0])\n }\n\n // If a secret delegation is already available there is no need to create a new one\n const patWithConfidentialAgain = await childApi.patientApi.initConfidentialSecretId(patWithConfidential, childUser)\n expect(patWithConfidentialAgain.rev).to.equal(patWithConfidentialAgain.rev)\n expect(await childApi.patientApi.decryptSecretIdsOf(patWithConfidentialAgain)).to.have.length(2)\n\n // Different users will have different confidential secret ids...\n expect(await child2Api.patientApi.decryptConfidentialSecretIdsOf(patWithConfidential)).to.be.empty\n const patWithMoreConfidentialIds = await child2Api.patientApi.initConfidentialSecretId(patWithConfidential, child2User)\n\n // ...child continues to know the same secret ids...\n const childSecretIdsRepeat = await childApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)\n expect(childSecretIdsRepeat).to.have.length(2)\n expect(childSecretIdsRepeat).to.have.contain(nonConfidentialDelegationKeys[0])\n expect(childSecretIdsRepeat).to.have.contain(confidentialDelegationKeys[0])\n\n // ...but child2 now also knows a different secret id...\n const child2secretIds = await child2Api.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)\n const child2confidential = await child2Api.patientApi.decryptConfidentialSecretIdsOf(patWithMoreConfidentialIds)\n expect(child2confidential).to.have.length(1)\n expect(child2confidential[0]).to.not.equal(confidentialDelegationKeys[0])\n expect(child2confidential[0]).to.not.equal(nonConfidentialDelegationKeys[0])\n expect(child2secretIds).to.have.length(2)\n expect(child2secretIds).to.contain(nonConfidentialDelegationKeys[0])\n expect(child2secretIds).to.contain(child2confidential[0])\n\n // ...and their parents still don't know them\n expect(await grandApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)).to.have.length(1)\n expect(await grandApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)).to.have.contain(nonConfidentialDelegationKeys[0])\n expect(await parentApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)).to.have.length(1)\n expect(await parentApi.patientApi.decryptSecretIdsOf(patWithMoreConfidentialIds)).to.have.contain(nonConfidentialDelegationKeys[0])\n })\n})\n\ndescribe('Test that contact information can be decrypted', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('should return a contact with decrypted information', async () => {\n const { grandApi, grandUser, childApi, childUser, parentApi, parentUser, child2Api, child2User } = await createHcpHierarchyApis(env!)\n const allApis = [\n { api: childApi, user: childUser },\n { api: child2Api, user: child2User },\n { api: parentApi, user: parentUser },\n { api: grandApi, user: grandUser },\n ]\n\n const pat = await childApi.patientApi.createPatientWithUser(\n childUser,\n await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n )\n const idFlat = childApi.cryptoApi.primitives.randomUuid()\n const idCompound = childApi.cryptoApi.primitives.randomUuid()\n const idSalut = childApi.cryptoApi.primitives.randomUuid()\n const idAtoi = childApi.cryptoApi.primitives.randomUuid()\n const instance = await childApi.contactApi.newInstance(childUser, pat, {\n services: [\n {\n id: idFlat,\n content: { fr: { stringValue: 'Salut' }, nl: { stringValue: 'Halo' } },\n },\n {\n id: idCompound,\n content: {\n fr: {\n compoundValue: [\n { id: idSalut, content: { fr: { stringValue: 'Salut' } } },\n { id: idAtoi, content: { fr: { stringValue: 'à toi' } } },\n ],\n },\n },\n },\n ],\n })\n const created = await childApi.contactApi.createContactWithUser(childUser, instance)\n const createdFlat = created!.services!.find((x) => x.id === idFlat)!\n const createdCompound = created!.services!.find((x) => x.id === idCompound)!\n const createdSalut = createdCompound.content!.fr.compoundValue!.find((x) => x.id === idSalut)!\n const createdAtoi = createdCompound.content!.fr.compoundValue!.find((x) => x.id === idAtoi)!\n\n for (const { api, user } of allApis) {\n console.log('Trying with user: ' + user.login)\n const check = await api.contactApi.getContactWithUser(user, created!.id!)\n const checkFlat = check!.services!.find((x) => x.id == idFlat)!\n const checkCompound = check!.services!.find((x) => x.id == idCompound)!\n const checkSalut = checkCompound.content!.fr.compoundValue!.find((x) => x.id === idSalut)!\n const checkAtoi = checkCompound.content!.fr.compoundValue!.find((x) => x.id === idAtoi)!\n\n expect(checkFlat).to.not.be.undefined\n expect(checkFlat).to.not.be.null\n expect(checkSalut).to.not.be.undefined\n expect(checkSalut).to.not.be.null\n expect(checkAtoi).to.not.be.undefined\n expect(checkAtoi).to.not.be.null\n\n expect(checkFlat.content!.fr.stringValue).to.equal(createdFlat!.content!.fr.stringValue)\n expect(checkFlat.content!.nl.stringValue).to.equal(createdFlat!.content!.nl.stringValue)\n expect(checkFlat.content!.encryptedSelf).to.not.be.null\n\n expect(checkSalut.content!.fr.stringValue).to.equal(createdSalut.content!.fr.stringValue)\n expect(checkSalut.encryptedSelf).to.not.be.null\n\n expect(checkAtoi.content!.fr.stringValue).to.equal(createdAtoi.content!.fr.stringValue)\n expect(checkAtoi.encryptedSelf).to.not.be.null\n }\n })\n})\n\ndescribe('test that confidential helement information cannot be retrieved at MH level', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('should find the confidential data only when logged as the user', async () => {\n const { grandApi, grandUser, childApi, childUser, parentApi, parentUser, child2Api, child2User } = await createHcpHierarchyApis(env!)\n const others = [\n { api: child2Api, user: child2User },\n { api: parentApi, user: parentUser },\n { api: grandApi, user: grandUser },\n ]\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n\n const confidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n )\n\n const retrievedHesAsUser = await childApi.healthcareElementApi.findBy(childUser.healthcarePartyId!, modifiedPatient)\n expect(retrievedHesAsUser.length).to.equal(1, 'User should see its confidential data')\n\n for (const { api, user } of others) {\n const retrievedHesAsMh = await api.healthcareElementApi.findBy(user.healthcarePartyId!, modifiedPatient)\n expect(retrievedHesAsMh.length).to.equal(0, 'MH should not see confidential data')\n let failedToRetrieve = false\n try {\n await api.healthcareElementApi.getHealthElementWithUser(user, confidentialHe.id!)\n } catch (e) {\n console.log(e)\n failedToRetrieve = true\n }\n if (!isLiteTest()) {\n expect(failedToRetrieve).to.equal(true, 'MH should fail to retrieve confidential data')\n }\n // Even if in some way I could get the contact I should not be able to decrypt it\n expect(\n await api.cryptoApi.xapi.encryptionKeysOf({ entity: confidentialHe!, type: EntityWithDelegationTypeName.HealthElement }, undefined)\n ).to.have.length(0)\n }\n })\n})\n\ndescribe('test that confidential contact information cannot be retrieved at MH level', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('should find the confidential data only when logged as the user', async () => {\n const { grandApi, grandUser, childApi, childUser, parentApi, parentUser, child2Api, child2User } = await createHcpHierarchyApis(env!)\n const others = [\n { api: child2Api, user: child2User },\n { api: parentApi, user: parentUser },\n { api: grandApi, user: grandUser },\n ]\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n\n const confidentialCtc = await childApi.contactApi.createContactWithUser(\n childUser,\n await childApi.contactApi.newInstance(\n childUser,\n modifiedPatient,\n\n { descr: 'Confidential info', services: [], subContacts: [] },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n )\n\n await childApi.contactApi.createContactWithUser(\n childUser,\n await childApi.contactApi.newInstance(childUser, modifiedPatient, { descr: 'Non confidential info', services: [], subContacts: [] })\n )\n\n const retrievedCtcsAsUser = await childApi.contactApi.findBy(childUser.healthcarePartyId!, modifiedPatient)\n expect(retrievedCtcsAsUser.length).to.equal(2, 'User should see its confidential data')\n\n for (const { api, user } of others) {\n const retrievedCtcsAsMh = await api.contactApi.findBy(user.healthcarePartyId!, modifiedPatient)\n expect(retrievedCtcsAsMh.length).to.equal(1, 'MH should not see confidential data')\n // Even if in some way I could get the contact id I should not be able to get it\n let failedToRetrieve = false\n try {\n await api.contactApi.getContactWithUser(user, confidentialCtc!.id!)\n } catch (e) {\n console.log(e)\n failedToRetrieve = true\n }\n if (!isLiteTest()) {\n expect(failedToRetrieve).to.equal(true, 'MH should fail to retrieve confidential data')\n }\n // Even if in some way I could get the contact I should not be able to decrypt it\n expect(\n await api.cryptoApi.xapi.encryptionKeysOf({ entity: confidentialCtc!, type: EntityWithDelegationTypeName.Contact }, undefined)\n ).to.have.length(0)\n }\n })\n})\n\ndescribe('Share entity behaviour', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it(\"share method should fail if the user attempts to share an entity he can't access\", async () => {\n const hcp1 = await createNewHcpApi(env)\n const hcp2 = await createNewHcpApi(env)\n const hcp3 = await createNewHcpApi(env)\n const patient: Patient = await hcp1.api.patientApi.createPatientWithUser(\n hcp1.user,\n await hcp1.api.patientApi.newInstance(hcp1.user, { firstName: 'John', lastName: 'Doe', note: 'Secret' })\n )\n const encryptedPatient = await new IccPatientApi(env.iCureUrl, {}, hcp1.api.authApi.authenticationProvider, fetch).getPatient(patient.id!)\n await expect(hcp2.api.patientApi.shareWith(hcp3.credentials.dataOwnerId, encryptedPatient, [], { requestedPermissions: 'FULL_WRITE' })).to.be\n .rejected\n const shared = await hcp1.api.patientApi.shareWith(hcp2.credentials.dataOwnerId, patient, [], { requestedPermissions: 'FULL_WRITE' })\n await hcp2.api.patientApi.shareWith(hcp3.credentials.dataOwnerId, shared, [], { requestedPermissions: 'FULL_WRITE' })\n })\n})\n"]}
@@ -1 +0,0 @@
1
- import 'isomorphic-fetch';