@icure/api 7.1.14 → 8.0.0-RC.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/IccAccesslogApi.d.ts +12 -1
- package/icc-api/api/IccAccesslogApi.js +142 -98
- package/icc-api/api/IccAccesslogApi.js.map +1 -1
- package/icc-api/api/IccBemikronoApi.d.ts +81 -0
- package/icc-api/api/IccBemikronoApi.js +163 -0
- package/icc-api/api/IccBemikronoApi.js.map +1 -0
- package/icc-api/api/IccCalendarItemApi.d.ts +21 -1
- package/icc-api/api/IccCalendarItemApi.js +183 -117
- package/icc-api/api/IccCalendarItemApi.js.map +1 -1
- package/icc-api/api/IccClassificationApi.d.ts +21 -1
- package/icc-api/api/IccClassificationApi.js +119 -63
- package/icc-api/api/IccClassificationApi.js.map +1 -1
- package/icc-api/api/IccContactApi.d.ts +21 -1
- package/icc-api/api/IccContactApi.js +385 -294
- package/icc-api/api/IccContactApi.js.map +1 -1
- package/icc-api/api/IccDocumentApi.d.ts +32 -25
- package/icc-api/api/IccDocumentApi.js +264 -212
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccExchangeDataApi.d.ts +19 -0
- package/icc-api/api/IccExchangeDataApi.js +85 -0
- package/icc-api/api/IccExchangeDataApi.js.map +1 -0
- package/icc-api/api/IccExchangeDataMapApi.d.ts +18 -0
- package/icc-api/api/IccExchangeDataMapApi.js +65 -0
- package/icc-api/api/IccExchangeDataMapApi.js.map +1 -0
- package/icc-api/api/IccFormApi.d.ts +21 -1
- package/icc-api/api/IccFormApi.js +321 -229
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-api/api/IccHelementApi.d.ts +21 -1
- package/icc-api/api/IccHelementApi.js +207 -137
- package/icc-api/api/IccHelementApi.js.map +1 -1
- package/icc-api/api/IccInvoiceApi.d.ts +21 -1
- package/icc-api/api/IccInvoiceApi.js +404 -298
- package/icc-api/api/IccInvoiceApi.js.map +1 -1
- package/icc-api/api/IccMaintenanceTaskApi.d.ts +12 -1
- package/icc-api/api/IccMaintenanceTaskApi.js +79 -43
- package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
- package/icc-api/api/IccMessageApi.d.ts +12 -1
- package/icc-api/api/IccMessageApi.js +257 -191
- package/icc-api/api/IccMessageApi.js.map +1 -1
- package/icc-api/api/IccPatientApi.d.ts +12 -1
- package/icc-api/api/IccPatientApi.js +447 -351
- package/icc-api/api/IccPatientApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.d.ts +22 -8
- package/icc-api/api/IccReceiptApi.js +121 -64
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/api/IccRestApiPath.js +1 -1
- package/icc-api/api/IccRestApiPath.js.map +1 -1
- package/icc-api/api/IccTimeTableApi.d.ts +12 -1
- package/icc-api/api/IccTimeTableApi.js +86 -48
- package/icc-api/api/IccTimeTableApi.js.map +1 -1
- package/icc-api/index.d.ts +1 -0
- package/icc-api/index.js +1 -0
- package/icc-api/index.js.map +1 -1
- package/icc-api/model/AccessLog.d.ts +4 -0
- package/icc-api/model/AccessLog.js +1 -0
- package/icc-api/model/AccessLog.js.map +1 -1
- package/icc-api/model/Article.d.ts +4 -0
- package/icc-api/model/Article.js +1 -0
- package/icc-api/model/Article.js.map +1 -1
- package/icc-api/model/CalendarItem.d.ts +4 -0
- package/icc-api/model/CalendarItem.js +1 -0
- package/icc-api/model/CalendarItem.js.map +1 -1
- package/icc-api/model/Classification.d.ts +4 -0
- package/icc-api/model/Classification.js +1 -0
- package/icc-api/model/Classification.js.map +1 -1
- package/icc-api/model/ClassificationTemplate.d.ts +2 -0
- package/icc-api/model/ClassificationTemplate.js.map +1 -1
- package/icc-api/model/Contact.d.ts +4 -0
- package/icc-api/model/Contact.js +1 -0
- package/icc-api/model/Contact.js.map +1 -1
- package/icc-api/model/Device.d.ts +4 -4
- package/icc-api/model/Device.js.map +1 -1
- package/icc-api/model/Document.d.ts +4 -0
- package/icc-api/model/Document.js +1 -0
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/ExchangeData.d.ts +61 -0
- package/icc-api/model/ExchangeData.js +12 -0
- package/icc-api/model/ExchangeData.js.map +1 -0
- package/icc-api/model/ExchangeDataMap.d.ts +21 -0
- package/icc-api/model/ExchangeDataMap.js +10 -0
- package/icc-api/model/ExchangeDataMap.js.map +1 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.d.ts +13 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.js +10 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.js.map +1 -0
- package/icc-api/model/Form.d.ts +4 -0
- package/icc-api/model/Form.js +1 -0
- package/icc-api/model/Form.js.map +1 -1
- package/icc-api/model/HealthElement.d.ts +4 -0
- package/icc-api/model/HealthElement.js +1 -0
- package/icc-api/model/HealthElement.js.map +1 -1
- package/icc-api/model/HealthcareParty.d.ts +2 -2
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/IcureStub.d.ts +2 -0
- package/icc-api/model/IcureStub.js.map +1 -1
- package/icc-api/model/Invoice.d.ts +4 -0
- package/icc-api/model/Invoice.js +1 -0
- package/icc-api/model/Invoice.js.map +1 -1
- package/icc-api/model/MaintenanceTask.d.ts +4 -0
- package/icc-api/model/MaintenanceTask.js +1 -0
- package/icc-api/model/MaintenanceTask.js.map +1 -1
- package/icc-api/model/Message.d.ts +4 -0
- package/icc-api/model/Message.js +1 -0
- package/icc-api/model/Message.js.map +1 -1
- package/icc-api/model/PaginatedListExchangeData.d.ts +9 -0
- package/icc-api/model/PaginatedListExchangeData.js +10 -0
- package/icc-api/model/PaginatedListExchangeData.js.map +1 -0
- package/icc-api/model/Patient.d.ts +6 -2
- package/icc-api/model/Patient.js +1 -0
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.d.ts +31 -0
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.js +32 -0
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.js.map +1 -0
- package/icc-api/model/Receipt.d.ts +4 -0
- package/icc-api/model/Receipt.js +1 -0
- package/icc-api/model/Receipt.js.map +1 -1
- package/icc-api/model/SecureDelegation.d.ts +52 -0
- package/icc-api/model/SecureDelegation.js +16 -0
- package/icc-api/model/SecureDelegation.js.map +1 -0
- package/icc-api/model/SecurityMetadata.d.ts +33 -0
- package/icc-api/model/SecurityMetadata.js +13 -0
- package/icc-api/model/SecurityMetadata.js.map +1 -0
- package/icc-api/model/Service.d.ts +2 -0
- package/icc-api/model/Service.js.map +1 -1
- package/icc-api/model/TimeTable.d.ts +4 -0
- package/icc-api/model/TimeTable.js +1 -0
- package/icc-api/model/TimeTable.js.map +1 -1
- package/icc-api/model/models.d.ts +20 -39
- package/icc-api/model/models.js +15 -37
- package/icc-api/model/models.js.map +1 -1
- package/icc-api/model/requests/EntityBulkShareResult.d.ts +28 -0
- package/icc-api/model/requests/EntityBulkShareResult.js +16 -0
- package/icc-api/model/requests/EntityBulkShareResult.js.map +1 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.d.ts +10 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js +17 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js.map +1 -0
- package/icc-api/model/requests/EntityShareRequest.d.ts +110 -0
- package/icc-api/model/requests/EntityShareRequest.js +63 -0
- package/icc-api/model/requests/EntityShareRequest.js.map +1 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.d.ts +54 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js +24 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js.map +1 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.d.ts +23 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.js +13 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.js.map +1 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.d.ts +21 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js +14 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js.map +1 -0
- package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +3 -2
- package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
- package/icc-x-api/crypto/AES.js +1 -1
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +16 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +41 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +42 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js +86 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +146 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.js +342 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -0
- package/icc-x-api/crypto/BaseExchangeKeysManager.d.ts +0 -18
- package/icc-x-api/crypto/BaseExchangeKeysManager.js +11 -85
- package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ConfidentialEntities.d.ts +26 -16
- package/icc-x-api/crypto/ConfidentialEntities.js +30 -17
- package/icc-x-api/crypto/ConfidentialEntities.js.map +1 -1
- package/icc-x-api/crypto/CryptoStrategies.d.ts +8 -1
- package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.d.ts +95 -0
- package/icc-x-api/crypto/ExchangeDataManager.js +493 -0
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +32 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.js +70 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -0
- package/icc-x-api/crypto/ExchangeKeysManager.d.ts +4 -16
- package/icc-x-api/crypto/ExchangeKeysManager.js +4 -62
- package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.d.ts +336 -0
- package/icc-x-api/crypto/ExtendedApisUtils.js +3 -0
- package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +181 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +562 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -0
- package/icc-x-api/crypto/KeyRecovery.d.ts +5 -2
- package/icc-x-api/crypto/KeyRecovery.js +59 -29
- package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
- package/icc-x-api/crypto/LegacyCryptoStrategies.d.ts +7 -2
- package/icc-x-api/crypto/LegacyCryptoStrategies.js +8 -1
- package/icc-x-api/crypto/LegacyCryptoStrategies.js.map +1 -1
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +39 -0
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +150 -0
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/RSA.d.ts +34 -8
- package/icc-x-api/crypto/RSA.js +80 -13
- package/icc-x-api/crypto/RSA.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsEncryption.d.ts +54 -0
- package/icc-x-api/crypto/SecureDelegationsEncryption.js +178 -0
- package/icc-x-api/crypto/SecureDelegationsEncryption.js.map +1 -0
- package/icc-x-api/crypto/SecureDelegationsManager.d.ts +66 -0
- package/icc-x-api/crypto/SecureDelegationsManager.js +261 -0
- package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +37 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +294 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +114 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js +98 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/ShamirKeysManager.d.ts +5 -5
- package/icc-x-api/crypto/ShamirKeysManager.js +6 -9
- package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
- package/icc-x-api/crypto/TransferKeysManager.d.ts +8 -6
- package/icc-x-api/crypto/TransferKeysManager.js +75 -52
- package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
- package/icc-x-api/crypto/{KeyManager.d.ts → UserEncryptionKeysManager.d.ts} +4 -6
- package/icc-x-api/crypto/{KeyManager.js → UserEncryptionKeysManager.js} +43 -23
- package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +26 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.js +74 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.js.map +1 -0
- package/icc-x-api/crypto/utils.d.ts +61 -11
- package/icc-x-api/crypto/utils.js +113 -44
- package/icc-x-api/crypto/utils.js.map +1 -1
- package/icc-x-api/filters/filters.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +46 -11
- package/icc-x-api/icc-accesslog-x-api.js +75 -42
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +50 -14
- package/icc-x-api/icc-calendar-item-x-api.js +99 -49
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +44 -9
- package/icc-x-api/icc-classification-x-api.js +56 -31
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +56 -32
- package/icc-x-api/icc-contact-x-api.js +95 -64
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +28 -334
- package/icc-x-api/icc-crypto-x-api.js +41 -765
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.d.ts +20 -8
- package/icc-x-api/icc-data-owner-x-api.js +31 -10
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +48 -11
- package/icc-x-api/icc-document-x-api.js +111 -64
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +45 -10
- package/icc-x-api/icc-form-x-api.js +65 -35
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.d.ts +2 -2
- package/icc-x-api/icc-hcparty-x-api.js +3 -3
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +55 -18
- package/icc-x-api/icc-helement-x-api.js +76 -41
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-icure-maintenance-x-api.d.ts +7 -2
- package/icc-x-api/icc-icure-maintenance-x-api.js +38 -27
- package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +50 -15
- package/icc-x-api/icc-invoice-x-api.js +63 -33
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +53 -21
- package/icc-x-api/icc-maintenance-task-x-api.js +72 -35
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +53 -15
- package/icc-x-api/icc-message-x-api.js +65 -36
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +84 -29
- package/icc-x-api/icc-patient-x-api.js +313 -378
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +44 -12
- package/icc-x-api/icc-receipt-x-api.js +67 -35
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +43 -12
- package/icc-x-api/icc-time-table-x-api.js +56 -26
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.d.ts +2 -2
- package/icc-x-api/icc-user-x-api.js +3 -3
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +4 -2
- package/icc-x-api/index.js +154 -135
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.d.ts +2 -0
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js +9 -2
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js.map +1 -1
- package/icc-x-api/storage/IcureStorageFacade.d.ts +23 -2
- package/icc-x-api/storage/IcureStorageFacade.js +36 -2
- package/icc-x-api/storage/IcureStorageFacade.js.map +1 -1
- package/icc-x-api/storage/KeyStorageFacade.d.ts +12 -0
- package/icc-x-api/storage/KeyStorageFacade.js.map +1 -1
- package/icc-x-api/storage/KeyStorageImpl.d.ts +2 -0
- package/icc-x-api/storage/KeyStorageImpl.js +10 -0
- package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
- package/icc-x-api/storage/StorageEntryKeysFactory.d.ts +14 -1
- package/icc-x-api/storage/StorageEntryKeysFactory.js.map +1 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +32 -0
- package/icc-x-api/utils/EntityWithDelegationTypeName.js +75 -0
- package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -0
- package/icc-x-api/utils/ShareResult.d.ts +74 -0
- package/icc-x-api/utils/ShareResult.js +61 -0
- package/icc-x-api/utils/ShareResult.js.map +1 -0
- package/icc-x-api/utils/binary-utils.d.ts +1 -0
- package/icc-x-api/utils/binary-utils.js +8 -1
- package/icc-x-api/utils/binary-utils.js.map +1 -1
- package/icc-x-api/utils/collection-utils.d.ts +5 -0
- package/icc-x-api/utils/collection-utils.js +26 -1
- package/icc-x-api/utils/collection-utils.js.map +1 -1
- package/icc-x-api/utils/crypto-utils.d.ts +4 -3
- package/icc-x-api/utils/crypto-utils.js +5 -4
- package/icc-x-api/utils/crypto-utils.js.map +1 -1
- package/icc-x-api/utils/lru-temporised-async-cache.d.ts +26 -3
- package/icc-x-api/utils/lru-temporised-async-cache.js +75 -15
- package/icc-x-api/utils/lru-temporised-async-cache.js.map +1 -1
- package/icc-x-api/utils/websocket.d.ts +10 -10
- package/icc-x-api/utils/websocket.js +18 -9
- package/icc-x-api/utils/websocket.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +2 -3
- package/icc-x-api/crypto/EntitiesEncryption.d.ts +0 -275
- package/icc-x-api/crypto/EntitiesEncryption.js +0 -734
- package/icc-x-api/crypto/EntitiesEncryption.js.map +0 -1
- package/icc-x-api/crypto/KeyManager.js.map +0 -1
|
@@ -22,10 +22,23 @@ export interface StorageEntryKeysFactory {
|
|
|
22
22
|
*/
|
|
23
23
|
cachedRecoveredKeypairOfDataOwner(dataOwnerId: string, publicKeyFingerprint: string): string;
|
|
24
24
|
/**
|
|
25
|
-
* Get the entry key for the storage of answers to own public key verification
|
|
25
|
+
* Get the entry key for the storage of answers to own public key verification.
|
|
26
26
|
* This entry key will be used in a {@link StorageFacade}.
|
|
27
27
|
* @param dataOwnerId Id of a data owner.
|
|
28
28
|
* @return entry key for verified public keys of the data owner.
|
|
29
29
|
*/
|
|
30
30
|
selfPublicKeysVerificationCacheForDataOwner(dataOwnerId: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get the entry key for the storage of the private key of a data owner to use for signature.
|
|
33
|
+
* @param dataOwnerId Id of a data owner.
|
|
34
|
+
* @return entry key for signature private key of the data owner.
|
|
35
|
+
*/
|
|
36
|
+
signatureKeyForDataOwner(dataOwnerId: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get the entry key for the storage of a public key of a data owner to use for signature verification.
|
|
39
|
+
* @param dataOwnerId Id of a data owner.
|
|
40
|
+
* @param publicKeyFingerprint fingerprint of the public key.
|
|
41
|
+
* @return entry key for a signature verification public key of the data owner.
|
|
42
|
+
*/
|
|
43
|
+
signatureVerificationKeyForDataOwner(dataOwnerId: string, publicKeyFingerprint: string): string;
|
|
31
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageEntryKeysFactory.js","sourceRoot":"","sources":["../../../icc-x-api/storage/StorageEntryKeysFactory.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Specifies the entry keys to use for storage of data needed by iCure.\n */\nexport interface StorageEntryKeysFactory {\n /**\n * Get the entry key for the storage of a key pair of a data owner which was created on this device. All keys created on this device will be\n * considered as verified and safe.\n * This entry key will be used in a {@link KeyStorageFacade}.\n * @param dataOwnerId Id of a data owner.\n * @param publicKeyFingerprint Fingerprint of the public key in a keypair of the data owner.\n * @return entry key for the keypair.\n */\n deviceKeypairOfDataOwner(dataOwnerId: string, publicKeyFingerprint: string): string\n\n /**\n * Get the entry key for the storage of a key pair of a data owner which was recovered from transfer keys or shamir.\n * These keys are going to be considered as UNSAFE for encryption unless their public key has been verified by the human user and has been stored in\n * {@link selfPublicKeysVerificationCacheForDataOwner}.\n * This entry key will be used in a {@link KeyStorageFacade}.\n * @param dataOwnerId Id of a data owner.\n * @param publicKeyFingerprint Fingerprint of the public key in a keypair of the data owner.\n * @return entry key for the keypair.\n */\n cachedRecoveredKeypairOfDataOwner(dataOwnerId: string, publicKeyFingerprint: string): string\n\n /**\n * Get the entry key for the storage of answers to own public key verification
|
|
1
|
+
{"version":3,"file":"StorageEntryKeysFactory.js","sourceRoot":"","sources":["../../../icc-x-api/storage/StorageEntryKeysFactory.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Specifies the entry keys to use for storage of data needed by iCure.\n */\nexport interface StorageEntryKeysFactory {\n /**\n * Get the entry key for the storage of a key pair of a data owner which was created on this device. All keys created on this device will be\n * considered as verified and safe.\n * This entry key will be used in a {@link KeyStorageFacade}.\n * @param dataOwnerId Id of a data owner.\n * @param publicKeyFingerprint Fingerprint of the public key in a keypair of the data owner.\n * @return entry key for the keypair.\n */\n deviceKeypairOfDataOwner(dataOwnerId: string, publicKeyFingerprint: string): string\n\n /**\n * Get the entry key for the storage of a key pair of a data owner which was recovered from transfer keys or shamir.\n * These keys are going to be considered as UNSAFE for encryption unless their public key has been verified by the human user and has been stored in\n * {@link selfPublicKeysVerificationCacheForDataOwner}.\n * This entry key will be used in a {@link KeyStorageFacade}.\n * @param dataOwnerId Id of a data owner.\n * @param publicKeyFingerprint Fingerprint of the public key in a keypair of the data owner.\n * @return entry key for the keypair.\n */\n cachedRecoveredKeypairOfDataOwner(dataOwnerId: string, publicKeyFingerprint: string): string\n\n /**\n * Get the entry key for the storage of answers to own public key verification.\n * This entry key will be used in a {@link StorageFacade}.\n * @param dataOwnerId Id of a data owner.\n * @return entry key for verified public keys of the data owner.\n */\n selfPublicKeysVerificationCacheForDataOwner(dataOwnerId: string): string\n\n /**\n * Get the entry key for the storage of the private key of a data owner to use for signature.\n * @param dataOwnerId Id of a data owner.\n * @return entry key for signature private key of the data owner.\n */\n signatureKeyForDataOwner(dataOwnerId: string): string\n\n /**\n * Get the entry key for the storage of a public key of a data owner to use for signature verification.\n * @param dataOwnerId Id of a data owner.\n * @param publicKeyFingerprint fingerprint of the public key.\n * @return entry key for a signature verification public key of the data owner.\n */\n signatureVerificationKeyForDataOwner(dataOwnerId: string, publicKeyFingerprint: string): string\n\n /*\n * There is no need to store verified public keys for other data owners: we verify only when we want to create a new exchange key, and we need to\n * create an exchange key to each user only once unless we lose our key. But we can lose our key only if we delete our data, which means we would\n * also used the verified keys for other data owners...\n */\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names of all possible encrypted entity types.
|
|
3
|
+
*/
|
|
4
|
+
import { EncryptedEntity, EncryptedEntityStub } from '../../icc-api/model/models';
|
|
5
|
+
export declare const entityWithDelegationTypeNames: Set<EntityWithDelegationTypeName>;
|
|
6
|
+
export type EntityWithDelegationTypeName = 'Article' | 'AccessLog' | 'CalendarItem' | 'Classification' | 'Contact' | 'Document' | 'Form' | 'HealthElement' | 'Invoice' | 'MaintenanceTask' | 'Message' | 'Patient' | 'Receipt' | 'TimeTable';
|
|
7
|
+
/**
|
|
8
|
+
* Type containing information on an entity and its type. If the entity is a stub (EncryptedEntityStub or IcureStub) the type should refer to the
|
|
9
|
+
* original entity from which the stub was extracted.
|
|
10
|
+
*/
|
|
11
|
+
export type EncryptedEntityWithType = {
|
|
12
|
+
entity: EncryptedEntityStub | EncryptedEntity;
|
|
13
|
+
type: EntityWithDelegationTypeName;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @internal this function is meant for internal use only and may be changed without notice
|
|
17
|
+
* Gets the class of an encrypted entity. Throws error if the class can't be retrieved.
|
|
18
|
+
* @param entity the entity object
|
|
19
|
+
* @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example
|
|
20
|
+
* due to the use of minified code).
|
|
21
|
+
* @return the class of the encrypted entity
|
|
22
|
+
*/
|
|
23
|
+
export declare function encryptedEntityClassOf(entity: EncryptedEntity | EncryptedEntityStub, declaredClassName: EntityWithDelegationTypeName | undefined): EntityWithDelegationTypeName;
|
|
24
|
+
/**
|
|
25
|
+
* @internal this function is meant for internal use only and may be changed without notice
|
|
26
|
+
* Gets the class of an encrypted entity. Returns undefined if the class can't be retrieved.
|
|
27
|
+
* @param entity the entity object
|
|
28
|
+
* @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example
|
|
29
|
+
* due to the use of minified code).
|
|
30
|
+
* @return the class of the encrypted entity
|
|
31
|
+
*/
|
|
32
|
+
export declare function tryGetEncryptedEntityClassOf(entity: EncryptedEntity | EncryptedEntityStub, declaredClassName: EntityWithDelegationTypeName | undefined): EntityWithDelegationTypeName | undefined;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryGetEncryptedEntityClassOf = exports.encryptedEntityClassOf = exports.entityWithDelegationTypeNames = void 0;
|
|
4
|
+
exports.entityWithDelegationTypeNames = new Set([
|
|
5
|
+
'Article',
|
|
6
|
+
'AccessLog',
|
|
7
|
+
'CalendarItem',
|
|
8
|
+
'Classification',
|
|
9
|
+
'Contact',
|
|
10
|
+
'Document',
|
|
11
|
+
'Form',
|
|
12
|
+
'HealthElement',
|
|
13
|
+
'Invoice',
|
|
14
|
+
'MaintenanceTask',
|
|
15
|
+
'Message',
|
|
16
|
+
'Patient',
|
|
17
|
+
'Receipt',
|
|
18
|
+
'TimeTable',
|
|
19
|
+
]);
|
|
20
|
+
/**
|
|
21
|
+
* @internal this function is meant for internal use only and may be changed without notice
|
|
22
|
+
* Gets the class of an encrypted entity. Throws error if the class can't be retrieved.
|
|
23
|
+
* @param entity the entity object
|
|
24
|
+
* @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example
|
|
25
|
+
* due to the use of minified code).
|
|
26
|
+
* @return the class of the encrypted entity
|
|
27
|
+
*/
|
|
28
|
+
function encryptedEntityClassOf(entity, declaredClassName) {
|
|
29
|
+
const entityClass = tryGetEncryptedEntityClassOf(entity, declaredClassName);
|
|
30
|
+
if (entityClass) {
|
|
31
|
+
return entityClass;
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
throw new Error(`No valid encrypted entity class name (constructor: "${entity.constructor.name}",` +
|
|
35
|
+
`declared: ${declaredClassName ? '"' + declaredClassName + '"' : 'undefined'}).` +
|
|
36
|
+
`Please specify a valid class name.\nValid class names are ${Array.from(exports.entityWithDelegationTypeNames)}.`);
|
|
37
|
+
}
|
|
38
|
+
exports.encryptedEntityClassOf = encryptedEntityClassOf;
|
|
39
|
+
/**
|
|
40
|
+
* @internal this function is meant for internal use only and may be changed without notice
|
|
41
|
+
* Gets the class of an encrypted entity. Returns undefined if the class can't be retrieved.
|
|
42
|
+
* @param entity the entity object
|
|
43
|
+
* @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example
|
|
44
|
+
* due to the use of minified code).
|
|
45
|
+
* @return the class of the encrypted entity
|
|
46
|
+
*/
|
|
47
|
+
function tryGetEncryptedEntityClassOf(entity, declaredClassName) {
|
|
48
|
+
var _a;
|
|
49
|
+
const _type = entity._type;
|
|
50
|
+
if (_type && (typeof _type === 'string' || _type instanceof String)) {
|
|
51
|
+
const splitType = _type.split('.');
|
|
52
|
+
const candidate = splitType[splitType.length - 1];
|
|
53
|
+
if (exports.entityWithDelegationTypeNames.has(candidate)) {
|
|
54
|
+
if (declaredClassName && declaredClassName !== candidate)
|
|
55
|
+
throw new Error(`Declared type name "${declaredClassName}" does not match type detected from field \`_type:"${_type}"\` ("${candidate}")`);
|
|
56
|
+
return candidate;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!declaredClassName)
|
|
60
|
+
console.warn('Usage of a delegation-related method without specifying the entity class name, and input object does not have a `_type` value. ' +
|
|
61
|
+
'Will use constructor name as fallback, but this may not work with minified code.');
|
|
62
|
+
const constructorName = (_a = entity.constructor) === null || _a === void 0 ? void 0 : _a.name;
|
|
63
|
+
if (exports.entityWithDelegationTypeNames.has(constructorName)) {
|
|
64
|
+
if (declaredClassName && declaredClassName !== constructorName)
|
|
65
|
+
throw new Error(`Declared type name "${declaredClassName}" does not match valid constructor name "${constructorName}"`);
|
|
66
|
+
return constructorName;
|
|
67
|
+
}
|
|
68
|
+
else if (declaredClassName && exports.entityWithDelegationTypeNames.has(declaredClassName)) {
|
|
69
|
+
return declaredClassName;
|
|
70
|
+
}
|
|
71
|
+
else
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
exports.tryGetEncryptedEntityClassOf = tryGetEncryptedEntityClassOf;
|
|
75
|
+
//# sourceMappingURL=EntityWithDelegationTypeName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityWithDelegationTypeName.js","sourceRoot":"","sources":["../../../icc-x-api/utils/EntityWithDelegationTypeName.ts"],"names":[],"mappings":";;;AAKa,QAAA,6BAA6B,GAAsC,IAAI,GAAG,CAAC;IACtF,SAAS;IACT,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,SAAS;IACT,UAAU;IACV,MAAM;IACN,eAAe;IACf,SAAS;IACT,iBAAiB;IACjB,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;CACZ,CAAC,CAAA;AAuBF;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,MAA6C,EAC7C,iBAA2D;IAE3D,MAAM,WAAW,GAAG,4BAA4B,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC3E,IAAI,WAAW,EAAE;QACf,OAAO,WAAW,CAAA;KACnB;;QACC,MAAM,IAAI,KAAK,CACb,uDAAuD,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI;YAChF,aAAa,iBAAiB,CAAC,CAAC,CAAC,GAAG,GAAG,iBAAiB,GAAG,GAAG,CAAC,CAAC,CAAC,WAAW,IAAI;YAChF,6DAA6D,KAAK,CAAC,IAAI,CAAC,qCAA6B,CAAC,GAAG,CAC5G,CAAA;AACL,CAAC;AAbD,wDAaC;AAED;;;;;;;GAOG;AACH,SAAgB,4BAA4B,CAC1C,MAA6C,EAC7C,iBAA2D;;IAE3D,MAAM,KAAK,GAAI,MAAc,CAAC,KAAK,CAAA;IACnC,IAAI,KAAK,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC,EAAE;QACnE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClC,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QACjD,IAAI,qCAA6B,CAAC,GAAG,CAAC,SAAgB,CAAC,EAAE;YACvD,IAAI,iBAAiB,IAAI,iBAAiB,KAAK,SAAS;gBACtD,MAAM,IAAI,KAAK,CAAC,uBAAuB,iBAAiB,sDAAsD,KAAK,SAAS,SAAS,IAAI,CAAC,CAAA;YAC5I,OAAO,SAAyC,CAAA;SACjD;KACF;IACD,IAAI,CAAC,iBAAiB;QACpB,OAAO,CAAC,IAAI,CACV,iIAAiI;YAC/H,kFAAkF,CACrF,CAAA;IACH,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,IAAI,CAAA;IAChD,IAAI,qCAA6B,CAAC,GAAG,CAAC,eAAsB,CAAC,EAAE;QAC7D,IAAI,iBAAiB,IAAI,iBAAiB,KAAK,eAAe;YAC5D,MAAM,IAAI,KAAK,CAAC,uBAAuB,iBAAiB,4CAA4C,eAAe,GAAG,CAAC,CAAA;QACzH,OAAO,eAA+C,CAAA;KACvD;SAAM,IAAI,iBAAiB,IAAI,qCAA6B,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;QACpF,OAAO,iBAAiB,CAAA;KACzB;;QAAM,OAAO,SAAS,CAAA;AACzB,CAAC;AA3BD,oEA2BC","sourcesContent":["/**\n * Names of all possible encrypted entity types.\n */\nimport { EncryptedEntity, EncryptedEntityStub } from '../../icc-api/model/models'\n\nexport const entityWithDelegationTypeNames: Set<EntityWithDelegationTypeName> = new Set([\n 'Article',\n 'AccessLog',\n 'CalendarItem',\n 'Classification',\n 'Contact',\n 'Document',\n 'Form',\n 'HealthElement',\n 'Invoice',\n 'MaintenanceTask',\n 'Message',\n 'Patient',\n 'Receipt',\n 'TimeTable',\n])\n\nexport type EntityWithDelegationTypeName =\n | 'Article'\n | 'AccessLog'\n | 'CalendarItem'\n | 'Classification'\n | 'Contact'\n | 'Document'\n | 'Form'\n | 'HealthElement'\n | 'Invoice'\n | 'MaintenanceTask'\n | 'Message'\n | 'Patient'\n | 'Receipt'\n | 'TimeTable'\n/**\n * Type containing information on an entity and its type. If the entity is a stub (EncryptedEntityStub or IcureStub) the type should refer to the\n * original entity from which the stub was extracted.\n */\nexport type EncryptedEntityWithType = { entity: EncryptedEntityStub | EncryptedEntity; type: EntityWithDelegationTypeName }\n\n/**\n * @internal this function is meant for internal use only and may be changed without notice\n * Gets the class of an encrypted entity. Throws error if the class can't be retrieved.\n * @param entity the entity object\n * @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example\n * due to the use of minified code).\n * @return the class of the encrypted entity\n */\nexport function encryptedEntityClassOf(\n entity: EncryptedEntity | EncryptedEntityStub,\n declaredClassName: EntityWithDelegationTypeName | undefined\n): EntityWithDelegationTypeName {\n const entityClass = tryGetEncryptedEntityClassOf(entity, declaredClassName)\n if (entityClass) {\n return entityClass\n } else\n throw new Error(\n `No valid encrypted entity class name (constructor: \"${entity.constructor.name}\",` +\n `declared: ${declaredClassName ? '\"' + declaredClassName + '\"' : 'undefined'}).` +\n `Please specify a valid class name.\\nValid class names are ${Array.from(entityWithDelegationTypeNames)}.`\n )\n}\n\n/**\n * @internal this function is meant for internal use only and may be changed without notice\n * Gets the class of an encrypted entity. Returns undefined if the class can't be retrieved.\n * @param entity the entity object\n * @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example\n * due to the use of minified code).\n * @return the class of the encrypted entity\n */\nexport function tryGetEncryptedEntityClassOf(\n entity: EncryptedEntity | EncryptedEntityStub,\n declaredClassName: EntityWithDelegationTypeName | undefined\n): EntityWithDelegationTypeName | undefined {\n const _type = (entity as any)._type\n if (_type && (typeof _type === 'string' || _type instanceof String)) {\n const splitType = _type.split('.')\n const candidate = splitType[splitType.length - 1]\n if (entityWithDelegationTypeNames.has(candidate as any)) {\n if (declaredClassName && declaredClassName !== candidate)\n throw new Error(`Declared type name \"${declaredClassName}\" does not match type detected from field \\`_type:\"${_type}\"\\` (\"${candidate}\")`)\n return candidate as EntityWithDelegationTypeName\n }\n }\n if (!declaredClassName)\n console.warn(\n 'Usage of a delegation-related method without specifying the entity class name, and input object does not have a `_type` value. ' +\n 'Will use constructor name as fallback, but this may not work with minified code.'\n )\n const constructorName = entity.constructor?.name\n if (entityWithDelegationTypeNames.has(constructorName as any)) {\n if (declaredClassName && declaredClassName !== constructorName)\n throw new Error(`Declared type name \"${declaredClassName}\" does not match valid constructor name \"${constructorName}\"`)\n return constructorName as EntityWithDelegationTypeName\n } else if (declaredClassName && entityWithDelegationTypeNames.has(declaredClassName)) {\n return declaredClassName\n } else return undefined\n}\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the result of a share operation.
|
|
3
|
+
*/
|
|
4
|
+
import { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest';
|
|
5
|
+
import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
|
|
6
|
+
export interface ShareResult<T> {
|
|
7
|
+
/**
|
|
8
|
+
* Return the updated entity if the share operation was successful, else throw an error.
|
|
9
|
+
*/
|
|
10
|
+
get updatedEntityOrThrow(): T;
|
|
11
|
+
/**
|
|
12
|
+
* Map the result of a successful share operation to another type.
|
|
13
|
+
* @param f The mapping function.
|
|
14
|
+
* @return If the share result was successful a new share result containing the result of the mapping function, else the original share result.
|
|
15
|
+
*/
|
|
16
|
+
mapSuccess<U>(f: (t: T) => U): ShareResult<U>;
|
|
17
|
+
/**
|
|
18
|
+
* Async version of {@link mapSuccess}.
|
|
19
|
+
*/
|
|
20
|
+
mapSuccessAsync<U>(f: (t: T) => Promise<U>): Promise<ShareResult<U>>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Represents the result of a successful share operation.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ShareResultSuccess<T> implements ShareResult<T> {
|
|
26
|
+
private readonly updatedEntity;
|
|
27
|
+
/**
|
|
28
|
+
* @param updatedEntity The entity with updated encrypted metadata.
|
|
29
|
+
*/
|
|
30
|
+
constructor(updatedEntity: T);
|
|
31
|
+
get updatedEntityOrThrow(): T;
|
|
32
|
+
mapSuccess<U>(f: (t: T) => U): ShareResult<U>;
|
|
33
|
+
mapSuccessAsync<U>(f: (t: T) => Promise<U>): Promise<ShareResult<U>>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents the result of a failed share operation.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ShareResultFailure implements ShareResult<never> {
|
|
39
|
+
readonly errorsDetails: {
|
|
40
|
+
entityId: string;
|
|
41
|
+
delegateId: string;
|
|
42
|
+
request?: {
|
|
43
|
+
shareSecretIds?: string[];
|
|
44
|
+
shareEncryptionKeys?: string[];
|
|
45
|
+
shareOwningEntityIds?: string[];
|
|
46
|
+
requestedPermissions: RequestedPermissionEnum;
|
|
47
|
+
};
|
|
48
|
+
updatedForMigration: boolean;
|
|
49
|
+
code?: number;
|
|
50
|
+
reason?: string;
|
|
51
|
+
}[];
|
|
52
|
+
readonly message: string;
|
|
53
|
+
/**
|
|
54
|
+
* @param errorsDetails Details of the errors, as returned by the server.
|
|
55
|
+
* @param message Human-friendly error message, should provide additional context that the server may not have had, for example if the original user
|
|
56
|
+
* request was modified by the crypto API for migration purposes.
|
|
57
|
+
*/
|
|
58
|
+
constructor(errorsDetails: {
|
|
59
|
+
entityId: string;
|
|
60
|
+
delegateId: string;
|
|
61
|
+
request?: {
|
|
62
|
+
shareSecretIds?: string[];
|
|
63
|
+
shareEncryptionKeys?: string[];
|
|
64
|
+
shareOwningEntityIds?: string[];
|
|
65
|
+
requestedPermissions: RequestedPermissionEnum;
|
|
66
|
+
};
|
|
67
|
+
updatedForMigration: boolean;
|
|
68
|
+
code?: number;
|
|
69
|
+
reason?: string;
|
|
70
|
+
}[], message: string);
|
|
71
|
+
get updatedEntityOrThrow(): never;
|
|
72
|
+
mapSuccess<U>(f: (t: never) => U): ShareResult<U>;
|
|
73
|
+
mapSuccessAsync<U>(f: (t: never) => Promise<U>): Promise<ShareResult<U>>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
exports.ShareResultFailure = exports.ShareResultSuccess = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Represents the result of a successful share operation.
|
|
15
|
+
*/
|
|
16
|
+
class ShareResultSuccess {
|
|
17
|
+
/**
|
|
18
|
+
* @param updatedEntity The entity with updated encrypted metadata.
|
|
19
|
+
*/
|
|
20
|
+
constructor(updatedEntity) {
|
|
21
|
+
this.updatedEntity = updatedEntity;
|
|
22
|
+
}
|
|
23
|
+
get updatedEntityOrThrow() {
|
|
24
|
+
return this.updatedEntity;
|
|
25
|
+
}
|
|
26
|
+
mapSuccess(f) {
|
|
27
|
+
return new ShareResultSuccess(f(this.updatedEntity));
|
|
28
|
+
}
|
|
29
|
+
mapSuccessAsync(f) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
return new ShareResultSuccess(yield f(this.updatedEntity));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ShareResultSuccess = ShareResultSuccess;
|
|
36
|
+
/**
|
|
37
|
+
* Represents the result of a failed share operation.
|
|
38
|
+
*/
|
|
39
|
+
class ShareResultFailure {
|
|
40
|
+
/**
|
|
41
|
+
* @param errorsDetails Details of the errors, as returned by the server.
|
|
42
|
+
* @param message Human-friendly error message, should provide additional context that the server may not have had, for example if the original user
|
|
43
|
+
* request was modified by the crypto API for migration purposes.
|
|
44
|
+
*/
|
|
45
|
+
constructor(errorsDetails, message) {
|
|
46
|
+
this.errorsDetails = errorsDetails;
|
|
47
|
+
this.message = message;
|
|
48
|
+
}
|
|
49
|
+
get updatedEntityOrThrow() {
|
|
50
|
+
console.error(`Error when sharing an entity. Details: ${JSON.stringify(this.errorsDetails)}`);
|
|
51
|
+
throw new Error(this.message);
|
|
52
|
+
}
|
|
53
|
+
mapSuccess(f) {
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
mapSuccessAsync(f) {
|
|
57
|
+
return Promise.resolve(this);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.ShareResultFailure = ShareResultFailure;
|
|
61
|
+
//# sourceMappingURL=ShareResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShareResult.js","sourceRoot":"","sources":["../../../icc-x-api/utils/ShareResult.ts"],"names":[],"mappings":";;;;;;;;;;;;AAyBA;;GAEG;AACH,MAAa,kBAAkB;IAC7B;;OAEG;IACH,YAA6B,aAAgB;QAAhB,kBAAa,GAAb,aAAa,CAAG;IAAG,CAAC;IAEjD,IAAI,oBAAoB;QACtB,OAAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IAED,UAAU,CAAI,CAAc;QAC1B,OAAO,IAAI,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;IACtD,CAAC;IAEK,eAAe,CAAI,CAAuB;;YAC9C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;QAC5D,CAAC;KAAA;CACF;AAjBD,gDAiBC;AAED;;GAEG;AACH,MAAa,kBAAkB;IAC7B;;;;OAIG;IACH,YACW,aAYN,EACM,OAAe;QAbf,kBAAa,GAAb,aAAa,CAYnB;QACM,YAAO,GAAP,OAAO,CAAQ;IACvB,CAAC;IAEJ,IAAI,oBAAoB;QACtB,OAAO,CAAC,KAAK,CAAC,0CAA0C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;QAC7F,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,CAAC;IAED,UAAU,CAAI,CAAkB;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe,CAAI,CAA2B;QAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;CACF;AAnCD,gDAmCC","sourcesContent":["/**\n * Represents the result of a share operation.\n */\nimport { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\nexport interface ShareResult<T> {\n /**\n * Return the updated entity if the share operation was successful, else throw an error.\n */\n get updatedEntityOrThrow(): T\n\n /**\n * Map the result of a successful share operation to another type.\n * @param f The mapping function.\n * @return If the share result was successful a new share result containing the result of the mapping function, else the original share result.\n */\n mapSuccess<U>(f: (t: T) => U): ShareResult<U>\n\n /**\n * Async version of {@link mapSuccess}.\n */\n mapSuccessAsync<U>(f: (t: T) => Promise<U>): Promise<ShareResult<U>>\n}\n\n/**\n * Represents the result of a successful share operation.\n */\nexport class ShareResultSuccess<T> implements ShareResult<T> {\n /**\n * @param updatedEntity The entity with updated encrypted metadata.\n */\n constructor(private readonly updatedEntity: T) {}\n\n get updatedEntityOrThrow(): T {\n return this.updatedEntity\n }\n\n mapSuccess<U>(f: (t: T) => U): ShareResult<U> {\n return new ShareResultSuccess(f(this.updatedEntity))\n }\n\n async mapSuccessAsync<U>(f: (t: T) => Promise<U>): Promise<ShareResult<U>> {\n return new ShareResultSuccess(await f(this.updatedEntity))\n }\n}\n\n/**\n * Represents the result of a failed share operation.\n */\nexport class ShareResultFailure implements ShareResult<never> {\n /**\n * @param errorsDetails Details of the errors, as returned by the server.\n * @param message Human-friendly error message, should provide additional context that the server may not have had, for example if the original user\n * request was modified by the crypto API for migration purposes.\n */\n constructor(\n readonly errorsDetails: {\n entityId: string\n delegateId: string\n request?: {\n shareSecretIds?: string[]\n shareEncryptionKeys?: string[]\n shareOwningEntityIds?: string[]\n requestedPermissions: RequestedPermissionEnum\n }\n updatedForMigration: boolean\n code?: number\n reason?: string\n }[],\n readonly message: string\n ) {}\n\n get updatedEntityOrThrow(): never {\n console.error(`Error when sharing an entity. Details: ${JSON.stringify(this.errorsDetails)}`)\n throw new Error(this.message)\n }\n\n mapSuccess<U>(f: (t: never) => U): ShareResult<U> {\n return this\n }\n\n mapSuccessAsync<U>(f: (t: never) => Promise<U>): Promise<ShareResult<U>> {\n return Promise.resolve(this)\n }\n}\n"]}
|
|
@@ -20,3 +20,4 @@ export declare function ua2b64Url(ua: Uint8Array | ArrayBuffer): string;
|
|
|
20
20
|
export declare function b64Url2ua(ua: string): ArrayBuffer;
|
|
21
21
|
export declare function hex2string(hexStr: string): string;
|
|
22
22
|
export declare function string2hex(text: string): string;
|
|
23
|
+
export declare function concat_uas(ua1: Uint8Array, ua2: Uint8Array): Uint8Array;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.string2hex = exports.hex2string = exports.b64Url2ua = exports.ua2b64Url = exports.b64_2uas = exports.ua2hex = exports.hex2ua = exports.ua2utf8 = exports.utf8_2ua = exports.a2b = exports.b2a = exports.ua2b64 = exports.b64_2ua = exports.b64_2ab = exports.ua2ab = exports.string2ab = exports.string2ua = exports.ua2string = void 0;
|
|
3
|
+
exports.concat_uas = exports.string2hex = exports.hex2string = exports.b64Url2ua = exports.ua2b64Url = exports.b64_2uas = exports.ua2hex = exports.hex2ua = exports.ua2utf8 = exports.utf8_2ua = exports.a2b = exports.b2a = exports.ua2b64 = exports.b64_2ua = exports.b64_2ab = exports.ua2ab = exports.string2ab = exports.string2ua = exports.ua2string = void 0;
|
|
4
4
|
const ModelHelper_1 = require("../../icc-api/model/ModelHelper");
|
|
5
5
|
Object.defineProperty(exports, "ua2string", { enumerable: true, get: function () { return ModelHelper_1.ua2string; } });
|
|
6
6
|
Object.defineProperty(exports, "string2ua", { enumerable: true, get: function () { return ModelHelper_1.string2ua; } });
|
|
@@ -166,4 +166,11 @@ function string2hex(text) {
|
|
|
166
166
|
return ua2hex((0, ModelHelper_1.string2ua)(text));
|
|
167
167
|
}
|
|
168
168
|
exports.string2hex = string2hex;
|
|
169
|
+
function concat_uas(ua1, ua2) {
|
|
170
|
+
const newBuffer = new Uint8Array(ua1.length + ua2.length);
|
|
171
|
+
newBuffer.set(ua1, 0);
|
|
172
|
+
newBuffer.set(ua2, ua1.length);
|
|
173
|
+
return newBuffer;
|
|
174
|
+
}
|
|
175
|
+
exports.concat_uas = concat_uas;
|
|
169
176
|
//# sourceMappingURL=binary-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/binary-utils.ts"],"names":[],"mappings":";;;AAAA,iEAA4H;AACnH,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,sFADA,mBAAK,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,uFADA,oBAAM,OACA;AAAE,oFADA,iBAAG,OACA;AAAE,oFADA,iBAAG,OACA;AAEnF,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACjF,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAEjF,SAAgB,QAAQ,CAAC,GAAW;IAClC,IAAI,WAAW,EA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C,CAAA;AAClC,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,MAAM,CAAC,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC,CAAA;AAChC,CAAC;AAFD,gCAEC","sourcesContent":["import { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b } from '../../icc-api/model/ModelHelper'\nexport { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b }\n\nconst textDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : null\nconst textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null\n\nexport function utf8_2ua(str: string): Uint8Array {\n if (textEncoder) {\n return textEncoder.encode(str)\n }\n\n const utf8 = new Uint8Array(4 * str.length)\n let j = 0\n for (let i = 0; i < str.length; i++) {\n let charcode = str.charCodeAt(i)\n if (charcode < 0x80) {\n utf8.set([charcode], j++)\n } else if (charcode < 0x800) {\n utf8.set([0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f)], j)\n j += 2\n } else if (charcode < 0xd800 || charcode >= 0xe000) {\n utf8.set([0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 3\n } else {\n i++\n // UTF-16 encodes 0x10000-0x10FFFF by\n // subtracting 0x10000 and splitting the\n // 20 bits of 0x0-0xFFFFF into two halves\n charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff))\n utf8.set([0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 4\n }\n }\n return utf8.subarray(0, j)\n}\n\n/**\n * Uint8Array/ArrayBuffer to utf-8 strring\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} a UTF-8 encoded string\n */\nexport function ua2utf8(_ua: Uint8Array | ArrayBuffer): string {\n if (textDecoder) {\n // if _ua is undefined, imitate the JS implementation below which returns an empty string\n return _ua ? textDecoder.decode(_ua) : ''\n }\n\n let out, i, len, c, u\n let char2, char3, char4\n\n // avoid applying the Uint8Array constructor: on ArrayBuffer it creates a\n // view but on Uint8Array it creates a copy\n const array = ArrayBuffer.isView(_ua) ? _ua : new Uint8Array(_ua)\n\n out = ''\n len = array.length || array.byteLength\n i = 0\n while (i < len) {\n c = array[i++]\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c)\n break\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++]\n out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))\n break\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))\n break\n case 15:\n // 1111 xxxx 10xx xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n char4 = array[i++]\n u = ((c & 0x07) << 18) | ((char2 & 0x3f) << 12) | ((char3 & 0x3f) << 6) | (((char4 & 0x3f) << 0) - 0x10000)\n out += String.fromCharCode(0xd800 + (u >> 10))\n out += String.fromCharCode(0xdc00 + (u & 1023))\n break\n }\n }\n\n return out\n}\n\nexport function hex2ua(s: string): Uint8Array {\n const ua = new Uint8Array(s.length / 2)\n s = s.toLowerCase()\n for (let i = 0; i < s.length; i += 2) {\n ua[i / 2] =\n (s.charCodeAt(i) < 58 ? s.charCodeAt(i) - 48 : s.charCodeAt(i) - 87) * 16 +\n (s.charCodeAt(i + 1) < 58 ? s.charCodeAt(i + 1) - 48 : s.charCodeAt(i + 1) - 87)\n }\n return ua\n}\n\n/**\n * Uint8Array/ArrayBuffer to hex String\n *\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} Hex String\n */\nexport function ua2hex(_ua: Uint8Array | ArrayBuffer): string {\n let s = ''\n const ua = new Uint8Array(_ua)\n for (let i = 0; i < ua.length; i++) {\n const hhb = (ua[i] & 0xf0) >> 4\n const lhb = ua[i] & 0x0f\n s += String.fromCharCode(hhb > 9 ? hhb + 87 : hhb + 48)\n s += String.fromCharCode(lhb > 9 ? lhb + 87 : lhb + 48)\n }\n\n return s\n}\n\nexport function b64_2uas(s: string): Array<Uint8Array> {\n const sliceSize = 1024\n const byteCharacters = a2b(s)\n const bytesLength = byteCharacters.length\n const slicesCount = Math.ceil(bytesLength / sliceSize)\n const byteArrays = new Array(slicesCount)\n\n for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {\n const begin = sliceIndex * sliceSize\n const end = Math.min(begin + sliceSize, bytesLength)\n\n const bytes = new Array(end - begin)\n for (let offset = begin, i = 0; offset < end; ++i, ++offset) {\n bytes[i] = byteCharacters[offset].charCodeAt(0)\n }\n byteArrays[sliceIndex] = new Uint8Array(bytes)\n }\n return byteArrays\n}\n\nexport function ua2b64Url(ua: Uint8Array | ArrayBuffer): string {\n return ua2b64(ua).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '')\n}\n\nexport function b64Url2ua(ua: string): ArrayBuffer {\n return b64_2ua(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''))\n}\n\nexport function hex2string(hexStr: string): string {\n return ua2string(hex2ua(hexStr))\n}\n\nexport function string2hex(text: string): string {\n return ua2hex(string2ua(text))\n}\n"]}
|
|
1
|
+
{"version":3,"file":"binary-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/binary-utils.ts"],"names":[],"mappings":";;;AAAA,iEAA4H;AACnH,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,sFADA,mBAAK,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,wFADA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,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5I,CAAC;AAFD,8BAEC;AAED,SAAgB,UAAU,CAAC,MAAc;IACvC,OAAO,IAAA,uBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AAClC,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,MAAM,CAAC,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC,CAAA;AAChC,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,GAAe,EAAE,GAAe;IACzD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;IACzD,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IACrB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC9B,OAAO,SAAS,CAAA;AAClB,CAAC;AALD,gCAKC","sourcesContent":["import { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b } from '../../icc-api/model/ModelHelper'\nexport { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b }\n\nconst textDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : null\nconst textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null\n\nexport function utf8_2ua(str: string): Uint8Array {\n if (textEncoder) {\n return textEncoder.encode(str)\n }\n\n const utf8 = new Uint8Array(4 * str.length)\n let j = 0\n for (let i = 0; i < str.length; i++) {\n let charcode = str.charCodeAt(i)\n if (charcode < 0x80) {\n utf8.set([charcode], j++)\n } else if (charcode < 0x800) {\n utf8.set([0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f)], j)\n j += 2\n } else if (charcode < 0xd800 || charcode >= 0xe000) {\n utf8.set([0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 3\n } else {\n i++\n // UTF-16 encodes 0x10000-0x10FFFF by\n // subtracting 0x10000 and splitting the\n // 20 bits of 0x0-0xFFFFF into two halves\n charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff))\n utf8.set([0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 4\n }\n }\n return utf8.subarray(0, j)\n}\n\n/**\n * Uint8Array/ArrayBuffer to utf-8 strring\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} a UTF-8 encoded string\n */\nexport function ua2utf8(_ua: Uint8Array | ArrayBuffer): string {\n if (textDecoder) {\n // if _ua is undefined, imitate the JS implementation below which returns an empty string\n return _ua ? textDecoder.decode(_ua) : ''\n }\n\n let out, i, len, c, u\n let char2, char3, char4\n\n // avoid applying the Uint8Array constructor: on ArrayBuffer it creates a\n // view but on Uint8Array it creates a copy\n const array = ArrayBuffer.isView(_ua) ? _ua : new Uint8Array(_ua)\n\n out = ''\n len = array.length || array.byteLength\n i = 0\n while (i < len) {\n c = array[i++]\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c)\n break\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++]\n out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))\n break\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))\n break\n case 15:\n // 1111 xxxx 10xx xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n char4 = array[i++]\n u = ((c & 0x07) << 18) | ((char2 & 0x3f) << 12) | ((char3 & 0x3f) << 6) | (((char4 & 0x3f) << 0) - 0x10000)\n out += String.fromCharCode(0xd800 + (u >> 10))\n out += String.fromCharCode(0xdc00 + (u & 1023))\n break\n }\n }\n\n return out\n}\n\nexport function hex2ua(s: string): Uint8Array {\n const ua = new Uint8Array(s.length / 2)\n s = s.toLowerCase()\n for (let i = 0; i < s.length; i += 2) {\n ua[i / 2] =\n (s.charCodeAt(i) < 58 ? s.charCodeAt(i) - 48 : s.charCodeAt(i) - 87) * 16 +\n (s.charCodeAt(i + 1) < 58 ? s.charCodeAt(i + 1) - 48 : s.charCodeAt(i + 1) - 87)\n }\n return ua\n}\n\n/**\n * Uint8Array/ArrayBuffer to hex String\n *\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} Hex String\n */\nexport function ua2hex(_ua: Uint8Array | ArrayBuffer): string {\n let s = ''\n const ua = new Uint8Array(_ua)\n for (let i = 0; i < ua.length; i++) {\n const hhb = (ua[i] & 0xf0) >> 4\n const lhb = ua[i] & 0x0f\n s += String.fromCharCode(hhb > 9 ? hhb + 87 : hhb + 48)\n s += String.fromCharCode(lhb > 9 ? lhb + 87 : lhb + 48)\n }\n\n return s\n}\n\nexport function b64_2uas(s: string): Array<Uint8Array> {\n const sliceSize = 1024\n const byteCharacters = a2b(s)\n const bytesLength = byteCharacters.length\n const slicesCount = Math.ceil(bytesLength / sliceSize)\n const byteArrays = new Array(slicesCount)\n\n for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {\n const begin = sliceIndex * sliceSize\n const end = Math.min(begin + sliceSize, bytesLength)\n\n const bytes = new Array(end - begin)\n for (let offset = begin, i = 0; offset < end; ++i, ++offset) {\n bytes[i] = byteCharacters[offset].charCodeAt(0)\n }\n byteArrays[sliceIndex] = new Uint8Array(bytes)\n }\n return byteArrays\n}\n\nexport function ua2b64Url(ua: Uint8Array | ArrayBuffer): string {\n return ua2b64(ua).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '')\n}\n\nexport function b64Url2ua(ua: string): ArrayBuffer {\n return b64_2ua(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''))\n}\n\nexport function hex2string(hexStr: string): string {\n return ua2string(hex2ua(hexStr))\n}\n\nexport function string2hex(text: string): string {\n return ua2hex(string2ua(text))\n}\n\nexport function concat_uas(ua1: Uint8Array, ua2: Uint8Array): Uint8Array {\n const newBuffer = new Uint8Array(ua1.length + ua2.length)\n newBuffer.set(ua1, 0)\n newBuffer.set(ua2, ua1.length)\n return newBuffer\n}\n"]}
|
|
@@ -6,3 +6,8 @@ export declare function setEquals<T>(setA: Set<T>, setB: Set<T>): boolean;
|
|
|
6
6
|
* Check if two arrays are equals (they contain the same elements). Will not work if the content can't be compared by `==`.
|
|
7
7
|
*/
|
|
8
8
|
export declare function arrayEquals<T>(arrayA: T[], arrayB: T[]): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Fully consumes an async generator and provides all results as an array.
|
|
11
|
+
* @param generator an async generator.
|
|
12
|
+
*/
|
|
13
|
+
export declare function asyncGeneratorToArray<T>(generator: AsyncGenerator<T, any, never>): Promise<T[]>;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrayEquals = exports.setEquals = void 0;
|
|
12
|
+
exports.asyncGeneratorToArray = exports.arrayEquals = exports.setEquals = void 0;
|
|
4
13
|
/**
|
|
5
14
|
* Check if two sets are equals (they contain the same elements). Will not work if the content can't be compared by `==`.
|
|
6
15
|
*/
|
|
@@ -23,4 +32,20 @@ function arrayEquals(arrayA, arrayB) {
|
|
|
23
32
|
return true;
|
|
24
33
|
}
|
|
25
34
|
exports.arrayEquals = arrayEquals;
|
|
35
|
+
/**
|
|
36
|
+
* Fully consumes an async generator and provides all results as an array.
|
|
37
|
+
* @param generator an async generator.
|
|
38
|
+
*/
|
|
39
|
+
function asyncGeneratorToArray(generator) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const res = [];
|
|
42
|
+
let latest = yield generator.next();
|
|
43
|
+
while (!latest.done) {
|
|
44
|
+
res.push(latest.value);
|
|
45
|
+
latest = yield generator.next();
|
|
46
|
+
}
|
|
47
|
+
return res;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exports.asyncGeneratorToArray = asyncGeneratorToArray;
|
|
26
51
|
//# sourceMappingURL=collection-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/collection-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collection-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/collection-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,SAAgB,SAAS,CAAI,IAAY,EAAE,IAAY;IACrD,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AACnD,CAAC;AAHD,8BAGC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAI,MAAW,EAAE,MAAW;IACrD,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACtC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAA;KAC1C;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAND,kCAMC;AAED;;;GAGG;AACH,SAAsB,qBAAqB,CAAI,SAAwC;;QACrF,MAAM,GAAG,GAAG,EAAE,CAAA;QACd,IAAI,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;QACnC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;YACnB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtB,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;SAChC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;CAAA;AARD,sDAQC","sourcesContent":["/**\n * Check if two sets are equals (they contain the same elements). Will not work if the content can't be compared by `==`.\n */\nexport function setEquals<T>(setA: Set<T>, setB: Set<T>): boolean {\n if (setA.size != setB.size) return false\n return Array.from(setA).every((x) => setB.has(x))\n}\n\n/**\n * Check if two arrays are equals (they contain the same elements). Will not work if the content can't be compared by `==`.\n */\nexport function arrayEquals<T>(arrayA: T[], arrayB: T[]): boolean {\n if (arrayA.length != arrayB.length) return false\n for (let i = 0; i < arrayA.length; ++i) {\n if (arrayA[i] !== arrayB[i]) return false\n }\n return true\n}\n\n/**\n * Fully consumes an async generator and provides all results as an array.\n * @param generator an async generator.\n */\nexport async function asyncGeneratorToArray<T>(generator: AsyncGenerator<T, any, never>): Promise<T[]> {\n const res = []\n let latest = await generator.next()\n while (!latest.done) {\n res.push(latest.value)\n latest = await generator.next()\n }\n return res\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { KeyPair } from '../crypto/RSA';
|
|
1
|
+
import { KeyPair, ShaVersion } from '../crypto/RSA';
|
|
2
2
|
export declare function notConcurrent<T>(concurrencyMap: {
|
|
3
3
|
[key: string]: PromiseLike<any>;
|
|
4
4
|
}, key: string, proc: () => PromiseLike<T>): PromiseLike<T>;
|
|
5
5
|
export declare function jwk2pkcs8(jwk: any): string;
|
|
6
6
|
export declare function jwk2spki(jwk: any): string;
|
|
7
|
-
export declare function spkiToJwk(buf: Uint8Array): {
|
|
7
|
+
export declare function spkiToJwk(buf: Uint8Array, shaVersion: ShaVersion): {
|
|
8
8
|
kty: string;
|
|
9
9
|
alg: string;
|
|
10
10
|
n: string;
|
|
@@ -192,6 +192,7 @@ export declare function decryptObject(obj: {
|
|
|
192
192
|
/**
|
|
193
193
|
* Extracts the full jwk key pair from the jwk representation of the private key.
|
|
194
194
|
* @param privateKeyJwk private key in jwk representation
|
|
195
|
+
* @param shaVersion the SHA algorithm version
|
|
195
196
|
* @throws if the key is missing the public modulus or public exponent.
|
|
196
197
|
*/
|
|
197
|
-
export declare function keyPairFromPrivateKeyJwk(privateKeyJwk: JsonWebKey): KeyPair<JsonWebKey>;
|
|
198
|
+
export declare function keyPairFromPrivateKeyJwk(privateKeyJwk: JsonWebKey, shaVersion: ShaVersion): KeyPair<JsonWebKey>;
|
|
@@ -83,7 +83,7 @@ function jwk2spki(jwk) {
|
|
|
83
83
|
]);
|
|
84
84
|
}
|
|
85
85
|
exports.jwk2spki = jwk2spki;
|
|
86
|
-
function spkiToJwk(buf) {
|
|
86
|
+
function spkiToJwk(buf, shaVersion) {
|
|
87
87
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
88
88
|
const asn1 = (0, asn1_parser_1.parseAsn1)(new Uint8Array(buf));
|
|
89
89
|
var modulus = undefined;
|
|
@@ -105,7 +105,7 @@ function spkiToJwk(buf) {
|
|
|
105
105
|
}
|
|
106
106
|
return {
|
|
107
107
|
kty: 'RSA',
|
|
108
|
-
alg: 'RSA-OAEP',
|
|
108
|
+
alg: shaVersion === 'sha-256' ? 'RSA-OAEP-256' : 'RSA-OAEP',
|
|
109
109
|
ext: true,
|
|
110
110
|
n: (0, binary_utils_1.ua2b64Url)(minimalRep(modulus)),
|
|
111
111
|
e: (0, binary_utils_1.ua2b64Url)(minimalRep(exponent)),
|
|
@@ -500,14 +500,15 @@ exports.decryptObject = decryptObject;
|
|
|
500
500
|
/**
|
|
501
501
|
* Extracts the full jwk key pair from the jwk representation of the private key.
|
|
502
502
|
* @param privateKeyJwk private key in jwk representation
|
|
503
|
+
* @param shaVersion the SHA algorithm version
|
|
503
504
|
* @throws if the key is missing the public modulus or public exponent.
|
|
504
505
|
*/
|
|
505
|
-
function keyPairFromPrivateKeyJwk(privateKeyJwk) {
|
|
506
|
+
function keyPairFromPrivateKeyJwk(privateKeyJwk, shaVersion) {
|
|
506
507
|
if (!privateKeyJwk.n || !privateKeyJwk.e)
|
|
507
508
|
throw new Error('Incomplete private JsonWebKey: missing public modulus and/or exponent');
|
|
508
509
|
return {
|
|
509
510
|
privateKey: privateKeyJwk,
|
|
510
|
-
publicKey: spkiToJwk((0, binary_utils_1.hex2ua)(jwk2spki(privateKeyJwk))),
|
|
511
|
+
publicKey: spkiToJwk((0, binary_utils_1.hex2ua)(jwk2spki(privateKeyJwk)), shaVersion),
|
|
511
512
|
};
|
|
512
513
|
}
|
|
513
514
|
exports.keyPairFromPrivateKeyJwk = keyPairFromPrivateKeyJwk;
|