@icure/api 8.6.19 → 8.7.1
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 +79 -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 +3 -3
- package/icc-x-api/utils/formatting-util.js +22 -23
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smart-auth-provider-test.js","sourceRoot":"","sources":["../../../../test/icc-x-api/auth/smart-auth-provider-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mDAAmE;AACnE,iCAA8B;AAC9B,uDAAqJ;AACrJ,kDAAkH;AAClH,8CAAyD;AACzD,4BAAyB;AACzB,iFAAgH;AAChH,+BAA6B;AAC7B,mCAAmC;AACnC,IAAO,aAAa,GAAG,sBAAS,CAAC,aAAa,CAAA;AAC9C,mCAA6B;AAC7B,qCAA8B;AAC9B,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AAEtB,IAAI,GAAa,CAAA;AACjB,IAAI,OAAmB,CAAA;AAEvB,QAAQ,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KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QACzD,IAAA,aAAM,EAAC,MAAM,CAAC,IAAI,CAAC,MAAA,cAAc,CAAC,oBAAoB,mCAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAA;IAChF,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { before } from 'mocha'\nimport { createNewHcpApi, createUserInMultipleGroups, getEnvironmentInitializer, itNoLite, setLocalStorage, TestUtils } from '../../utils/test_utils'\nimport { AuthenticationProvider, BasicAuthenticationProvider, NoAuthenticationProvider } from '../../../icc-x-api'\nimport { IccAuthApi, IccUserApi } from '../../../icc-api'\nimport 'isomorphic-fetch'\nimport { AuthSecretDetails, AuthSecretType, SmartAuthProvider } from '../../../icc-x-api/auth/SmartAuthProvider'\nimport { expect } from 'chai'\nimport { randomUUID } from 'crypto'\nimport initMasterApi = TestUtils.initMasterApi\nimport { fail } from 'assert'\nimport { TOTP } from 'otpauth'\nsetLocalStorage(fetch)\n\nlet env: TestVars\nlet authApi: IccAuthApi\n\ndescribe('Smart authentication provider', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n authApi = new IccAuthApi(env.iCureUrl, {}, new NoAuthenticationProvider(), fetch)\n })\n\n function userApiWithProvider(authProvider: AuthenticationProvider): IccUserApi {\n return new IccUserApi(env.iCureUrl, {}, authProvider, fetch)\n }\n\n it('Should automatically ask for secret to get a new token, and reasks the secret if it is not valid', async () => {\n const { credentials } = await createNewHcpApi(env)\n let calls = 0\n const authProvider = await SmartAuthProvider.initialise(authApi, credentials.user, {\n getSecret: async (acceptedSecrets: AuthSecretType[], previousAttempts: AuthSecretDetails[]) => {\n expect(acceptedSecrets).to.include(AuthSecretType.PASSWORD)\n expect(acceptedSecrets).to.include(AuthSecretType.LONG_LIVED_TOKEN)\n expect(acceptedSecrets).to.include(AuthSecretType.SHORT_LIVED_TOKEN)\n expect(acceptedSecrets).to.not.include(AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN)\n if (calls == 0) {\n expect(previousAttempts).to.be.empty\n } else if (calls == 1) {\n expect(previousAttempts).to.have.length(1)\n expect(previousAttempts[0].value).to.equal('wrong')\n expect(previousAttempts[0].secretType).to.equal(AuthSecretType.LONG_LIVED_TOKEN)\n } else fail(`Unexpected number of calls: ${calls}`)\n return calls++ == 0\n ? { value: 'wrong', secretType: AuthSecretType.LONG_LIVED_TOKEN } // pragma: allowlist secret\n : { value: credentials.password, secretType: AuthSecretType.LONG_LIVED_TOKEN }\n },\n })\n const userApi = userApiWithProvider(authProvider)\n const user = await userApi.getCurrentUser()\n expect(user.healthcarePartyId).to.equal(credentials.dataOwnerId)\n expect(calls).to.equal(2)\n })\n\n itNoLite(\n 'Should automatically ask for a more powerful secret to perform elevated-security operations if the available secret/token is not good enough',\n async () => {\n const { credentials, api } = await createNewHcpApi(env)\n const initialUser = await api.userApi.getCurrentUser()\n const masterApi = await initMasterApi(env)\n const userToken = randomUUID()\n const userPw = randomUUID()\n const userWithLongTokenAndPw = await masterApi.userApi.modifyUser({\n ...initialUser,\n passwordHash: userPw,\n authenticationTokens: {\n 'test-long-lived-token': {\n token: userToken,\n creationTime: Date.now(),\n validity: 60 * 60 * 24 * 7,\n },\n },\n })\n let calls = 0\n const authProvider = await SmartAuthProvider.initialise(authApi, credentials.user, {\n getSecret: async (acceptedSecrets: AuthSecretType[], previousAttempts: AuthSecretDetails[]) => {\n if (calls == 0) {\n expect(acceptedSecrets).to.include(AuthSecretType.PASSWORD)\n expect(acceptedSecrets).to.include(AuthSecretType.LONG_LIVED_TOKEN)\n expect(acceptedSecrets).to.include(AuthSecretType.SHORT_LIVED_TOKEN)\n expect(acceptedSecrets).to.not.include(AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN)\n expect(previousAttempts).to.be.empty\n calls++\n return { value: userToken, secretType: AuthSecretType.LONG_LIVED_TOKEN }\n } else if (calls == 1) {\n expect(acceptedSecrets).to.include(AuthSecretType.PASSWORD)\n expect(acceptedSecrets).to.not.include(AuthSecretType.LONG_LIVED_TOKEN)\n expect(acceptedSecrets).to.include(AuthSecretType.SHORT_LIVED_TOKEN)\n expect(acceptedSecrets).to.not.include(AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN)\n expect(previousAttempts).to.be.empty\n calls++\n return { value: userPw, secretType: AuthSecretType.PASSWORD }\n } else throw new Error(`Unexpected number of calls: ${calls}`)\n },\n })\n const userApi = userApiWithProvider(authProvider)\n expect((await userApi.getCurrentUser()).rev).to.equal(userWithLongTokenAndPw.rev)\n expect(calls).to.equal(1)\n const newPw = randomUUID()\n const userWithNewPw = await userApi.modifyUser({ ...userWithLongTokenAndPw, passwordHash: newPw })\n expect(userWithNewPw.rev).to.not.equal(userWithLongTokenAndPw.rev)\n expect(calls).to.equal(2)\n const retrievedWithNewPw = await userApiWithProvider(new BasicAuthenticationProvider(credentials.user, newPw)).getCurrentUser()\n expect(retrievedWithNewPw.rev).to.equal(userWithNewPw.rev)\n const couldRetrieveWithOldPw = await userApiWithProvider(new BasicAuthenticationProvider(credentials.user, userPw))\n .getCurrentUser()\n .then(\n () => true,\n () => false\n )\n expect(couldRetrieveWithOldPw).to.be.false\n }\n )\n\n itNoLite('Should automatically ask for TOTP after password if user has 2fa enabled', async () => {\n const { credentials, api } = await createNewHcpApi(env)\n const initialUser = await api.userApi.getCurrentUser()\n const masterApi = await initMasterApi(env)\n const totpSecret = 'AAPX7PW2RJIGZ3D4' // pragma: allowlist secret (fake secret generated only for test)\n const totp = new TOTP({\n algorithm: 'SHA1',\n digits: 6,\n period: 30,\n secret: totpSecret,\n })\n const userPw = randomUUID()\n await masterApi.userApi.enable2fa(initialUser.id!, totpSecret)\n const userWithPwAnd2fa = await masterApi.userApi.modifyUser({\n ...initialUser,\n passwordHash: userPw,\n })\n let calls = 0\n const authProvider = await SmartAuthProvider.initialise(authApi, credentials.user, {\n getSecret: async (acceptedSecrets: AuthSecretType[], previousAttempts: AuthSecretDetails[]) => {\n if (calls == 0) {\n expect(acceptedSecrets).to.include(AuthSecretType.PASSWORD)\n expect(acceptedSecrets).to.include(AuthSecretType.LONG_LIVED_TOKEN)\n expect(acceptedSecrets).to.include(AuthSecretType.SHORT_LIVED_TOKEN)\n expect(acceptedSecrets).to.not.include(AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN)\n expect(previousAttempts).to.be.empty\n calls++\n return { value: userPw, secretType: AuthSecretType.PASSWORD }\n } else if (calls == 1 || calls == 2) {\n expect(acceptedSecrets).to.have.members([AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN])\n if (calls == 1) expect(previousAttempts).to.be.empty\n if (calls == 2) expect(previousAttempts).to.have.length(1)\n return calls++ == 1\n ? { value: totp.generate() + '13', secretType: AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN }\n : { value: totp.generate(), secretType: AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN }\n } else throw new Error(`Unexpected number of calls: ${calls}`)\n },\n })\n const userApi = userApiWithProvider(authProvider)\n expect((await userApi.getCurrentUser()).rev).to.equal(userWithPwAnd2fa.rev)\n expect(calls).to.equal(3)\n })\n\n itNoLite('Should ask for TOTP directly if password is cached', async () => {\n const { credentials, api } = await createNewHcpApi(env)\n const initialUser = await api.userApi.getCurrentUser()\n const masterApi = await initMasterApi(env)\n const totpSecret = 'AAPX7PW2RJIGZ3D4' // pragma: allowlist secret (fake secret generated only for test)\n const totp = new TOTP({\n algorithm: 'SHA1',\n digits: 6,\n period: 30,\n secret: totpSecret,\n })\n const userPw = randomUUID()\n await masterApi.userApi.enable2fa(initialUser.id!, totpSecret)\n const userWithPwAnd2fa = await masterApi.userApi.modifyUser({\n ...initialUser,\n passwordHash: userPw,\n })\n let calls = 0\n const authProvider = await SmartAuthProvider.initialise(\n authApi,\n credentials.user,\n {\n getSecret: async (acceptedSecrets: AuthSecretType[], previousAttempts: AuthSecretDetails[]) => {\n expect(acceptedSecrets).to.have.members([AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN])\n expect(previousAttempts).to.be.empty\n expect(calls++).to.equal(0)\n return { value: totp.generate(), secretType: AuthSecretType.TWO_FACTOR_AUTHENTICATION_TOKEN }\n },\n },\n {\n initialSecret: { password: userPw },\n }\n )\n const userApi = userApiWithProvider(authProvider)\n expect((await userApi.getCurrentUser()).rev).to.equal(userWithPwAnd2fa.rev)\n expect(calls).to.equal(1)\n })\n\n itNoLite('Switched provider should keep cached secrets and should be able to have elevated security context', async () => {\n const details = await createUserInMultipleGroups(env)\n let calls = 0\n const authProvider = await SmartAuthProvider.initialise(authApi, details.userLogin, {\n getSecret: async (acceptedSecrets: AuthSecretType[], previousAttempts: AuthSecretDetails[]) => {\n expect(acceptedSecrets).to.have.include(AuthSecretType.PASSWORD)\n expect(previousAttempts).to.be.empty\n expect(calls++).to.equal(0)\n return { value: details.userPw12, secretType: AuthSecretType.PASSWORD }\n },\n })\n const defaultGroupUserApi = userApiWithProvider(authProvider)\n const defaultGroupUser = await defaultGroupUserApi.getCurrentUser()\n const otherGroupId = details.group1.id == defaultGroupUser.groupId ? details.group2.id : details.group1.id\n const matches = await defaultGroupUserApi.getMatchingUsers()\n const switchedUserApi = userApiWithProvider(await authProvider.switchGroup(otherGroupId!, matches))\n const switchedUser = await switchedUserApi.getCurrentUser()\n expect(switchedUser.id).to.not.equal(defaultGroupUser.id)\n expect(switchedUser.groupId).to.equal(otherGroupId)\n const updatedDefault = await switchedUserApi.modifyUser({\n ...switchedUser,\n authenticationTokens: {\n 'new-token': {\n token: randomUUID(),\n creationTime: Date.now(),\n validity: 60 * 60 * 24 * 7,\n },\n },\n })\n expect(updatedDefault.rev).to.not.equal(switchedUser.rev)\n expect(Object.keys(updatedDefault.authenticationTokens ?? {})).to.not.be.empty\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|
|
@@ -1,122 +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 mocha_1 = require("mocha");
|
|
13
|
-
const test_utils_1 = require("../utils/test_utils");
|
|
14
|
-
const types_1 = require("@icure/test-setup/types");
|
|
15
|
-
const DataOwnerTypeEnum_1 = require("../../icc-api/model/DataOwnerTypeEnum");
|
|
16
|
-
const icc_x_api_1 = require("../../icc-x-api");
|
|
17
|
-
const chai_1 = require("chai");
|
|
18
|
-
const TestStorage_1 = require("../utils/TestStorage");
|
|
19
|
-
const crypto_1 = require("crypto");
|
|
20
|
-
require("isomorphic-fetch");
|
|
21
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
22
|
-
let env;
|
|
23
|
-
describe('Autofix anonymity tests', () => {
|
|
24
|
-
(0, mocha_1.before)(function () {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
this.timeout(600000);
|
|
27
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
28
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
function initApi(dataOwnerType, isAnonymous) {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const cryptoStrats = {
|
|
34
|
-
dataOwnerRequiresAnonymousDelegation(dataOwner) {
|
|
35
|
-
if (isAnonymous)
|
|
36
|
-
return dataOwner.type == dataOwnerType;
|
|
37
|
-
else
|
|
38
|
-
return false;
|
|
39
|
-
},
|
|
40
|
-
generateNewKeyForDataOwner(self, cryptoPrimitives) {
|
|
41
|
-
throw new Error('This method should not be necessary for this test');
|
|
42
|
-
},
|
|
43
|
-
recoverAndVerifySelfHierarchyKeys(keysData, cryptoPrimitives) {
|
|
44
|
-
throw new Error('This method should not be necessary for this test');
|
|
45
|
-
},
|
|
46
|
-
verifyDelegatePublicKeys(delegate, publicKeys, cryptoPrimitives) {
|
|
47
|
-
return Promise.resolve(publicKeys);
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
let userDetails;
|
|
51
|
-
if (dataOwnerType == DataOwnerTypeEnum_1.DataOwnerTypeEnum.Patient) {
|
|
52
|
-
userDetails = (yield (0, test_utils_1.createNewPatientApi)(env)).credentials;
|
|
53
|
-
}
|
|
54
|
-
else if (dataOwnerType == DataOwnerTypeEnum_1.DataOwnerTypeEnum.Hcp) {
|
|
55
|
-
userDetails = (yield (0, test_utils_1.createNewHcpApi)(env)).credentials;
|
|
56
|
-
}
|
|
57
|
-
else
|
|
58
|
-
throw new Error('Unsupported data owner type');
|
|
59
|
-
const storage = yield (0, TestStorage_1.testStorageWithKeys)([
|
|
60
|
-
{
|
|
61
|
-
dataOwnerId: userDetails.dataOwnerId,
|
|
62
|
-
pairs: [{ keyPair: { publicKey: userDetails.publicKey, privateKey: userDetails.privateKey }, shaVersion: icc_x_api_1.ShaVersion.Sha1 }],
|
|
63
|
-
},
|
|
64
|
-
]);
|
|
65
|
-
const api = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, { username: userDetails.user, password: userDetails.password }, cryptoStrats, crypto_1.webcrypto, fetch, {
|
|
66
|
-
keyStorage: storage.keyStorage,
|
|
67
|
-
entryKeysFactory: storage.keyFactory,
|
|
68
|
-
storage: storage.storage,
|
|
69
|
-
});
|
|
70
|
-
(0, chai_1.expect)((yield api.dataOwnerApi.getCurrentDataOwnerStub()).type).to.eq(dataOwnerType);
|
|
71
|
-
return api;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function doTest(dataOwnerType, isAnonymous) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
const api = yield initApi(dataOwnerType, isAnonymous);
|
|
77
|
-
const user = yield api.userApi.getCurrentUser();
|
|
78
|
-
const createdWithNewInstance = yield api.patientApi.createPatientWithUser(user, yield api.patientApi.newInstance(user, { firstName: 'q', lastName: 'q' }));
|
|
79
|
-
const createdByBackend = yield api.agendaApi.createAgenda({ id: api.cryptoApi.primitives.randomUuid(), name: 'whatever' });
|
|
80
|
-
if (isAnonymous) {
|
|
81
|
-
(0, chai_1.expect)(createdWithNewInstance.author).to.eq(undefined);
|
|
82
|
-
(0, chai_1.expect)(createdWithNewInstance.responsible).to.eq(undefined);
|
|
83
|
-
(0, chai_1.expect)(createdByBackend.author).to.eq(undefined);
|
|
84
|
-
(0, chai_1.expect)(createdByBackend.responsible).to.eq(undefined);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
const doId = api.dataOwnerApi.getDataOwnerIdOf(user);
|
|
88
|
-
(0, chai_1.expect)(createdWithNewInstance.author).to.eq(user.id);
|
|
89
|
-
(0, chai_1.expect)(createdWithNewInstance.responsible).to.eq(doId);
|
|
90
|
-
(0, chai_1.expect)(createdByBackend.author).to.eq(user.id);
|
|
91
|
-
(0, chai_1.expect)(createdByBackend.responsible).to.eq(doId);
|
|
92
|
-
}
|
|
93
|
-
const modified = yield api.agendaApi.modifyAgenda(Object.assign(Object.assign({}, createdByBackend), { name: 'whatever 2' }));
|
|
94
|
-
if (isAnonymous) {
|
|
95
|
-
(0, chai_1.expect)(createdWithNewInstance.author).to.eq(undefined);
|
|
96
|
-
(0, chai_1.expect)(createdWithNewInstance.responsible).to.eq(undefined);
|
|
97
|
-
(0, chai_1.expect)(createdByBackend.author).to.eq(undefined);
|
|
98
|
-
(0, chai_1.expect)(createdByBackend.responsible).to.eq(undefined);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
const doId = api.dataOwnerApi.getDataOwnerIdOf(user);
|
|
102
|
-
(0, chai_1.expect)(createdWithNewInstance.author).to.eq(user.id);
|
|
103
|
-
(0, chai_1.expect)(createdWithNewInstance.responsible).to.eq(doId);
|
|
104
|
-
(0, chai_1.expect)(createdByBackend.author).to.eq(user.id);
|
|
105
|
-
(0, chai_1.expect)(createdByBackend.responsible).to.eq(doId);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
it('Entity created by a patient should omit author and responsible if crypto strategies require anonymous delegations for the user', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
-
yield doTest(DataOwnerTypeEnum_1.DataOwnerTypeEnum.Patient, true);
|
|
111
|
-
}));
|
|
112
|
-
it('Entity created by a patient should autofix author and responsible if crypto strategies does not require anonymous delegations for the user', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
-
yield doTest(DataOwnerTypeEnum_1.DataOwnerTypeEnum.Patient, false);
|
|
114
|
-
}));
|
|
115
|
-
it('Entity created by a HCP should omit author and responsible if crypto strategies require anonymous delegations for the user', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
-
yield doTest(DataOwnerTypeEnum_1.DataOwnerTypeEnum.Hcp, true);
|
|
117
|
-
}));
|
|
118
|
-
it('Entity created by a HCP should autofix author and responsible if crypto strategies does not require anonymous delegations for the user', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
|
-
yield doTest(DataOwnerTypeEnum_1.DataOwnerTypeEnum.Hcp, false);
|
|
120
|
-
}));
|
|
121
|
-
});
|
|
122
|
-
//# sourceMappingURL=autofix-anonymity-test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autofix-anonym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CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;YAClD,CAAC;QACH,CAAC;KAAA;IAED,EAAE,CAAC,gIAAgI,EAAE,GAAS,EAAE;QAC9I,MAAM,MAAM,CAAC,qCAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC/C,CAAC,CAAA,CAAC,CAAA;IAEF,EAAE,CAAC,4IAA4I,EAAE,GAAS,EAAE;QAC1J,MAAM,MAAM,CAAC,qCAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC,CAAA,CAAC,CAAA;IAEF,EAAE,CAAC,4HAA4H,EAAE,GAAS,EAAE;QAC1I,MAAM,MAAM,CAAC,qCAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC3C,CAAC,CAAA,CAAC,CAAA;IAEF,EAAE,CAAC,wIAAwI,EAAE,GAAS,EAAE;QACtJ,MAAM,MAAM,CAAC,qCAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC5C,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { before } from 'mocha'\nimport { createNewHcpApi, createNewPatientApi, getEnvironmentInitializer, setLocalStorage } from '../utils/test_utils'\nimport { getEnvVariables, TestVars, UserDetails } from '@icure/test-setup/types'\nimport { DataOwnerTypeEnum } from '../../icc-api/model/DataOwnerTypeEnum'\nimport { CryptoPrimitives, CryptoStrategies, IcureApi, KeyPair, ShaVersion } from '../../icc-x-api'\nimport { expect } from 'chai'\nimport { CryptoActorStubWithType } from '../../icc-api/model/CryptoActorStub'\nimport { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType'\nimport { testStorageWithKeys } from '../utils/TestStorage'\nimport { webcrypto } from 'crypto'\n\nimport 'isomorphic-fetch'\n\nsetLocalStorage(fetch)\n\nlet env: TestVars\n\ndescribe('Autofix anonymity tests', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n async function initApi(dataOwnerType: DataOwnerTypeEnum, isAnonymous: boolean): Promise<IcureApi> {\n const cryptoStrats: CryptoStrategies = {\n dataOwnerRequiresAnonymousDelegation(dataOwner: CryptoActorStubWithType): boolean {\n if (isAnonymous) return dataOwner.type == dataOwnerType\n else return false\n },\n generateNewKeyForDataOwner(self: DataOwnerWithType, cryptoPrimitives: CryptoPrimitives): Promise<KeyPair<CryptoKey> | boolean> {\n throw new Error('This method should not be necessary for this test')\n },\n recoverAndVerifySelfHierarchyKeys(\n keysData: {\n dataOwner: DataOwnerWithType\n unknownKeys: string[]\n unavailableKeys: string[]\n }[],\n cryptoPrimitives: CryptoPrimitives\n ): Promise<{\n [p: string]: { recoveredKeys: { [p: string]: KeyPair<CryptoKey> }; keyAuthenticity: { [p: string]: boolean } }\n }> {\n throw new Error('This method should not be necessary for this test')\n },\n verifyDelegatePublicKeys(delegate: CryptoActorStubWithType, publicKeys: string[], cryptoPrimitives: CryptoPrimitives): Promise<string[]> {\n return Promise.resolve(publicKeys)\n },\n }\n let userDetails: UserDetails\n if (dataOwnerType == DataOwnerTypeEnum.Patient) {\n userDetails = (await createNewPatientApi(env)).credentials\n } else if (dataOwnerType == DataOwnerTypeEnum.Hcp) {\n userDetails = (await createNewHcpApi(env)).credentials\n } else throw new Error('Unsupported data owner type')\n const storage = await testStorageWithKeys([\n {\n dataOwnerId: userDetails.dataOwnerId,\n pairs: [{ keyPair: { publicKey: userDetails.publicKey, privateKey: userDetails.privateKey }, shaVersion: ShaVersion.Sha1 }],\n },\n ])\n const api = await IcureApi.initialise(\n env.iCureUrl,\n { username: userDetails.user, password: userDetails.password },\n cryptoStrats,\n webcrypto as any,\n fetch,\n {\n keyStorage: storage.keyStorage,\n entryKeysFactory: storage.keyFactory,\n storage: storage.storage,\n }\n )\n expect((await api.dataOwnerApi.getCurrentDataOwnerStub()).type).to.eq(dataOwnerType)\n return api\n }\n\n async function doTest(dataOwnerType: DataOwnerTypeEnum, isAnonymous: boolean) {\n const api = await initApi(dataOwnerType, isAnonymous)\n const user = await api.userApi.getCurrentUser()\n const createdWithNewInstance = await api.patientApi.createPatientWithUser(\n user,\n await api.patientApi.newInstance(user, { firstName: 'q', lastName: 'q' })\n )\n const createdByBackend = await api.agendaApi.createAgenda({ id: api.cryptoApi.primitives.randomUuid(), name: 'whatever' })\n if (isAnonymous) {\n expect(createdWithNewInstance.author).to.eq(undefined)\n expect(createdWithNewInstance.responsible).to.eq(undefined)\n expect(createdByBackend.author).to.eq(undefined)\n expect(createdByBackend.responsible).to.eq(undefined)\n } else {\n const doId = api.dataOwnerApi.getDataOwnerIdOf(user)\n expect(createdWithNewInstance.author).to.eq(user.id)\n expect(createdWithNewInstance.responsible).to.eq(doId)\n expect(createdByBackend.author).to.eq(user.id)\n expect(createdByBackend.responsible).to.eq(doId)\n }\n const modified = await api.agendaApi.modifyAgenda({ ...createdByBackend, name: 'whatever 2' })\n if (isAnonymous) {\n expect(createdWithNewInstance.author).to.eq(undefined)\n expect(createdWithNewInstance.responsible).to.eq(undefined)\n expect(createdByBackend.author).to.eq(undefined)\n expect(createdByBackend.responsible).to.eq(undefined)\n } else {\n const doId = api.dataOwnerApi.getDataOwnerIdOf(user)\n expect(createdWithNewInstance.author).to.eq(user.id)\n expect(createdWithNewInstance.responsible).to.eq(doId)\n expect(createdByBackend.author).to.eq(user.id)\n expect(createdByBackend.responsible).to.eq(doId)\n }\n }\n\n it('Entity created by a patient should omit author and responsible if crypto strategies require anonymous delegations for the user', async () => {\n await doTest(DataOwnerTypeEnum.Patient, true)\n })\n\n it('Entity created by a patient should autofix author and responsible if crypto strategies does not require anonymous delegations for the user', async () => {\n await doTest(DataOwnerTypeEnum.Patient, false)\n })\n\n it('Entity created by a HCP should omit author and responsible if crypto strategies require anonymous delegations for the user', async () => {\n await doTest(DataOwnerTypeEnum.Hcp, true)\n })\n\n it('Entity created by a HCP should autofix author and responsible if crypto strategies does not require anonymous delegations for the user', async () => {\n await doTest(DataOwnerTypeEnum.Hcp, false)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|
|
@@ -1,168 +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 test_utils_1 = require("../utils/test_utils");
|
|
13
|
-
const types_1 = require("@icure/test-setup/types");
|
|
14
|
-
const chai_1 = require("chai");
|
|
15
|
-
require("isomorphic-fetch");
|
|
16
|
-
const icc_x_api_1 = require("../../icc-x-api");
|
|
17
|
-
const SecretIdUseOption_1 = require("../../icc-x-api/crypto/SecretIdUseOption");
|
|
18
|
-
var UseAnyConfidential = SecretIdUseOption_1.SecretIdUseOption.UseAnyConfidential;
|
|
19
|
-
var UseAnySharedWithParent = SecretIdUseOption_1.SecretIdUseOption.UseAnySharedWithParent;
|
|
20
|
-
const crypto_1 = require("crypto");
|
|
21
|
-
var UseAllConfidential = SecretIdUseOption_1.SecretIdUseOption.UseAllConfidential;
|
|
22
|
-
var UseAllSharedWithParent = SecretIdUseOption_1.SecretIdUseOption.UseAllSharedWithParent;
|
|
23
|
-
var UseNone = SecretIdUseOption_1.SecretIdUseOption.UseNone;
|
|
24
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
25
|
-
var env;
|
|
26
|
-
describe('test confidential helement', () => {
|
|
27
|
-
before(function () {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
this.timeout(600000);
|
|
30
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
31
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
it('confidential entity should be accessible only to user, non confidential should be accessible also to parent', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
-
// Use only the top of the hierarchy for simplicity of the test
|
|
36
|
-
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
|
|
37
|
-
const pat = yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' });
|
|
38
|
-
const modifiedPatient = (yield childApi.patientApi.initConfidentialSecretId(pat, childUser));
|
|
39
|
-
const patientSecretIdsForParent = yield parentApi.patientApi.decryptSecretIdsOf(modifiedPatient);
|
|
40
|
-
const patientSecretIdsForChild = yield childApi.patientApi.decryptSecretIdsOf(modifiedPatient);
|
|
41
|
-
(0, chai_1.expect)(patientSecretIdsForParent).to.have.length(1);
|
|
42
|
-
(0, chai_1.expect)(patientSecretIdsForChild).to.have.length(2);
|
|
43
|
-
(0, chai_1.expect)(patientSecretIdsForChild).to.contain(patientSecretIdsForParent[0]);
|
|
44
|
-
(0, chai_1.expect)(patientSecretIdsForChild[0]).to.not.eq(patientSecretIdsForChild[1]);
|
|
45
|
-
const confidentialHe = yield childApi.healthcareElementApi.createHealthElementWithUser(childUser, yield childApi.healthcareElementApi.newInstance(childUser, modifiedPatient, { descr: 'Confidential info' }, { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }));
|
|
46
|
-
(0, chai_1.expect)(confidentialHe.descr).to.eq('Confidential info');
|
|
47
|
-
const nonConfidentialHe = yield childApi.healthcareElementApi.createHealthElementWithUser(childUser, yield childApi.healthcareElementApi.newInstance(childUser, modifiedPatient, { descr: 'Non confidential info' }, { sfkOption: UseAnySharedWithParent }));
|
|
48
|
-
(0, chai_1.expect)(nonConfidentialHe.descr).to.eq('Non confidential info');
|
|
49
|
-
const retrievedHesAsUser = yield childApi.healthcareElementApi.findBy(childUser.healthcarePartyId, modifiedPatient);
|
|
50
|
-
(0, chai_1.expect)(retrievedHesAsUser.length).to.equal(2, 'Child should see confidential and non-confidential data created by him');
|
|
51
|
-
(0, chai_1.expect)(retrievedHesAsUser.map((he) => he.id)).to.have.members([confidentialHe.id, nonConfidentialHe.id]);
|
|
52
|
-
const retrievedConfidential = retrievedHesAsUser.find((he) => he.id === confidentialHe.id);
|
|
53
|
-
const retrievedNonConfidential = retrievedHesAsUser.find((he) => he.id === nonConfidentialHe.id);
|
|
54
|
-
(0, chai_1.expect)(retrievedConfidential).to.deep.eq(confidentialHe);
|
|
55
|
-
(0, chai_1.expect)(retrievedNonConfidential).to.deep.eq(nonConfidentialHe);
|
|
56
|
-
const retrievedHesAsParent = yield parentApi.healthcareElementApi.findBy(parentUser.healthcarePartyId, modifiedPatient);
|
|
57
|
-
(0, chai_1.expect)(retrievedHesAsParent.length).to.equal(1, 'Parent should not see confidential data, but only non-confidential data created by child');
|
|
58
|
-
(0, chai_1.expect)(retrievedHesAsParent[0]).to.deep.eq(nonConfidentialHe);
|
|
59
|
-
let failedToRetrieve = false;
|
|
60
|
-
try {
|
|
61
|
-
yield parentApi.healthcareElementApi.getHealthElementWithUser(parentUser, confidentialHe.id);
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
console.log(e);
|
|
65
|
-
failedToRetrieve = true;
|
|
66
|
-
}
|
|
67
|
-
if (!(0, test_utils_1.isLiteTest)()) {
|
|
68
|
-
(0, chai_1.expect)(failedToRetrieve).to.equal(true, 'Parent should fail to retrieve confidential data');
|
|
69
|
-
}
|
|
70
|
-
// Even if in some way I could get the contact I should not be able to decrypt it
|
|
71
|
-
(0, chai_1.expect)(yield parentApi.cryptoApi.xapi.encryptionKeysOf({ entity: confidentialHe, type: icc_x_api_1.EntityWithDelegationTypeName.HealthElement }, undefined)).to.have.length(0);
|
|
72
|
-
}));
|
|
73
|
-
it('creation of confidential data should fail if no confidential secret id is available for patient', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
-
// Use only the top of the hierarchy for simplicity of the test
|
|
75
|
-
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
|
|
76
|
-
const pat = yield childApi.patientApi.createPatientWithUser(childUser, yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' }));
|
|
77
|
-
let failed = false;
|
|
78
|
-
try {
|
|
79
|
-
yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true });
|
|
80
|
-
}
|
|
81
|
-
catch (_a) {
|
|
82
|
-
failed = true;
|
|
83
|
-
}
|
|
84
|
-
(0, chai_1.expect)(failed).to.equal(true, 'Creation of confidential data should fail if no confidential secret id is available for patient');
|
|
85
|
-
}));
|
|
86
|
-
it('creation of non-confidential data should fail if no secret id is available for parent', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
-
// Use only the top of the hierarchy for simplicity of the test
|
|
88
|
-
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env, false);
|
|
89
|
-
const pat = yield childApi.patientApi.createPatientWithUser(childUser, yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' }));
|
|
90
|
-
let failed = false;
|
|
91
|
-
try {
|
|
92
|
-
yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: UseAnySharedWithParent });
|
|
93
|
-
}
|
|
94
|
-
catch (_a) {
|
|
95
|
-
failed = true;
|
|
96
|
-
}
|
|
97
|
-
(0, chai_1.expect)(failed).to.equal(true, 'Creation of confidential data should fail if no non-confidential secret id is available for patient');
|
|
98
|
-
}));
|
|
99
|
-
it('confidential or non-confidential is irrelevant if api is initialised without parent key initialisation: data created by user is only accessible to him', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
-
// Use only the top of the hierarchy for simplicity of the test
|
|
101
|
-
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env, false, true);
|
|
102
|
-
const pat = yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' });
|
|
103
|
-
const confidentialHe = yield childApi.healthcareElementApi.createHealthElementWithUser(childUser, yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }));
|
|
104
|
-
(0, chai_1.expect)(confidentialHe.descr).to.eq('Confidential info');
|
|
105
|
-
const nonConfidentialHe = yield childApi.healthcareElementApi.createHealthElementWithUser(childUser, yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Non confidential info' }, { sfkOption: UseAnySharedWithParent }));
|
|
106
|
-
(0, chai_1.expect)(nonConfidentialHe.descr).to.eq('Non confidential info');
|
|
107
|
-
const retrievedHesAsUser = yield childApi.healthcareElementApi.findBy(childUser.healthcarePartyId, pat);
|
|
108
|
-
(0, chai_1.expect)(retrievedHesAsUser.length).to.equal(2, 'Child should see confidential and non-confidential data created by him');
|
|
109
|
-
(0, chai_1.expect)(retrievedHesAsUser.map((he) => he.id)).to.have.members([confidentialHe.id, nonConfidentialHe.id]);
|
|
110
|
-
const retrievedConfidential = retrievedHesAsUser.find((he) => he.id === confidentialHe.id);
|
|
111
|
-
const retrievedNonConfidential = retrievedHesAsUser.find((he) => he.id === nonConfidentialHe.id);
|
|
112
|
-
(0, chai_1.expect)(retrievedConfidential).to.deep.eq(confidentialHe);
|
|
113
|
-
(0, chai_1.expect)(retrievedNonConfidential).to.deep.eq(nonConfidentialHe);
|
|
114
|
-
yield parentApi.patientApi.decryptSecretIdsOf(pat);
|
|
115
|
-
}));
|
|
116
|
-
it('sfk confidential option should use one or all secret ids as requested', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
-
// Use only the top of the hierarchy for simplicity of the test
|
|
118
|
-
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
|
|
119
|
-
const pat = yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' });
|
|
120
|
-
let modifiedPatient = (yield childApi.patientApi.initConfidentialSecretId(pat, childUser));
|
|
121
|
-
modifiedPatient = yield childApi.patientApi.shareWith(childUser.healthcarePartyId, modifiedPatient, [(0, crypto_1.randomUUID)()]);
|
|
122
|
-
modifiedPatient = yield childApi.patientApi.shareWith(parentUser.healthcarePartyId, modifiedPatient, [(0, crypto_1.randomUUID)()]);
|
|
123
|
-
const patientSecretIdsForParent = yield parentApi.patientApi.decryptSecretIdsOf(modifiedPatient);
|
|
124
|
-
const patientSecretIdsForChild = yield childApi.patientApi.decryptSecretIdsOf(modifiedPatient);
|
|
125
|
-
(0, chai_1.expect)(patientSecretIdsForParent).to.have.length(2);
|
|
126
|
-
(0, chai_1.expect)(patientSecretIdsForChild).to.have.length(4);
|
|
127
|
-
const confidentialSecretIds = patientSecretIdsForChild.filter((x) => !patientSecretIdsForParent.includes(x));
|
|
128
|
-
const nonConfidentialSecretIds = patientSecretIdsForParent;
|
|
129
|
-
(0, chai_1.expect)(confidentialSecretIds).to.have.length(2);
|
|
130
|
-
(0, chai_1.expect)(yield childApi.patientApi.decryptConfidentialSecretIdsOf(modifiedPatient)).to.have.members(confidentialSecretIds);
|
|
131
|
-
(0, chai_1.expect)(yield childApi.patientApi.decryptNonConfidentialSecretIdsOf(modifiedPatient)).to.have.members(nonConfidentialSecretIds);
|
|
132
|
-
const anyConfidentialHe = yield childApi.healthcareElementApi.newInstance(childUser, modifiedPatient, { descr: 'Confidential info' }, { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true });
|
|
133
|
-
(0, chai_1.expect)(anyConfidentialHe.secretForeignKeys).to.have.length(1);
|
|
134
|
-
(0, chai_1.expect)(confidentialSecretIds).to.include(anyConfidentialHe.secretForeignKeys[0]);
|
|
135
|
-
const allConfidentialHe = yield childApi.healthcareElementApi.newInstance(childUser, modifiedPatient, { descr: 'Confidential info' }, { sfkOption: UseAllConfidential, ignoreAutoDelegations: true });
|
|
136
|
-
(0, chai_1.expect)(allConfidentialHe.secretForeignKeys).to.have.members(confidentialSecretIds);
|
|
137
|
-
const anyNonConfidentialHe = yield childApi.healthcareElementApi.newInstance(childUser, modifiedPatient, { descr: 'Confidential info' }, { sfkOption: UseAnySharedWithParent });
|
|
138
|
-
(0, chai_1.expect)(anyNonConfidentialHe.secretForeignKeys).to.have.length(1);
|
|
139
|
-
(0, chai_1.expect)(nonConfidentialSecretIds).to.include(anyNonConfidentialHe.secretForeignKeys[0]);
|
|
140
|
-
const allNonConfidentialHe = yield childApi.healthcareElementApi.newInstance(childUser, modifiedPatient, { descr: 'Confidential info' }, { sfkOption: UseAllSharedWithParent });
|
|
141
|
-
(0, chai_1.expect)(allNonConfidentialHe.secretForeignKeys).to.have.members(nonConfidentialSecretIds);
|
|
142
|
-
}));
|
|
143
|
-
it('Should allow creation of half-links by using no sfk', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
-
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
|
|
145
|
-
const pat = yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' });
|
|
146
|
-
const halfLinkedHe = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: UseNone, ignoreAutoDelegations: true });
|
|
147
|
-
(0, chai_1.expect)(halfLinkedHe.secretForeignKeys).to.have.length(0);
|
|
148
|
-
const decryptedPatientId = yield childApi.healthcareElementApi.decryptPatientIdOf(halfLinkedHe);
|
|
149
|
-
(0, chai_1.expect)(decryptedPatientId).to.have.length(1);
|
|
150
|
-
(0, chai_1.expect)(decryptedPatientId[0]).to.equal(pat.id);
|
|
151
|
-
}));
|
|
152
|
-
it('Should allow creation of links using the provided sfks', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
153
|
-
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
|
|
154
|
-
const pat = yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' });
|
|
155
|
-
const modifiedPatient = (yield childApi.patientApi.initConfidentialSecretId(pat, childUser));
|
|
156
|
-
const secretIds = yield childApi.patientApi.decryptSecretIdsOf(modifiedPatient);
|
|
157
|
-
(0, chai_1.expect)(secretIds).to.have.length(2);
|
|
158
|
-
const halfLinkedHe = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: new SecretIdUseOption_1.SecretIdUseOption.Use([]), ignoreAutoDelegations: true });
|
|
159
|
-
(0, chai_1.expect)(halfLinkedHe.secretForeignKeys).to.have.length(0);
|
|
160
|
-
const linkedHeSfk0 = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: new SecretIdUseOption_1.SecretIdUseOption.Use([secretIds[0]]), ignoreAutoDelegations: true });
|
|
161
|
-
(0, chai_1.expect)(linkedHeSfk0.secretForeignKeys).to.have.members([secretIds[0]]);
|
|
162
|
-
const linkedHeSfk1 = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: new SecretIdUseOption_1.SecretIdUseOption.Use([secretIds[1]]), ignoreAutoDelegations: true });
|
|
163
|
-
(0, chai_1.expect)(linkedHeSfk1.secretForeignKeys).to.have.members([secretIds[1]]);
|
|
164
|
-
const linkedHeSfkBoth = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: new SecretIdUseOption_1.SecretIdUseOption.Use(secretIds), ignoreAutoDelegations: true });
|
|
165
|
-
(0, chai_1.expect)(linkedHeSfkBoth.secretForeignKeys).to.have.members(secretIds);
|
|
166
|
-
}));
|
|
167
|
-
});
|
|
168
|
-
//# sourceMappingURL=confidential-entities-test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confidential-entities-test.js","sourceRoot":"","sources":["../../../test/icc-x-api/confidential-entities-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,oDAAoH;AACpH,mDAAmE;AACnE,+BAA6B;AAC7B,4BAAyB;AACzB,+CAA8D;AAC9D,gFAA4E;AAC5E,IAAO,kBAAkB,GAAG,qCAAiB,CAAC,kBAAkB,CAAA;AAChE,IAAO,sBAAsB,GAAG,qCAAiB,CAAC,sBAAsB,CAAA;AACxE,mCAAmC;AACnC,IAAO,kBAAkB,GAAG,qCAAiB,CAAC,kBAAkB,CAAA;AAChE,IAAO,sBAAsB,GAAG,qCAAiB,CAAC,sBAAsB,CAAA;AACxE,IAAO,OAAO,GAAG,qCAAiB,CAAC,OAAO,CAAA;AAE1C,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AAEtB,IAAI,GAAa,CAAA;AAEjB,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,MAAM,CAAC;;YACL,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACpB,MAAM,WAAW,GAAG,MAAM,IAAA,sCAAyB,GAAE,CAAA;YACrD,GAAG,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,IAAA,uBAAe,GAAE,CAAC,CAAA;QACpD,CAAC;KAAA,CAAC,CAAA;IAEF,EAAE,CAAC,6GAA6G,EAAE,GAAS,EAAE;QAC3H,+DAA+D;QAC/D,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,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AC,CAAC,CAAA;QACtE,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CACrE,SAAS,EACT,GAAG,EACH,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAC9B,EAAE,SAAS,EAAE,IAAI,qCAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CACjF,CAAA;QACD,IAAA,aAAM,EAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACtE,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { createHcpHierarchyApis, getEnvironmentInitializer, isLiteTest, setLocalStorage } from '../utils/test_utils'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { expect } from 'chai'\nimport 'isomorphic-fetch'\nimport { EntityWithDelegationTypeName } from '../../icc-x-api'\nimport { SecretIdUseOption } from '../../icc-x-api/crypto/SecretIdUseOption'\nimport UseAnyConfidential = SecretIdUseOption.UseAnyConfidential\nimport UseAnySharedWithParent = SecretIdUseOption.UseAnySharedWithParent\nimport { randomUUID } from 'crypto'\nimport UseAllConfidential = SecretIdUseOption.UseAllConfidential\nimport UseAllSharedWithParent = SecretIdUseOption.UseAllSharedWithParent\nimport UseNone = SecretIdUseOption.UseNone\n\nsetLocalStorage(fetch)\n\nvar env: TestVars\n\ndescribe('test confidential helement', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('confidential entity should be accessible only to user, non confidential should be accessible also to parent', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\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 patientSecretIdsForParent = await parentApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n const patientSecretIdsForChild = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(patientSecretIdsForParent).to.have.length(1)\n expect(patientSecretIdsForChild).to.have.length(2)\n expect(patientSecretIdsForChild).to.contain(patientSecretIdsForParent[0])\n expect(patientSecretIdsForChild[0]).to.not.eq(patientSecretIdsForChild[1])\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 expect(confidentialHe.descr).to.eq('Confidential info')\n const nonConfidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Non confidential info' },\n { sfkOption: UseAnySharedWithParent }\n )\n )\n expect(nonConfidentialHe.descr).to.eq('Non confidential info')\n\n const retrievedHesAsUser = await childApi.healthcareElementApi.findBy(childUser.healthcarePartyId!, modifiedPatient)\n expect(retrievedHesAsUser.length).to.equal(2, 'Child should see confidential and non-confidential data created by him')\n expect(retrievedHesAsUser.map((he) => he.id)).to.have.members([confidentialHe.id, nonConfidentialHe.id])\n const retrievedConfidential = retrievedHesAsUser.find((he) => he.id === confidentialHe.id)\n const retrievedNonConfidential = retrievedHesAsUser.find((he) => he.id === nonConfidentialHe.id)\n expect(retrievedConfidential).to.deep.eq(confidentialHe)\n expect(retrievedNonConfidential).to.deep.eq(nonConfidentialHe)\n\n const retrievedHesAsParent = await parentApi.healthcareElementApi.findBy(parentUser.healthcarePartyId!, modifiedPatient)\n expect(retrievedHesAsParent.length).to.equal(1, 'Parent should not see confidential data, but only non-confidential data created by child')\n expect(retrievedHesAsParent[0]).to.deep.eq(nonConfidentialHe)\n let failedToRetrieve = false\n try {\n await parentApi.healthcareElementApi.getHealthElementWithUser(parentUser, confidentialHe.id!)\n } catch (e) {\n console.log(e)\n failedToRetrieve = true\n }\n if (!isLiteTest()) {\n expect(failedToRetrieve).to.equal(true, 'Parent 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 parentApi.cryptoApi.xapi.encryptionKeysOf({ entity: confidentialHe!, type: EntityWithDelegationTypeName.HealthElement }, undefined)\n ).to.have.length(0)\n })\n\n it('creation of confidential data should fail if no confidential secret id is available for patient', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.createPatientWithUser(\n childUser,\n await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n )\n let failed = false\n try {\n await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n } catch {\n failed = true\n }\n expect(failed).to.equal(true, 'Creation of confidential data should fail if no confidential secret id is available for patient')\n })\n\n it('creation of non-confidential data should fail if no secret id is available for parent', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!, false)\n\n const pat = await childApi.patientApi.createPatientWithUser(\n childUser,\n await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n )\n let failed = false\n try {\n await childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: UseAnySharedWithParent })\n } catch {\n failed = true\n }\n expect(failed).to.equal(true, 'Creation of confidential data should fail if no non-confidential secret id is available for patient')\n })\n\n it('confidential or non-confidential is irrelevant if api is initialised without parent key initialisation: data created by user is only accessible to him', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!, false, true)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n\n const confidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n )\n expect(confidentialHe.descr).to.eq('Confidential info')\n const nonConfidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Non confidential info' }, { sfkOption: UseAnySharedWithParent })\n )\n expect(nonConfidentialHe.descr).to.eq('Non confidential info')\n\n const retrievedHesAsUser = await childApi.healthcareElementApi.findBy(childUser.healthcarePartyId!, pat)\n expect(retrievedHesAsUser.length).to.equal(2, 'Child should see confidential and non-confidential data created by him')\n expect(retrievedHesAsUser.map((he) => he.id)).to.have.members([confidentialHe.id, nonConfidentialHe.id])\n const retrievedConfidential = retrievedHesAsUser.find((he) => he.id === confidentialHe.id)\n const retrievedNonConfidential = retrievedHesAsUser.find((he) => he.id === nonConfidentialHe.id)\n expect(retrievedConfidential).to.deep.eq(confidentialHe)\n expect(retrievedNonConfidential).to.deep.eq(nonConfidentialHe)\n\n await parentApi.patientApi.decryptSecretIdsOf(pat)\n })\n\n it('sfk confidential option should use one or all secret ids as requested', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n let modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n modifiedPatient = await childApi.patientApi.shareWith(childUser.healthcarePartyId!, modifiedPatient, [randomUUID()])\n modifiedPatient = await childApi.patientApi.shareWith(parentUser.healthcarePartyId!, modifiedPatient, [randomUUID()])\n\n const patientSecretIdsForParent = await parentApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n const patientSecretIdsForChild = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(patientSecretIdsForParent).to.have.length(2)\n expect(patientSecretIdsForChild).to.have.length(4)\n const confidentialSecretIds = patientSecretIdsForChild.filter((x) => !patientSecretIdsForParent.includes(x))\n const nonConfidentialSecretIds = patientSecretIdsForParent\n expect(confidentialSecretIds).to.have.length(2)\n expect(await childApi.patientApi.decryptConfidentialSecretIdsOf(modifiedPatient)).to.have.members(confidentialSecretIds)\n expect(await childApi.patientApi.decryptNonConfidentialSecretIdsOf(modifiedPatient)).to.have.members(nonConfidentialSecretIds)\n const anyConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n expect(anyConfidentialHe.secretForeignKeys).to.have.length(1)\n expect(confidentialSecretIds).to.include(anyConfidentialHe.secretForeignKeys![0])\n const allConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAllConfidential, ignoreAutoDelegations: true }\n )\n expect(allConfidentialHe.secretForeignKeys).to.have.members(confidentialSecretIds)\n const anyNonConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnySharedWithParent }\n )\n expect(anyNonConfidentialHe.secretForeignKeys).to.have.length(1)\n expect(nonConfidentialSecretIds).to.include(anyNonConfidentialHe.secretForeignKeys![0])\n const allNonConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAllSharedWithParent }\n )\n expect(allNonConfidentialHe.secretForeignKeys).to.have.members(nonConfidentialSecretIds)\n })\n\n it('Should allow creation of half-links by using no sfk', async () => {\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const halfLinkedHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseNone, ignoreAutoDelegations: true }\n )\n expect(halfLinkedHe.secretForeignKeys).to.have.length(0)\n const decryptedPatientId = await childApi.healthcareElementApi.decryptPatientIdOf(halfLinkedHe)\n expect(decryptedPatientId).to.have.length(1)\n expect(decryptedPatientId[0]).to.equal(pat.id)\n })\n\n it('Should allow creation of links using the provided sfks', async () => {\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n const secretIds = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(secretIds).to.have.length(2)\n const halfLinkedHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([]), ignoreAutoDelegations: true }\n )\n expect(halfLinkedHe.secretForeignKeys).to.have.length(0)\n const linkedHeSfk0 = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([secretIds[0]]), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfk0.secretForeignKeys).to.have.members([secretIds[0]])\n const linkedHeSfk1 = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([secretIds[1]]), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfk1.secretForeignKeys).to.have.members([secretIds[1]])\n const linkedHeSfkBoth = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use(secretIds), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfkBoth.secretForeignKeys).to.have.members(secretIds)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|