@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.
- package/icc-api/api/IccDocumentApi.d.ts +10 -2
- package/icc-api/api/IccDocumentApi.js +22 -4
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.d.ts +17 -0
- package/icc-api/api/IccReceiptApi.js +52 -0
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/model/DataAttachment.d.ts +22 -0
- package/icc-api/model/DataAttachment.js.map +1 -1
- package/icc-api/model/Document.d.ts +6 -0
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/Receipt.d.ts +6 -0
- package/icc-api/model/Receipt.js.map +1 -1
- package/icc-x-api/crypto/BaseExchangeDataManager.js +2 -2
- package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.js +3 -3
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.d.ts +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +1 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +8 -2
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
- package/icc-x-api/crypto/RecoveryDataEncryption.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.js +7 -7
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.js +7 -7
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.js +4 -5
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-code-x-api.d.ts +2 -2
- package/icc-x-api/icc-code-x-api.js +3 -33
- package/icc-x-api/icc-code-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.js +20 -33
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +8 -7
- package/icc-x-api/icc-document-x-api.js +64 -22
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +3 -4
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.js +11 -11
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.js +3 -4
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +3 -3
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.js +29 -29
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +40 -0
- package/icc-x-api/icc-receipt-x-api.js +79 -1
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/icc-x-api/utils/code-util.d.ts +23 -0
- package/icc-x-api/utils/code-util.js +39 -2
- package/icc-x-api/utils/code-util.js.map +1 -1
- package/icc-x-api/utils/collection-utils.d.ts +13 -0
- package/icc-x-api/utils/collection-utils.js +69 -0
- package/icc-x-api/utils/collection-utils.js.map +1 -1
- package/icc-x-api/utils/compression-utils.d.ts +28 -0
- package/icc-x-api/utils/compression-utils.js +106 -0
- package/icc-x-api/utils/compression-utils.js.map +1 -0
- package/icc-x-api/utils/crypto-utils.js +7 -7
- package/icc-x-api/utils/crypto-utils.js.map +1 -1
- package/icc-x-api/utils/formatting-util.d.ts +1 -3
- package/icc-x-api/utils/formatting-util.js +15 -17
- package/icc-x-api/utils/formatting-util.js.map +1 -1
- package/icc-x-api/utils/hcp-util.js +2 -3
- package/icc-x-api/utils/hcp-util.js.map +1 -1
- package/icc-x-api/utils/insurability-util.js +10 -8
- package/icc-x-api/utils/insurability-util.js.map +1 -1
- package/icc-x-api/utils/lzma-wasm.d.ts +6 -0
- package/icc-x-api/utils/lzma-wasm.js +81 -0
- package/icc-x-api/utils/lzma-wasm.js.map +1 -0
- package/icc-x-api/utils/mutex.d.ts +12 -0
- package/icc-x-api/utils/mutex.js +26 -0
- package/icc-x-api/utils/mutex.js.map +1 -0
- package/icc-x-api/utils/websocket.js +7 -7
- package/icc-x-api/utils/websocket.js.map +1 -1
- package/icc-x-api/wasm/lzma/lzma.js +2 -0
- package/icc-x-api/wasm/lzma/lzma.wasm +0 -0
- package/package.json +2 -11
- package/icc-x-api/utils/uuid-encoder.d.ts +0 -44
- package/icc-x-api/utils/uuid-encoder.js +0 -114
- package/icc-x-api/utils/uuid-encoder.js.map +0 -1
- package/test/icc-api/api/IccAgendaApi.d.ts +0 -1
- package/test/icc-api/api/IccAgendaApi.js +0 -64
- package/test/icc-api/api/IccAgendaApi.js.map +0 -1
- package/test/icc-api/api/IccAnonymousAccessApi.d.ts +0 -1
- package/test/icc-api/api/IccAnonymousAccessApi.js +0 -58
- package/test/icc-api/api/IccAnonymousAccessApi.js.map +0 -1
- package/test/icc-api/api/IccCalendarItemApi.d.ts +0 -1
- package/test/icc-api/api/IccCalendarItemApi.js +0 -67
- package/test/icc-api/api/IccCalendarItemApi.js.map +0 -1
- package/test/icc-api/api/IccCalendarItemTypeApi.d.ts +0 -1
- package/test/icc-api/api/IccCalendarItemTypeApi.js +0 -96
- package/test/icc-api/api/IccCalendarItemTypeApi.js.map +0 -1
- package/test/icc-api/api/IccCodeApi.d.ts +0 -1
- package/test/icc-api/api/IccCodeApi.js +0 -38
- package/test/icc-api/api/IccCodeApi.js.map +0 -1
- package/test/icc-api/api/IccDocumentApi.d.ts +0 -1
- package/test/icc-api/api/IccDocumentApi.js +0 -199
- package/test/icc-api/api/IccDocumentApi.js.map +0 -1
- package/test/icc-api/api/IccGroupApi.d.ts +0 -1
- package/test/icc-api/api/IccGroupApi.js +0 -50
- package/test/icc-api/api/IccGroupApi.js.map +0 -1
- package/test/icc-api/api/IccKeywordApi.d.ts +0 -1
- package/test/icc-api/api/IccKeywordApi.js +0 -64
- package/test/icc-api/api/IccKeywordApi.js.map +0 -1
- package/test/icc-api/api/IccMedicalLocationApi.d.ts +0 -1
- package/test/icc-api/api/IccMedicalLocationApi.js +0 -64
- package/test/icc-api/api/IccMedicalLocationApi.js.map +0 -1
- package/test/icc-api/api/IccPlaceApi.d.ts +0 -1
- package/test/icc-api/api/IccPlaceApi.js +0 -64
- package/test/icc-api/api/IccPlaceApi.js.map +0 -1
- package/test/icc-api/api/IccRecoveryDataApi.d.ts +0 -1
- package/test/icc-api/api/IccRecoveryDataApi.js +0 -95
- package/test/icc-api/api/IccRecoveryDataApi.js.map +0 -1
- package/test/icc-api/api/IccRoleApi.d.ts +0 -1
- package/test/icc-api/api/IccRoleApi.js +0 -34
- package/test/icc-api/api/IccRoleApi.js.map +0 -1
- package/test/icc-api/api/IccUserApi.d.ts +0 -1
- package/test/icc-api/api/IccUserApi.js +0 -96
- package/test/icc-api/api/IccUserApi.js.map +0 -1
- package/test/icc-api/e2e/IccCalendarItemApi.d.ts +0 -1
- package/test/icc-api/e2e/IccCalendarItemApi.js +0 -46
- package/test/icc-api/e2e/IccCalendarItemApi.js.map +0 -1
- package/test/icc-api/model/modelHelpersTest.d.ts +0 -1
- package/test/icc-api/model/modelHelpersTest.js +0 -45
- package/test/icc-api/model/modelHelpersTest.js.map +0 -1
- package/test/icc-x-api/auth/group-switch-test.d.ts +0 -1
- package/test/icc-x-api/auth/group-switch-test.js +0 -81
- package/test/icc-x-api/auth/group-switch-test.js.map +0 -1
- package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +0 -2
- package/test/icc-x-api/auth/jwt-concurrency-test.js +0 -112
- package/test/icc-x-api/auth/jwt-concurrency-test.js.map +0 -1
- package/test/icc-x-api/auth/jwt-provider-test.d.ts +0 -1
- package/test/icc-x-api/auth/jwt-provider-test.js +0 -197
- package/test/icc-x-api/auth/jwt-provider-test.js.map +0 -1
- package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +0 -1
- package/test/icc-x-api/auth/smart-auth-provider-test.js +0 -224
- package/test/icc-x-api/auth/smart-auth-provider-test.js.map +0 -1
- package/test/icc-x-api/autofix-anonymity-test.d.ts +0 -1
- package/test/icc-x-api/autofix-anonymity-test.js +0 -122
- package/test/icc-x-api/autofix-anonymity-test.js.map +0 -1
- package/test/icc-x-api/confidential-entities-test.d.ts +0 -1
- package/test/icc-x-api/confidential-entities-test.js +0 -168
- package/test/icc-x-api/confidential-entities-test.js.map +0 -1
- package/test/icc-x-api/crud/comprehensive-crud-test.d.ts +0 -1
- package/test/icc-x-api/crud/comprehensive-crud-test.js +0 -276
- package/test/icc-x-api/crud/comprehensive-crud-test.js.map +0 -1
- package/test/icc-x-api/crud/entities-crud-test-interface.d.ts +0 -16
- package/test/icc-x-api/crud/entities-crud-test-interface.js +0 -408
- package/test/icc-x-api/crud/entities-crud-test-interface.js.map +0 -1
- package/test/icc-x-api/crypto/anonymous-delegations-test.d.ts +0 -1
- package/test/icc-x-api/crypto/anonymous-delegations-test.js +0 -587
- package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +0 -1
- package/test/icc-x-api/crypto/concurrency.d.ts +0 -1
- package/test/icc-x-api/crypto/concurrency.js +0 -35
- package/test/icc-x-api/crypto/concurrency.js.map +0 -1
- package/test/icc-x-api/crypto/crypto-utils.d.ts +0 -1
- package/test/icc-x-api/crypto/crypto-utils.js +0 -79
- package/test/icc-x-api/crypto/crypto-utils.js.map +0 -1
- package/test/icc-x-api/crypto/cryptoTest.d.ts +0 -2
- package/test/icc-x-api/crypto/cryptoTest.js +0 -402
- package/test/icc-x-api/crypto/cryptoTest.js.map +0 -1
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +0 -1
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +0 -166
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +0 -1
- package/test/icc-x-api/crypto/exchange-data-manager-test.d.ts +0 -1
- package/test/icc-x-api/crypto/exchange-data-manager-test.js +0 -674
- package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +0 -1
- package/test/icc-x-api/crypto/full-crypto-test.d.ts +0 -1
- package/test/icc-x-api/crypto/full-crypto-test.js +0 -454
- package/test/icc-x-api/crypto/full-crypto-test.js.map +0 -1
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.d.ts +0 -1
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.js +0 -379
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.js.map +0 -1
- package/test/icc-x-api/crypto/secure-delegations-manager-test.d.ts +0 -1
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js +0 -278
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +0 -1
- package/test/icc-x-api/crypto/shamir.d.ts +0 -2
- package/test/icc-x-api/crypto/shamir.js +0 -167
- package/test/icc-x-api/crypto/shamir.js.map +0 -1
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +0 -1
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +0 -71
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +0 -1
- package/test/icc-x-api/crypto/soft-deleted-data-owners.d.ts +0 -2
- package/test/icc-x-api/crypto/soft-deleted-data-owners.js +0 -113
- package/test/icc-x-api/crypto/soft-deleted-data-owners.js.map +0 -1
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.d.ts +0 -1
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js +0 -246
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js.map +0 -1
- package/test/icc-x-api/entity-with-attachments-api-test.d.ts +0 -1
- package/test/icc-x-api/entity-with-attachments-api-test.js +0 -142
- package/test/icc-x-api/entity-with-attachments-api-test.js.map +0 -1
- package/test/icc-x-api/filters/filters.d.ts +0 -1
- package/test/icc-x-api/filters/filters.js +0 -49
- package/test/icc-x-api/filters/filters.js.map +0 -1
- package/test/icc-x-api/filters/healthelement.d.ts +0 -1
- package/test/icc-x-api/filters/healthelement.js +0 -333
- package/test/icc-x-api/filters/healthelement.js.map +0 -1
- package/test/icc-x-api/icc-accesslog-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-accesslog-x-api.js +0 -106
- package/test/icc-x-api/icc-accesslog-x-api.js.map +0 -1
- package/test/icc-x-api/icc-application-settings-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-application-settings-x-api.js +0 -91
- package/test/icc-x-api/icc-application-settings-x-api.js.map +0 -1
- package/test/icc-x-api/icc-auth-api.d.ts +0 -1
- package/test/icc-x-api/icc-auth-api.js +0 -47
- package/test/icc-x-api/icc-auth-api.js.map +0 -1
- package/test/icc-x-api/icc-calendar-item-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-calendar-item-x-api.js +0 -150
- package/test/icc-x-api/icc-calendar-item-x-api.js.map +0 -1
- package/test/icc-x-api/icc-contact-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-contact-x-api.js +0 -355
- package/test/icc-x-api/icc-contact-x-api.js.map +0 -1
- package/test/icc-x-api/icc-document-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-document-x-api.js +0 -76
- package/test/icc-x-api/icc-document-x-api.js.map +0 -1
- package/test/icc-x-api/icc-form-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-form-x-api.js +0 -413
- package/test/icc-x-api/icc-form-x-api.js.map +0 -1
- package/test/icc-x-api/icc-hcparty-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-hcparty-x-api-test.js +0 -43
- package/test/icc-x-api/icc-hcparty-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-helement-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-helement-x-api-test.js +0 -155
- package/test/icc-x-api/icc-helement-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-invoice-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-invoice-x-api.js +0 -99
- package/test/icc-x-api/icc-invoice-x-api.js.map +0 -1
- package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js +0 -222
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-message-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-message-x-api.js +0 -54
- package/test/icc-x-api/icc-message-x-api.js.map +0 -1
- package/test/icc-x-api/icc-patient-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-patient-x-api-test.js +0 -165
- package/test/icc-x-api/icc-patient-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-recovery-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-recovery-x-api.js +0 -175
- package/test/icc-x-api/icc-recovery-x-api.js.map +0 -1
- package/test/icc-x-api/icc-topic-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-topic-x-api.js +0 -269
- package/test/icc-x-api/icc-topic-x-api.js.map +0 -1
- package/test/icc-x-api/icc-user-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-user-x-api-test.js +0 -99
- package/test/icc-x-api/icc-user-x-api-test.js.map +0 -1
- package/test/icc-x-api/keyless-api.d.ts +0 -1
- package/test/icc-x-api/keyless-api.js +0 -125
- package/test/icc-x-api/keyless-api.js.map +0 -1
- package/test/icc-x-api/patient-user.d.ts +0 -2
- package/test/icc-x-api/patient-user.js +0 -103
- package/test/icc-x-api/patient-user.js.map +0 -1
- package/test/icc-x-api/storage/storage.d.ts +0 -1
- package/test/icc-x-api/storage/storage.js +0 -48
- package/test/icc-x-api/storage/storage.js.map +0 -1
- package/test/icc-x-api/test-api-no-parent.d.ts +0 -1
- package/test/icc-x-api/test-api-no-parent.js +0 -79
- package/test/icc-x-api/test-api-no-parent.js.map +0 -1
- package/test/icc-x-api/test-legacy-data-support.d.ts +0 -1
- package/test/icc-x-api/test-legacy-data-support.js +0 -375
- package/test/icc-x-api/test-legacy-data-support.js.map +0 -1
- package/test/icc-x-api/utils/graph-test.d.ts +0 -1
- package/test/icc-x-api/utils/graph-test.js +0 -54
- package/test/icc-x-api/utils/graph-test.js.map +0 -1
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.d.ts +0 -1
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js +0 -364
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +0 -1
- package/test/support/CSM-185.d.ts +0 -1
- package/test/support/CSM-185.js +0 -124
- package/test/support/CSM-185.js.map +0 -1
- package/test/support/CSM-243.d.ts +0 -1
- package/test/support/CSM-243.js +0 -120
- package/test/support/CSM-243.js.map +0 -1
- package/test/support/CSM-543.d.ts +0 -1
- package/test/support/CSM-543.js +0 -164
- package/test/support/CSM-543.js.map +0 -1
- package/test/support/CSM-729.d.ts +0 -1
- package/test/support/CSM-729.js +0 -225
- package/test/support/CSM-729.js.map +0 -1
- package/test/support/CSM-87.d.ts +0 -0
- package/test/support/CSM-87.js +0 -21
- package/test/support/CSM-87.js.map +0 -1
- package/test/support/CSM-93.d.ts +0 -1
- package/test/support/CSM-93.js +0 -112
- package/test/support/CSM-93.js.map +0 -1
- package/test/utils/FakeDataOwnerApi.d.ts +0 -32
- package/test/utils/FakeDataOwnerApi.js +0 -136
- package/test/utils/FakeDataOwnerApi.js.map +0 -1
- package/test/utils/FakeEncryptionKeysManager.d.ts +0 -36
- package/test/utils/FakeEncryptionKeysManager.js +0 -98
- package/test/utils/FakeEncryptionKeysManager.js.map +0 -1
- package/test/utils/FakeExchangeDataApi.d.ts +0 -32
- package/test/utils/FakeExchangeDataApi.js +0 -92
- package/test/utils/FakeExchangeDataApi.js.map +0 -1
- package/test/utils/FakeExchangeDataManager.d.ts +0 -48
- package/test/utils/FakeExchangeDataManager.js +0 -82
- package/test/utils/FakeExchangeDataManager.js.map +0 -1
- package/test/utils/FakeExchangeDataMapManager.d.ts +0 -12
- package/test/utils/FakeExchangeDataMapManager.js +0 -38
- package/test/utils/FakeExchangeDataMapManager.js.map +0 -1
- package/test/utils/FakeGenericApi.d.ts +0 -16
- package/test/utils/FakeGenericApi.js +0 -65
- package/test/utils/FakeGenericApi.js.map +0 -1
- package/test/utils/KeylessCryptoStrategies.d.ts +0 -23
- package/test/utils/KeylessCryptoStrategies.js +0 -26
- package/test/utils/KeylessCryptoStrategies.js.map +0 -1
- package/test/utils/TestApi.d.ts +0 -3
- package/test/utils/TestApi.js +0 -30
- package/test/utils/TestApi.js.map +0 -1
- package/test/utils/TestCollectionUtils.d.ts +0 -1
- package/test/utils/TestCollectionUtils.js +0 -109
- package/test/utils/TestCollectionUtils.js.map +0 -1
- package/test/utils/TestCryptoStrategies.d.ts +0 -42
- package/test/utils/TestCryptoStrategies.js +0 -80
- package/test/utils/TestCryptoStrategies.js.map +0 -1
- package/test/utils/TestStorage.d.ts +0 -23
- package/test/utils/TestStorage.js +0 -61
- package/test/utils/TestStorage.js.map +0 -1
- package/test/utils/roles.d.ts +0 -14
- package/test/utils/roles.js +0 -345
- package/test/utils/roles.js.map +0 -1
- package/test/utils/test_utils.d.ts +0 -87
- package/test/utils/test_utils.js +0 -452
- package/test/utils/test_utils.js.map +0 -1
|
@@ -1,166 +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 icc_x_api_1 = require("../../../icc-x-api");
|
|
13
|
-
const CalendarItem_1 = require("../../../icc-api/model/CalendarItem");
|
|
14
|
-
const models_1 = require("../../../icc-api/model/models");
|
|
15
|
-
const mocha_1 = require("mocha");
|
|
16
|
-
const crypto_1 = require("crypto");
|
|
17
|
-
require("isomorphic-fetch");
|
|
18
|
-
const chai_1 = require("chai");
|
|
19
|
-
const MaintenanceTaskAfterDateFilter_1 = require("../../../icc-x-api/filters/MaintenanceTaskAfterDateFilter");
|
|
20
|
-
const test_utils_1 = require("../../utils/test_utils");
|
|
21
|
-
const TestStorage_1 = require("../../utils/TestStorage");
|
|
22
|
-
const TestCryptoStrategies_1 = require("../../utils/TestCryptoStrategies");
|
|
23
|
-
const KeyPairUpdateRequest_1 = require("../../../icc-x-api/maintenance/KeyPairUpdateRequest");
|
|
24
|
-
const SecureDelegation_1 = require("../../../icc-api/model/SecureDelegation");
|
|
25
|
-
const types_1 = require("@icure/test-setup/types");
|
|
26
|
-
var AccessLevel = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
|
|
27
|
-
function _getHcpKeyUpdateMaintenanceTask(delegateApi) {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const delegateUser = yield delegateApi.userApi.getCurrentUser();
|
|
30
|
-
const notifications = yield delegateApi.maintenanceTaskApi.filterMaintenanceTasksByWithUser(delegateUser, undefined, undefined, new models_1.FilterChainMaintenanceTask({
|
|
31
|
-
filter: new MaintenanceTaskAfterDateFilter_1.MaintenanceTaskAfterDateFilter({
|
|
32
|
-
date: new Date().getTime() - 100000,
|
|
33
|
-
}),
|
|
34
|
-
}));
|
|
35
|
-
return notifications.rows.sort((a, b) => a.created - b.created)[notifications.rows.length - 1];
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
39
|
-
let env;
|
|
40
|
-
(0, mocha_1.describe)('Full battery of tests on crypto and keys', function () {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
(0, mocha_1.before)(function () {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
this.timeout(600000);
|
|
45
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
46
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
// TODO should give access back to old and new keys
|
|
50
|
-
(0, mocha_1.it)(`Create calendar item as a patient and get access back`, () => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
function decryptDataForPair(api, dataOwner1, dataOwner2) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const allExchangeData = [
|
|
54
|
-
...(yield api.cryptoApi.exchangeData.base.getExchangeDataByDelegatorDelegatePair(dataOwner1, dataOwner2)),
|
|
55
|
-
...(yield api.cryptoApi.exchangeData.base.getExchangeDataByDelegatorDelegatePair(dataOwner2, dataOwner1)),
|
|
56
|
-
];
|
|
57
|
-
let failedDecryptionsCount = 0;
|
|
58
|
-
const successfulDecryptions = [];
|
|
59
|
-
for (const exchangeData of allExchangeData) {
|
|
60
|
-
const decryptedKey = yield api.cryptoApi.exchangeData.base.tryDecryptExchangeKeys([exchangeData], api.cryptoApi.userKeysManager.getDecryptionKeys());
|
|
61
|
-
const decryptedAccessControlSecret = yield api.cryptoApi.exchangeData.base.tryDecryptAccessControlSecret([exchangeData], api.cryptoApi.userKeysManager.getDecryptionKeys());
|
|
62
|
-
if (decryptedKey.failedDecryptions.length > 0 || decryptedAccessControlSecret.failedDecryptions.length > 0) {
|
|
63
|
-
failedDecryptionsCount++;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
successfulDecryptions.push({
|
|
67
|
-
rawKey: (0, icc_x_api_1.ua2hex)(yield api.cryptoApi.primitives.AES.exportKey(decryptedKey.successfulDecryptions[0], 'raw')),
|
|
68
|
-
accessControlSecret: decryptedAccessControlSecret.successfulDecryptions[0],
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return { failedDecryptionsCount, successfulDecryptions };
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function checkDecryptedDataHas(decryptedData, expected) {
|
|
76
|
-
(0, chai_1.expect)(decryptedData.filter((d) => d.rawKey === expected.rawKey && d.accessControlSecret === expected.accessControlSecret)).to.have.length(1);
|
|
77
|
-
}
|
|
78
|
-
const previousPubKey = env.dataOwnerDetails[test_utils_1.patUsername].publicKey;
|
|
79
|
-
const api = yield (0, test_utils_1.getApiAndAddPrivateKeysForUser)(env.iCureUrl, env.dataOwnerDetails[test_utils_1.patUsername]);
|
|
80
|
-
const u = yield api.userApi.getCurrentUser();
|
|
81
|
-
const delegateInfo = yield (0, test_utils_1.createNewHcpApi)(env);
|
|
82
|
-
const delegateApi = delegateInfo.api;
|
|
83
|
-
const delegateUser = delegateInfo.user;
|
|
84
|
-
const delegateHcp = yield delegateApi.healthcarePartyApi.getHealthcareParty(delegateUser.healthcarePartyId);
|
|
85
|
-
const patient = yield api.patientApi.getPatientWithUser(u, u.patientId);
|
|
86
|
-
// Create a Record to share with delegateHcp: this will trigger the creation of a new aes exchange key as well
|
|
87
|
-
const initialRecordToDelegate = yield api.calendarItemApi.createCalendarItemWithHcParty(u, yield api.calendarItemApi.newInstance(u, new CalendarItem_1.CalendarItem({ id: `${u.id}-ci-initial-to`, title: 'CI-INITIAL-TO' }), {
|
|
88
|
-
additionalDelegates: {
|
|
89
|
-
[delegateHcp.id]: AccessLevel.WRITE,
|
|
90
|
-
},
|
|
91
|
-
}));
|
|
92
|
-
const initialRecordFromDelegate = yield delegateApi.calendarItemApi.createCalendarItemWithHcParty(u, yield delegateApi.calendarItemApi.newInstance(delegateUser, new CalendarItem_1.CalendarItem({ id: `${u.id}-ci-initial-from`, title: 'CI-INITIAL-FROM' }), {
|
|
93
|
-
additionalDelegates: {
|
|
94
|
-
[u.patientId]: AccessLevel.WRITE,
|
|
95
|
-
},
|
|
96
|
-
}));
|
|
97
|
-
// Decrypting this AES Key to compare it with AES key decrypted with new key in the next steps
|
|
98
|
-
yield api.cryptoApi.forceReload();
|
|
99
|
-
const originalDecryptedData = yield decryptDataForPair(api, u.patientId, delegateUser.healthcarePartyId);
|
|
100
|
-
(0, chai_1.expect)(originalDecryptedData.failedDecryptionsCount).to.equal(0);
|
|
101
|
-
(0, chai_1.expect)(originalDecryptedData.successfulDecryptions.length).to.equal(2);
|
|
102
|
-
// And creates a new one
|
|
103
|
-
const newKey = yield api.cryptoApi.primitives.RSA.generateKeyPair(icc_x_api_1.ShaVersion.Sha256);
|
|
104
|
-
const publicKey = (0, icc_x_api_1.ua2hex)(yield api.cryptoApi.primitives.RSA.exportKey(newKey.publicKey, 'spki'));
|
|
105
|
-
const apiAfterNewKey = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, {
|
|
106
|
-
username: env.dataOwnerDetails[test_utils_1.patUsername].user,
|
|
107
|
-
password: env.dataOwnerDetails[test_utils_1.patUsername].password,
|
|
108
|
-
}, new TestCryptoStrategies_1.TestCryptoStrategies(newKey), crypto_1.webcrypto, fetch, {
|
|
109
|
-
storage: new TestStorage_1.TestStorage(),
|
|
110
|
-
keyStorage: new TestStorage_1.TestKeyStorage(),
|
|
111
|
-
});
|
|
112
|
-
const user = yield apiAfterNewKey.userApi.getCurrentUser();
|
|
113
|
-
yield apiAfterNewKey.icureMaintenanceTaskApi.createMaintenanceTasksForNewKeypair(user, newKey);
|
|
114
|
-
// User can get not encrypted information from iCure (HCP, ...)
|
|
115
|
-
const hcp = yield apiAfterNewKey.healthcarePartyApi.getHealthcareParty(delegateUser.healthcarePartyId);
|
|
116
|
-
// User can create new data, using its new keyPair
|
|
117
|
-
const newRecordToDelegate = yield apiAfterNewKey.calendarItemApi.createCalendarItemWithHcParty(u, yield apiAfterNewKey.calendarItemApi.newInstance(u, new CalendarItem_1.CalendarItem({ id: `${u.id}-ci-to`, title: 'CI-TO' }), {
|
|
118
|
-
additionalDelegates: {
|
|
119
|
-
[hcp.id]: SecureDelegation_1.SecureDelegation.AccessLevelEnum.WRITE,
|
|
120
|
-
},
|
|
121
|
-
}));
|
|
122
|
-
(0, chai_1.expect)(newRecordToDelegate.id).to.be.not.null;
|
|
123
|
-
(0, chai_1.expect)(newRecordToDelegate.rev).to.be.not.null;
|
|
124
|
-
// But user can not decrypt data he previously created
|
|
125
|
-
const decryptedWithNewKey = yield decryptDataForPair(apiAfterNewKey, u.patientId, delegateUser.healthcarePartyId);
|
|
126
|
-
(0, chai_1.expect)(decryptedWithNewKey.failedDecryptionsCount).to.equal(2);
|
|
127
|
-
(0, chai_1.expect)(decryptedWithNewKey.successfulDecryptions.length).to.equal(1);
|
|
128
|
-
// Delegate user will therefore give user access back to data he previously created
|
|
129
|
-
// Hcp gets his maintenance tasks
|
|
130
|
-
yield delegateApi.cryptoApi.forceReload();
|
|
131
|
-
const maintenanceTask = KeyPairUpdateRequest_1.KeyPairUpdateRequest.fromMaintenanceTask(yield _getHcpKeyUpdateMaintenanceTask(delegateApi));
|
|
132
|
-
(0, chai_1.expect)(maintenanceTask.concernedDataOwnerId).equals(patient.id);
|
|
133
|
-
(0, chai_1.expect)(maintenanceTask.newPublicKey).equals(publicKey);
|
|
134
|
-
yield delegateApi.icureMaintenanceTaskApi.applyKeyPairUpdate(maintenanceTask);
|
|
135
|
-
const updatedDataOwner = yield delegateApi.dataOwnerApi.getCryptoActorStub(maintenanceTask.concernedDataOwnerId);
|
|
136
|
-
(0, chai_1.expect)(updatedDataOwner.type).to.be.equal('patient');
|
|
137
|
-
(0, chai_1.expect)(updatedDataOwner.stub).to.not.be.undefined;
|
|
138
|
-
(0, chai_1.expect)(updatedDataOwner.stub).to.not.be.null;
|
|
139
|
-
const apiAfterSharedBack = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, {
|
|
140
|
-
username: env.dataOwnerDetails[test_utils_1.patUsername].user,
|
|
141
|
-
password: env.dataOwnerDetails[test_utils_1.patUsername].password,
|
|
142
|
-
}, new TestCryptoStrategies_1.TestCryptoStrategies(newKey), crypto_1.webcrypto, fetch, {
|
|
143
|
-
storage: new TestStorage_1.TestStorage(),
|
|
144
|
-
keyStorage: new TestStorage_1.TestKeyStorage(),
|
|
145
|
-
});
|
|
146
|
-
// User can access his previous data again
|
|
147
|
-
yield apiAfterSharedBack.cryptoApi.forceReload();
|
|
148
|
-
const decryptedAfterShareBack = yield decryptDataForPair(apiAfterSharedBack, u.patientId, delegateUser.healthcarePartyId);
|
|
149
|
-
(0, chai_1.expect)(decryptedAfterShareBack.failedDecryptionsCount).to.equal(0);
|
|
150
|
-
(0, chai_1.expect)(decryptedAfterShareBack.successfulDecryptions.length).to.equal(3);
|
|
151
|
-
checkDecryptedDataHas(decryptedAfterShareBack.successfulDecryptions, originalDecryptedData.successfulDecryptions[0]);
|
|
152
|
-
checkDecryptedDataHas(decryptedAfterShareBack.successfulDecryptions, originalDecryptedData.successfulDecryptions[1]);
|
|
153
|
-
checkDecryptedDataHas(decryptedAfterShareBack.successfulDecryptions, decryptedWithNewKey.successfulDecryptions[0]);
|
|
154
|
-
const initialRecordFromDelegateAfterSharedBack = yield apiAfterSharedBack.calendarItemApi.getCalendarItemWithUser(u, initialRecordFromDelegate.id);
|
|
155
|
-
(0, chai_1.expect)(initialRecordFromDelegateAfterSharedBack.id).to.be.equal(initialRecordFromDelegate.id);
|
|
156
|
-
(0, chai_1.expect)(initialRecordFromDelegateAfterSharedBack.rev).to.be.equal(initialRecordFromDelegate.rev);
|
|
157
|
-
(0, chai_1.expect)(initialRecordFromDelegateAfterSharedBack.title).to.be.equal(initialRecordFromDelegate.title);
|
|
158
|
-
const initialRecordToDelegateAfterSharedBack = yield apiAfterSharedBack.calendarItemApi.getCalendarItemWithUser(u, initialRecordToDelegate.id);
|
|
159
|
-
(0, chai_1.expect)(initialRecordToDelegateAfterSharedBack.id).to.be.equal(initialRecordToDelegate.id);
|
|
160
|
-
(0, chai_1.expect)(initialRecordToDelegateAfterSharedBack.rev).to.be.equal(initialRecordToDelegate.rev);
|
|
161
|
-
(0, chai_1.expect)(initialRecordToDelegateAfterSharedBack.title).to.be.equal(initialRecordToDelegate.title);
|
|
162
|
-
}));
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
// TODO test that EXACTLY ONE maintenance task is created for each delegator AND delegate in a exchange key with the data owner with the new key
|
|
166
|
-
//# sourceMappingURL=delegate-ci-to-patient-with-missing-keys-test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delegate-ci-to-patient-with-missing-keys-test.js","sourceRoot":"","sources":["../../../../test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAAuE;AACvE,sEAAkE;AAClE,0DAAyH;AACzH,iCAA4C;AAE5C,mCAAkC;AAClC,4BAAyB;AAEzB,+BAA6B;AAC7B,8GAA0G;AAC1G,uDAAiJ;AACjJ,yDAAqE;AACrE,2EAAuE;AACvE,8FAA0F;AAC1F,8EAA0E;AAC1E,mDAAmE;AACnE,IAAO,WAAW,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAErD,SAAe,+BAA+B,CAAC,WAAiB;;QAC9D,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,cAAc,EAAE,CAAA;QAC/D,MAAM,aAAa,GAAiC,MAAM,WAAW,CAAC,kBAAkB,CAAC,gCAAgC,CACvH,YAAa,EACb,SAAS,EACT,SAAS,EACT,IAAI,mCAA0B,CAAC;YAC7B,MAAM,EAAE,IAAI,+DAA8B,CAAC;gBACzC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,MAAM;aACpC,CAAC;SACH,CAAC,CACH,CAAA;QAED,OAAO,aAAa,CAAC,IAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAA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AAC,uBAAuB,CAAC,EAAE,CAAC,CAAA;YACzF,IAAA,aAAM,EAAC,sCAAsC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAA;YAC3F,IAAA,aAAM,EAAC,sCAAsC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAA;QACjG,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CAAA,CAAC,CAAA;AAEF,gJAAgJ","sourcesContent":["import { Apis, IcureApi, ShaVersion, ua2hex } from '../../../icc-x-api'\nimport { CalendarItem } from '../../../icc-api/model/CalendarItem'\nimport { FilterChainMaintenanceTask, MaintenanceTask, PaginatedListMaintenanceTask } from '../../../icc-api/model/models'\nimport { before, describe, it } from 'mocha'\n\nimport { webcrypto } from 'crypto'\nimport 'isomorphic-fetch'\n\nimport { expect } from 'chai'\nimport { MaintenanceTaskAfterDateFilter } from '../../../icc-x-api/filters/MaintenanceTaskAfterDateFilter'\nimport { createNewHcpApi, getApiAndAddPrivateKeysForUser, getEnvironmentInitializer, patUsername, setLocalStorage } from '../../utils/test_utils'\nimport { TestKeyStorage, TestStorage } from '../../utils/TestStorage'\nimport { TestCryptoStrategies } from '../../utils/TestCryptoStrategies'\nimport { KeyPairUpdateRequest } from '../../../icc-x-api/maintenance/KeyPairUpdateRequest'\nimport { SecureDelegation } from '../../../icc-api/model/SecureDelegation'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport AccessLevel = SecureDelegation.AccessLevelEnum\n\nasync function _getHcpKeyUpdateMaintenanceTask(delegateApi: Apis): Promise<MaintenanceTask> {\n const delegateUser = await delegateApi.userApi.getCurrentUser()\n const notifications: PaginatedListMaintenanceTask = await delegateApi.maintenanceTaskApi.filterMaintenanceTasksByWithUser(\n delegateUser!,\n undefined,\n undefined,\n new FilterChainMaintenanceTask({\n filter: new MaintenanceTaskAfterDateFilter({\n date: new Date().getTime() - 100000,\n }),\n })\n )\n\n return notifications.rows!.sort((a, b) => a.created! - b.created!)[notifications.rows!.length - 1]\n}\n\nsetLocalStorage(fetch)\n\nlet env: TestVars\n\ndescribe('Full battery of tests on crypto and keys', async function () {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n // TODO should give access back to old and new keys\n it(`Create calendar item as a patient and get access back`, async () => {\n async function decryptDataForPair(\n api: Apis,\n dataOwner1: string,\n dataOwner2: string\n ): Promise<{\n failedDecryptionsCount: number\n successfulDecryptions: { rawKey: string; accessControlSecret: string }[]\n }> {\n const allExchangeData = [\n ...(await api.cryptoApi.exchangeData.base.getExchangeDataByDelegatorDelegatePair(dataOwner1, dataOwner2)),\n ...(await api.cryptoApi.exchangeData.base.getExchangeDataByDelegatorDelegatePair(dataOwner2, dataOwner1)),\n ]\n let failedDecryptionsCount = 0\n const successfulDecryptions: { rawKey: string; accessControlSecret: string }[] = []\n for (const exchangeData of allExchangeData) {\n const decryptedKey = await api.cryptoApi.exchangeData.base.tryDecryptExchangeKeys(\n [exchangeData],\n api.cryptoApi.userKeysManager.getDecryptionKeys()\n )\n const decryptedAccessControlSecret = await api.cryptoApi.exchangeData.base.tryDecryptAccessControlSecret(\n [exchangeData],\n api.cryptoApi.userKeysManager.getDecryptionKeys()\n )\n if (decryptedKey.failedDecryptions.length > 0 || decryptedAccessControlSecret.failedDecryptions.length > 0) {\n failedDecryptionsCount++\n } else {\n successfulDecryptions.push({\n rawKey: ua2hex(await api.cryptoApi.primitives.AES.exportKey(decryptedKey.successfulDecryptions[0], 'raw')),\n accessControlSecret: decryptedAccessControlSecret.successfulDecryptions[0],\n })\n }\n }\n return { failedDecryptionsCount, successfulDecryptions }\n }\n\n function checkDecryptedDataHas(\n decryptedData: { rawKey: string; accessControlSecret: string }[],\n expected: { rawKey: string; accessControlSecret: string }\n ) {\n expect(decryptedData.filter((d) => d.rawKey === expected.rawKey && d.accessControlSecret === expected.accessControlSecret)).to.have.length(1)\n }\n\n const previousPubKey = env!.dataOwnerDetails[patUsername].publicKey\n const api = await getApiAndAddPrivateKeysForUser(env!.iCureUrl, env!.dataOwnerDetails[patUsername])\n const u = await api.userApi.getCurrentUser()\n\n const delegateInfo = await createNewHcpApi(env!)\n const delegateApi = delegateInfo.api\n const delegateUser = delegateInfo.user\n const delegateHcp = await delegateApi.healthcarePartyApi.getHealthcareParty(delegateUser.healthcarePartyId!)\n\n const patient = await api.patientApi.getPatientWithUser(u, u.patientId!)\n\n // Create a Record to share with delegateHcp: this will trigger the creation of a new aes exchange key as well\n const initialRecordToDelegate = await api.calendarItemApi.createCalendarItemWithHcParty(\n u,\n await api.calendarItemApi.newInstance(u, new CalendarItem({ id: `${u.id}-ci-initial-to`, title: 'CI-INITIAL-TO' }), {\n additionalDelegates: {\n [delegateHcp!.id!]: AccessLevel.WRITE,\n },\n })\n )\n const initialRecordFromDelegate = await delegateApi.calendarItemApi.createCalendarItemWithHcParty(\n u,\n await delegateApi.calendarItemApi.newInstance(delegateUser, new CalendarItem({ id: `${u.id}-ci-initial-from`, title: 'CI-INITIAL-FROM' }), {\n additionalDelegates: {\n [u.patientId!]: AccessLevel.WRITE,\n },\n })\n )\n\n // Decrypting this AES Key to compare it with AES key decrypted with new key in the next steps\n await api.cryptoApi.forceReload()\n const originalDecryptedData = await decryptDataForPair(api, u.patientId!, delegateUser.healthcarePartyId!)\n expect(originalDecryptedData.failedDecryptionsCount).to.equal(0)\n expect(originalDecryptedData.successfulDecryptions.length).to.equal(2)\n\n // And creates a new one\n const newKey = await api.cryptoApi.primitives.RSA.generateKeyPair(ShaVersion.Sha256)\n const publicKey = ua2hex(await api.cryptoApi.primitives.RSA.exportKey(newKey.publicKey, 'spki'))\n const apiAfterNewKey = await IcureApi.initialise(\n env!.iCureUrl,\n {\n username: env!.dataOwnerDetails[patUsername].user,\n password: env!.dataOwnerDetails[patUsername].password,\n },\n new TestCryptoStrategies(newKey),\n webcrypto as unknown as Crypto,\n fetch,\n {\n storage: new TestStorage(),\n keyStorage: new TestKeyStorage(),\n }\n )\n const user = await apiAfterNewKey.userApi.getCurrentUser()\n await apiAfterNewKey.icureMaintenanceTaskApi.createMaintenanceTasksForNewKeypair(user, newKey)\n\n // User can get not encrypted information from iCure (HCP, ...)\n const hcp = await apiAfterNewKey.healthcarePartyApi.getHealthcareParty(delegateUser!.healthcarePartyId!)\n\n // User can create new data, using its new keyPair\n const newRecordToDelegate = await apiAfterNewKey.calendarItemApi.createCalendarItemWithHcParty(\n u,\n await apiAfterNewKey.calendarItemApi.newInstance(u, new CalendarItem({ id: `${u.id}-ci-to`, title: 'CI-TO' }), {\n additionalDelegates: {\n [hcp!.id!]: SecureDelegation.AccessLevelEnum.WRITE,\n },\n })\n )\n expect(newRecordToDelegate.id).to.be.not.null\n expect(newRecordToDelegate.rev).to.be.not.null\n\n // But user can not decrypt data he previously created\n const decryptedWithNewKey = await decryptDataForPair(apiAfterNewKey, u.patientId!, delegateUser.healthcarePartyId!)\n expect(decryptedWithNewKey.failedDecryptionsCount).to.equal(2)\n expect(decryptedWithNewKey.successfulDecryptions.length).to.equal(1)\n\n // Delegate user will therefore give user access back to data he previously created\n\n // Hcp gets his maintenance tasks\n await delegateApi.cryptoApi.forceReload()\n const maintenanceTask = KeyPairUpdateRequest.fromMaintenanceTask(await _getHcpKeyUpdateMaintenanceTask(delegateApi))\n\n expect(maintenanceTask.concernedDataOwnerId).equals(patient.id)\n expect(maintenanceTask.newPublicKey).equals(publicKey)\n\n await delegateApi.icureMaintenanceTaskApi.applyKeyPairUpdate(maintenanceTask)\n const updatedDataOwner = await delegateApi.dataOwnerApi.getCryptoActorStub(maintenanceTask.concernedDataOwnerId)\n\n expect(updatedDataOwner.type).to.be.equal('patient')\n expect(updatedDataOwner.stub).to.not.be.undefined\n expect(updatedDataOwner.stub).to.not.be.null\n\n const apiAfterSharedBack = await IcureApi.initialise(\n env!.iCureUrl,\n {\n username: env!.dataOwnerDetails[patUsername].user,\n password: env!.dataOwnerDetails[patUsername].password,\n },\n new TestCryptoStrategies(newKey),\n webcrypto as unknown as Crypto,\n fetch,\n {\n storage: new TestStorage(),\n keyStorage: new TestKeyStorage(),\n }\n )\n // User can access his previous data again\n await apiAfterSharedBack.cryptoApi.forceReload()\n const decryptedAfterShareBack = await decryptDataForPair(apiAfterSharedBack, u.patientId!, delegateUser.healthcarePartyId!)\n expect(decryptedAfterShareBack.failedDecryptionsCount).to.equal(0)\n expect(decryptedAfterShareBack.successfulDecryptions.length).to.equal(3)\n checkDecryptedDataHas(decryptedAfterShareBack.successfulDecryptions, originalDecryptedData.successfulDecryptions[0])\n checkDecryptedDataHas(decryptedAfterShareBack.successfulDecryptions, originalDecryptedData.successfulDecryptions[1])\n checkDecryptedDataHas(decryptedAfterShareBack.successfulDecryptions, decryptedWithNewKey.successfulDecryptions[0])\n\n const initialRecordFromDelegateAfterSharedBack = await apiAfterSharedBack.calendarItemApi.getCalendarItemWithUser(\n u,\n initialRecordFromDelegate.id!\n )\n expect(initialRecordFromDelegateAfterSharedBack.id).to.be.equal(initialRecordFromDelegate.id)\n expect(initialRecordFromDelegateAfterSharedBack.rev).to.be.equal(initialRecordFromDelegate.rev)\n expect(initialRecordFromDelegateAfterSharedBack.title).to.be.equal(initialRecordFromDelegate.title)\n const initialRecordToDelegateAfterSharedBack = await apiAfterSharedBack.calendarItemApi.getCalendarItemWithUser(u, initialRecordToDelegate.id!)\n expect(initialRecordToDelegateAfterSharedBack.id).to.be.equal(initialRecordToDelegate.id)\n expect(initialRecordToDelegateAfterSharedBack.rev).to.be.equal(initialRecordToDelegate.rev)\n expect(initialRecordToDelegateAfterSharedBack.title).to.be.equal(initialRecordToDelegate.title)\n })\n})\n\n// TODO test that EXACTLY ONE maintenance task is created for each delegator AND delegate in a exchange key with the data owner with the new key\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|