@icure/api 5.3.16 → 5.3.18
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/IccUserApi.d.ts +2 -0
- package/icc-api/api/IccUserApi.js +62 -0
- package/icc-api/api/IccUserApi.js.map +1 -1
- package/icc-api/model/models.d.ts +2 -2
- package/icc-x-api/auth/AuthenticationProvider.js +6 -6
- package/icc-x-api/auth/AuthenticationProvider.js.map +1 -1
- package/icc-x-api/crypto/AES.js +3 -3
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/filters/filters.d.ts +1 -1
- package/icc-x-api/icc-bekmehr-x-api.d.ts +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +1 -1
- package/icc-x-api/icc-crypto-x-api.js +41 -41
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.d.ts +1 -1
- package/icc-x-api/icc-hcparty-x-api.js +62 -24
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/utils/asn1-packer.d.ts +1 -1
- package/icc-x-api/utils/asn1-parser.d.ts +1 -1
- package/icc-x-api/utils/net-utils.d.ts +2 -2
- package/package.json +1 -1
|
@@ -19,47 +19,6 @@ const binary_utils_1 = require("./utils/binary-utils");
|
|
|
19
19
|
const utils_1 = require("./utils");
|
|
20
20
|
const error_reporting_1 = require("./utils/error-reporting");
|
|
21
21
|
class IccCryptoXApi {
|
|
22
|
-
get crypto() {
|
|
23
|
-
return this._crypto;
|
|
24
|
-
}
|
|
25
|
-
get shamir() {
|
|
26
|
-
return this._shamir;
|
|
27
|
-
}
|
|
28
|
-
get RSA() {
|
|
29
|
-
return this._RSA;
|
|
30
|
-
}
|
|
31
|
-
get AES() {
|
|
32
|
-
return this._AES;
|
|
33
|
-
}
|
|
34
|
-
get keyStorage() {
|
|
35
|
-
return this._keyStorage;
|
|
36
|
-
}
|
|
37
|
-
get storage() {
|
|
38
|
-
return this._storage;
|
|
39
|
-
}
|
|
40
|
-
emptyHcpCache(hcpartyId) {
|
|
41
|
-
delete this.hcPartyKeysRequestsCache[hcpartyId];
|
|
42
|
-
delete this.dataOwnerCache[hcpartyId];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @internal may be changed without notice
|
|
46
|
-
* Gets all delegate encrypted HcParty keys of the delegate with the given `delegateHcPartyId`, and for each key the delegator id
|
|
47
|
-
* If the keys are not cached, they are retrieved from the backend.
|
|
48
|
-
*
|
|
49
|
-
* @param delegateHcPartyId The Health Care Party id
|
|
50
|
-
* @returns \{delegatorId: delegateEncryptedHcPartyKey\}
|
|
51
|
-
*/
|
|
52
|
-
getEncryptedAesExchangeKeysForDelegate(delegateHcPartyId) {
|
|
53
|
-
return (this.hcPartyKeysRequestsCache[delegateHcPartyId] ||
|
|
54
|
-
(this.hcPartyKeysRequestsCache[delegateHcPartyId] = this.forceGetEncryptedAesExchangeKeysForDelegate(delegateHcPartyId)));
|
|
55
|
-
}
|
|
56
|
-
forceGetEncryptedAesExchangeKeysForDelegate(delegateHcPartyId) {
|
|
57
|
-
return Promise.all([
|
|
58
|
-
this.patientBaseApi.getPatientAesExchangeKeysForDelegate(delegateHcPartyId).catch(() => { }),
|
|
59
|
-
this.hcpartyBaseApi.getAesExchangeKeysForDelegate(delegateHcPartyId).catch(() => { }),
|
|
60
|
-
this.deviceBaseApi.getDeviceAesExchangeKeysForDelegate(delegateHcPartyId).catch(() => { }),
|
|
61
|
-
]).then(([a, b, c]) => (Object.assign(Object.assign(Object.assign({}, a), b), c)));
|
|
62
|
-
}
|
|
63
22
|
constructor(host, headers, hcpartyBaseApi, //Init with a hcparty x api for better performances
|
|
64
23
|
patientBaseApi, deviceBaseApi, crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : {}, storage, keyStorage) {
|
|
65
24
|
this.hcPartyKeysCache = {};
|
|
@@ -101,6 +60,47 @@ class IccCryptoXApi {
|
|
|
101
60
|
this._storage = storage;
|
|
102
61
|
this._keyStorage = keyStorage;
|
|
103
62
|
}
|
|
63
|
+
get crypto() {
|
|
64
|
+
return this._crypto;
|
|
65
|
+
}
|
|
66
|
+
get shamir() {
|
|
67
|
+
return this._shamir;
|
|
68
|
+
}
|
|
69
|
+
get RSA() {
|
|
70
|
+
return this._RSA;
|
|
71
|
+
}
|
|
72
|
+
get AES() {
|
|
73
|
+
return this._AES;
|
|
74
|
+
}
|
|
75
|
+
get keyStorage() {
|
|
76
|
+
return this._keyStorage;
|
|
77
|
+
}
|
|
78
|
+
get storage() {
|
|
79
|
+
return this._storage;
|
|
80
|
+
}
|
|
81
|
+
emptyHcpCache(hcpartyId) {
|
|
82
|
+
delete this.hcPartyKeysRequestsCache[hcpartyId];
|
|
83
|
+
delete this.dataOwnerCache[hcpartyId];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @internal may be changed without notice
|
|
87
|
+
* Gets all delegate encrypted HcParty keys of the delegate with the given `delegateHcPartyId`, and for each key the delegator id
|
|
88
|
+
* If the keys are not cached, they are retrieved from the backend.
|
|
89
|
+
*
|
|
90
|
+
* @param delegateHcPartyId The Health Care Party id
|
|
91
|
+
* @returns \{delegatorId: delegateEncryptedHcPartyKey\}
|
|
92
|
+
*/
|
|
93
|
+
getEncryptedAesExchangeKeysForDelegate(delegateHcPartyId) {
|
|
94
|
+
return (this.hcPartyKeysRequestsCache[delegateHcPartyId] ||
|
|
95
|
+
(this.hcPartyKeysRequestsCache[delegateHcPartyId] = this.forceGetEncryptedAesExchangeKeysForDelegate(delegateHcPartyId)));
|
|
96
|
+
}
|
|
97
|
+
forceGetEncryptedAesExchangeKeysForDelegate(delegateHcPartyId) {
|
|
98
|
+
return Promise.all([
|
|
99
|
+
this.patientBaseApi.getPatientAesExchangeKeysForDelegate(delegateHcPartyId).catch(() => { }),
|
|
100
|
+
this.hcpartyBaseApi.getAesExchangeKeysForDelegate(delegateHcPartyId).catch(() => { }),
|
|
101
|
+
this.deviceBaseApi.getDeviceAesExchangeKeysForDelegate(delegateHcPartyId).catch(() => { }),
|
|
102
|
+
]).then(([a, b, c]) => (Object.assign(Object.assign(Object.assign({}, a), b), c)));
|
|
103
|
+
}
|
|
104
104
|
loadAllKeysFromLocalStorage(dataOwnerId) {
|
|
105
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
106
|
const pubKeys = yield this.getDataOwnerHexPublicKeys((yield this.getDataOwner(dataOwnerId)).dataOwner);
|