@icure/api 4.1.17 → 4.2.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/IccApplicationsettingsApi.d.ts +6 -0
- package/icc-api/api/IccApplicationsettingsApi.js +15 -0
- package/icc-api/api/IccApplicationsettingsApi.js.map +1 -1
- package/icc-api/api/IccGroupApi.d.ts +12 -2
- package/icc-api/api/IccGroupApi.js +26 -2
- package/icc-api/api/IccGroupApi.js.map +1 -1
- package/icc-api/api/IccTarificationApi.d.ts +4 -2
- package/icc-api/api/IccTarificationApi.js +6 -2
- package/icc-api/api/IccTarificationApi.js.map +1 -1
- package/icc-api/model/HealthcareParty.d.ts +6 -0
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-x-api/filters/UserByNameEmailPhoneFilter.d.ts +18 -0
- package/icc-x-api/filters/UserByNameEmailPhoneFilter.js +25 -0
- package/icc-x-api/filters/UserByNameEmailPhoneFilter.js.map +1 -0
- package/icc-x-api/icc-accesslog-x-api.d.ts +3 -1
- package/icc-x-api/icc-accesslog-x-api.js +18 -17
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +4 -2
- package/icc-x-api/icc-calendar-item-x-api.js +19 -18
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +3 -1
- package/icc-x-api/icc-classification-x-api.js +7 -6
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +3 -1
- package/icc-x-api/icc-contact-x-api.js +25 -21
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +10 -10
- package/icc-x-api/icc-crypto-x-api.js +21 -21
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +4 -2
- package/icc-x-api/icc-document-x-api.js +24 -21
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +4 -2
- package/icc-x-api/icc-form-x-api.js +22 -21
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +29 -4
- package/icc-x-api/icc-helement-x-api.js +136 -11
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +5 -3
- package/icc-x-api/icc-invoice-x-api.js +22 -21
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +3 -1
- package/icc-x-api/icc-message-x-api.js +7 -6
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +3 -1
- package/icc-x-api/icc-patient-x-api.js +19 -17
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +4 -2
- package/icc-x-api/icc-receipt-x-api.js +21 -20
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +4 -2
- package/icc-x-api/icc-time-table-x-api.js +5 -4
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.d.ts +2 -0
- package/icc-x-api/icc-user-x-api.js +8 -0
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/icc-x-api/index.js +12 -12
- package/icc-x-api/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -263,7 +263,7 @@ class IccCryptoXApi {
|
|
|
263
263
|
* the delegations.
|
|
264
264
|
* 3. Decrypt's delegators' keys and returns them.
|
|
265
265
|
*
|
|
266
|
-
* @param
|
|
266
|
+
* @param dataOwnerId : the id of the delegate HCP
|
|
267
267
|
* @param delegations : generic delegations (can be SPKs, CFKs, EKs) for all delegates
|
|
268
268
|
* @param fallbackOnParent default true; use parent's healthCarePartyId in case there's no delegation for the `healthcarePartyId`
|
|
269
269
|
* @returns - **delegatorId** : the id of the delegator HcP that shares the **key** with the `healthcarePartyId`
|
|
@@ -271,18 +271,18 @@ class IccCryptoXApi {
|
|
|
271
271
|
*/
|
|
272
272
|
decryptAndImportAesHcPartyKeysInDelegations(
|
|
273
273
|
//TODO: suggested name: getDecryptedHcPKeysOfDelegateAndParentsFromGenericDelegations
|
|
274
|
-
|
|
274
|
+
dataOwnerId, delegations, fallbackOnParent = true) {
|
|
275
275
|
const delegatorIds = {};
|
|
276
|
-
const delegationsArray = delegations[
|
|
276
|
+
const delegationsArray = delegations[dataOwnerId];
|
|
277
277
|
if (delegationsArray && delegationsArray.length) {
|
|
278
278
|
delegationsArray.forEach(function (delegationItem) {
|
|
279
279
|
delegatorIds[delegationItem.owner] = true; //TODO: why is set to true?
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
else if (fallbackOnParent) {
|
|
283
|
-
return this.getDataOwner(
|
|
283
|
+
return this.getDataOwner(dataOwnerId).then(({ dataOwner: hcp }) => hcp.parentId ? this.decryptAndImportAesHcPartyKeysInDelegations(hcp.parentId, delegations) : Promise.resolve([]));
|
|
284
284
|
}
|
|
285
|
-
return this.decryptAndImportAesHcPartyKeysForDelegators(Object.keys(delegatorIds),
|
|
285
|
+
return this.decryptAndImportAesHcPartyKeysForDelegators(Object.keys(delegatorIds), dataOwnerId);
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
288
|
* Retreive the owner HealthCareParty key and use it to encrypt
|
|
@@ -674,31 +674,31 @@ class IccCryptoXApi {
|
|
|
674
674
|
}
|
|
675
675
|
/**
|
|
676
676
|
* Get decrypted generic secret IDs (secretIdSPKs, parentIds, secretIdEKs) from generic delegations (SPKs, CFKs, EKs)
|
|
677
|
-
* 1. Get
|
|
678
|
-
* 2. Decrypt the keys of the given
|
|
677
|
+
* 1. Get Data Owner (HCP, Patient or Device) from it's Id.
|
|
678
|
+
* 2. Decrypt the keys of the given data owner.
|
|
679
679
|
* 3. Decrypt the parent's key if it has parent.
|
|
680
680
|
* 4. Return the decrypted key corresponding to the Health Care Party.
|
|
681
|
-
* @param
|
|
681
|
+
* @param dataOwnerId : the id of the delegate data owner (including its parents) for which to decrypt `extractedKeys`
|
|
682
682
|
* @param objectId : the id of the object/document of which delegations to decrypt ; used just to log to console a message (Cryptographic mistake) in case the object id inside SPK, CFK, EK is different from this one
|
|
683
683
|
* @param delegations : generic delegations (can be SPKs, CFKs, EKs) for all delegates from where to extract `extractedKeys`
|
|
684
|
-
* @returns - **extractedKeys** array containing secret IDs from decrypted generic delegations, from both
|
|
685
|
-
* - **
|
|
684
|
+
* @returns - **extractedKeys** array containing secret IDs from decrypted generic delegations, from both data owner with given `dataOwnerId` and its parents; can contain duplicates
|
|
685
|
+
* - **dataOwnerId** the given `dataOwnerId` OR, if a parent exist, the data owner id of the top parent in the hierarchy (even if that parent has no delegations)
|
|
686
686
|
*/
|
|
687
|
-
//TODO: even if there are no delegations for parent HCP (but the parent exists), the returned
|
|
687
|
+
//TODO: even if there are no delegations for parent HCP (but the parent exists), the returned dataOwnerId will be the one of the parent
|
|
688
688
|
extractKeysFromDelegationsForHcpHierarchy(
|
|
689
689
|
//TODO suggested name: getSecretIdsOfHcpAndParentsFromGenericDelegations
|
|
690
|
-
|
|
691
|
-
return this.getDataOwner(
|
|
692
|
-
? this.decryptAndImportAesHcPartyKeysInDelegations(
|
|
690
|
+
dataOwnerId, objectId, delegations) {
|
|
691
|
+
return this.getDataOwner(dataOwnerId).then(({ dataOwner: hcp }) => (delegations[dataOwnerId] && delegations[dataOwnerId].length
|
|
692
|
+
? this.decryptAndImportAesHcPartyKeysInDelegations(dataOwnerId, delegations, false).then((decryptedAndImportedAesHcPartyKeys) => {
|
|
693
693
|
const collatedAesKeysFromDelegatorToHcpartyId = {};
|
|
694
694
|
decryptedAndImportedAesHcPartyKeys.forEach((k) => (collatedAesKeysFromDelegatorToHcpartyId[k.delegatorId] = k));
|
|
695
|
-
return this.decryptKeyInDelegationLikes(delegations[
|
|
695
|
+
return this.decryptKeyInDelegationLikes(delegations[dataOwnerId], collatedAesKeysFromDelegatorToHcpartyId, objectId);
|
|
696
696
|
})
|
|
697
697
|
: Promise.resolve([])).then((extractedKeys) => hcp.parentId
|
|
698
698
|
? this.extractKeysFromDelegationsForHcpHierarchy(hcp.parentId, objectId, delegations).then((parentResponse) => _.assign(parentResponse, {
|
|
699
699
|
extractedKeys: parentResponse.extractedKeys.concat(extractedKeys),
|
|
700
700
|
}))
|
|
701
|
-
: { extractedKeys: extractedKeys, hcpartyId:
|
|
701
|
+
: { extractedKeys: extractedKeys, hcpartyId: dataOwnerId }));
|
|
702
702
|
}
|
|
703
703
|
/**
|
|
704
704
|
* Gets an array of generic secret IDs decrypted from a list of generic delegations (SPKs, CFKs, EKs) `delegationsArray`
|
|
@@ -990,13 +990,13 @@ class IccCryptoXApi {
|
|
|
990
990
|
})));
|
|
991
991
|
}
|
|
992
992
|
// noinspection JSUnusedGlobalSymbols
|
|
993
|
-
checkPrivateKeyValidity(
|
|
993
|
+
checkPrivateKeyValidity(dataOwner) {
|
|
994
994
|
return new Promise((resolve) => {
|
|
995
995
|
this._RSA
|
|
996
|
-
.importKey('jwk', this._utils.spkiToJwk(binary_utils_1.hex2ua(
|
|
996
|
+
.importKey('jwk', this._utils.spkiToJwk(binary_utils_1.hex2ua(dataOwner.publicKey)), ['encrypt'])
|
|
997
997
|
.then((k) => this._RSA.encrypt(k, binary_utils_1.utf8_2ua('shibboleth')))
|
|
998
998
|
.then((cipher) => {
|
|
999
|
-
const kp = this._RSA.loadKeyPairNotImported(
|
|
999
|
+
const kp = this._RSA.loadKeyPairNotImported(dataOwner.id);
|
|
1000
1000
|
return this._RSA
|
|
1001
1001
|
.importKeyPair('jwk', kp.privateKey, 'jwk', kp.publicKey)
|
|
1002
1002
|
.then((ikp) => this._RSA.decrypt(ikp.privateKey, new Uint8Array(cipher)));
|
|
@@ -1024,10 +1024,10 @@ class IccCryptoXApi {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
throw '### THIS SHOULD NOT HAPPEN: ' + argName + ' has an invalid value: ' + argValue + details;
|
|
1026
1026
|
}
|
|
1027
|
-
getEncryptionDecryptionKeys(
|
|
1027
|
+
getEncryptionDecryptionKeys(dataOwnerId, document) {
|
|
1028
1028
|
return !document.id
|
|
1029
1029
|
? Promise.resolve(null)
|
|
1030
|
-
: this.extractKeysFromDelegationsForHcpHierarchy(
|
|
1030
|
+
: this.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId, document.id, (document.encryptionKeys && Object.keys(document.encryptionKeys).length && document.encryptionKeys) || document.delegations)
|
|
1031
1031
|
.then(({ extractedKeys }) => _.uniq(extractedKeys))
|
|
1032
1032
|
.catch(() => null);
|
|
1033
1033
|
}
|