@icure/api 4.2.31 → 5.0.3
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/IccDeviceApi.d.ts +3 -3
- package/icc-api/api/IccDeviceApi.js.map +1 -1
- package/icc-api/api/IccHcpartyApi.d.ts +3 -3
- package/icc-api/api/IccHcpartyApi.js.map +1 -1
- package/icc-api/api/IccPatientApi.d.ts +3 -3
- package/icc-api/api/IccPatientApi.js.map +1 -1
- package/icc-api/api/IccUserApi.js +1 -1
- package/icc-api/api/IccUserApi.js.map +1 -1
- package/icc-api/api/XHR.js +2 -1
- package/icc-api/api/XHR.js.map +1 -1
- package/icc-api/iccApi.js +5 -1
- package/icc-api/iccApi.js.map +1 -1
- package/icc-api/index.js +5 -1
- package/icc-api/index.js.map +1 -1
- package/icc-api/model/Body.js +1 -1
- package/icc-api/model/Body.js.map +1 -1
- package/icc-api/model/Body1.js +1 -1
- package/icc-api/model/Body1.js.map +1 -1
- package/icc-api/model/Body2.js +1 -1
- package/icc-api/model/Body2.js.map +1 -1
- package/icc-api/model/Body3.js +1 -1
- package/icc-api/model/Body3.js.map +1 -1
- package/icc-api/model/ByteArray.js +1 -1
- package/icc-api/model/ByteArray.js.map +1 -1
- package/icc-api/model/Content.js +1 -1
- package/icc-api/model/Content.js.map +1 -1
- package/icc-api/model/Device.js +1 -1
- package/icc-api/model/Device.js.map +1 -1
- package/icc-api/model/Document.js +1 -1
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/DocumentTemplate.js +1 -1
- package/icc-api/model/DocumentTemplate.js.map +1 -1
- package/icc-api/model/HealthcareParty.js +1 -1
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/MimeAttachment.js +1 -1
- package/icc-api/model/MimeAttachment.js.map +1 -1
- package/icc-api/model/Patient.js +1 -1
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/models.d.ts +15 -0
- package/icc-api/model/models.js +5 -1
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/crypto/AES.d.ts +2 -1
- package/icc-x-api/crypto/AES.js +37 -10
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/crypto/RSA.d.ts +0 -31
- package/icc-x-api/crypto/RSA.js +0 -64
- package/icc-x-api/crypto/RSA.js.map +1 -1
- package/icc-x-api/crypto/shamir.js.map +1 -1
- package/icc-x-api/filters/filters.js +7 -3
- package/icc-x-api/filters/filters.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.js +25 -22
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-bekmehr-x-api.js +2 -2
- package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +2 -2
- package/icc-x-api/icc-calendar-item-x-api.js +43 -30
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.js +59 -45
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +127 -54
- package/icc-x-api/icc-crypto-x-api.js +830 -393
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-doctemplate-x-api.js +2 -2
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.js +3 -3
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +3 -3
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.js +4 -4
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +1 -1
- package/icc-x-api/icc-helement-x-api.js +34 -29
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +5 -6
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +1 -1
- package/icc-x-api/icc-patient-x-api.js +65 -53
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +1 -2
- package/icc-x-api/index.js +9 -8
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/utils/binary-utils.js +5 -5
- package/icc-x-api/utils/binary-utils.js.map +1 -1
- package/icc-x-api/utils/crypto-utils.d.ts +61 -0
- package/icc-x-api/utils/crypto-utils.js +245 -0
- package/icc-x-api/utils/crypto-utils.js.map +1 -0
- package/icc-x-api/utils/formatting-util.js +3 -3
- package/icc-x-api/utils/formatting-util.js.map +1 -1
- package/icc-x-api/utils/functional-util.d.ts +1 -0
- package/icc-x-api/utils/functional-util.js +8 -1
- package/icc-x-api/utils/functional-util.js.map +1 -1
- package/icc-x-api/utils/index.d.ts +1 -0
- package/icc-x-api/utils/index.js +6 -1
- package/icc-x-api/utils/index.js.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/node-compat.d.ts +1 -1
- package/node-compat.js +3 -3
- package/node-compat.js.map +1 -1
- package/package.json +2 -2
- package/icc-x-api/crypto/utils.d.ts +0 -68
- package/icc-x-api/crypto/utils.js +0 -239
- package/icc-x-api/crypto/utils.js.map +0 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { IccHcpartyApi, IccPatientApi } from '../icc-api';
|
|
1
|
+
import { IccDeviceApi, IccHcpartyApi, IccPatientApi } from '../icc-api';
|
|
2
2
|
import { AESUtils } from './crypto/AES';
|
|
3
3
|
import { RSAUtils } from './crypto/RSA';
|
|
4
|
-
import { UtilsClass } from './crypto/utils';
|
|
5
4
|
import { ShamirClass } from './crypto/shamir';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { IccDeviceApi } from '../icc-api';
|
|
5
|
+
import { Delegation, Device, Document, EncryptedEntity, EncryptedParentEntity, HealthcareParty, Patient, User } from '../icc-api/model/models';
|
|
6
|
+
import { IccMaintenanceTaskXApi } from './icc-maintenance-task-x-api';
|
|
9
7
|
interface DelegatorAndKeys {
|
|
10
8
|
delegatorId: string;
|
|
11
9
|
key: CryptoKey;
|
|
@@ -24,7 +22,6 @@ declare type CachedDataOwner = {
|
|
|
24
22
|
export declare class IccCryptoXApi {
|
|
25
23
|
get crypto(): Crypto;
|
|
26
24
|
get shamir(): ShamirClass;
|
|
27
|
-
get utils(): UtilsClass;
|
|
28
25
|
get RSA(): RSAUtils;
|
|
29
26
|
get AES(): AESUtils;
|
|
30
27
|
hcPartyKeysCache: {
|
|
@@ -32,7 +29,11 @@ export declare class IccCryptoXApi {
|
|
|
32
29
|
};
|
|
33
30
|
hcPartyKeysRequestsCache: {
|
|
34
31
|
[delegateId: string]: Promise<{
|
|
35
|
-
[
|
|
32
|
+
[key: string]: {
|
|
33
|
+
[key: string]: {
|
|
34
|
+
[key: string]: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
36
37
|
}>;
|
|
37
38
|
};
|
|
38
39
|
cacheLastDeletionTimestamp: number | undefined;
|
|
@@ -47,61 +48,69 @@ export declare class IccCryptoXApi {
|
|
|
47
48
|
* @param delegateHcPartyId The Health Care Party id
|
|
48
49
|
* @returns \{delegatorId: delegateEncryptedHcPartyKey\}
|
|
49
50
|
*/
|
|
50
|
-
private
|
|
51
|
-
private
|
|
51
|
+
private getEncryptedAesExchangeKeysForDelegate;
|
|
52
|
+
private forceGetEncryptedAesExchangeKeysForDelegate;
|
|
52
53
|
keychainLocalStoreIdPrefix: string;
|
|
53
54
|
keychainValidityDateLocalStoreIdPrefix: string;
|
|
54
55
|
hcpPreferenceKeyEhealthCert: string;
|
|
55
56
|
hcpPreferenceKeyEhealthCertDate: string;
|
|
57
|
+
rsaLocalStoreIdPrefix: string;
|
|
56
58
|
private hcpartyBaseApi;
|
|
57
59
|
private patientBaseApi;
|
|
58
60
|
private deviceBaseApi;
|
|
59
|
-
private _crypto;
|
|
61
|
+
private readonly _crypto;
|
|
60
62
|
private generateKeyConcurrencyMap;
|
|
61
|
-
private
|
|
62
|
-
private
|
|
63
|
-
private
|
|
64
|
-
private _shamir;
|
|
63
|
+
private rsaKeyPairs;
|
|
64
|
+
private readonly _AES;
|
|
65
|
+
private readonly _RSA;
|
|
66
|
+
private readonly _shamir;
|
|
65
67
|
constructor(host: string, headers: {
|
|
66
68
|
[key: string]: string;
|
|
67
69
|
}, hcpartyBaseApi: IccHcpartyApi, //Init with a hcparty x api for better performances
|
|
68
70
|
patientBaseApi: IccPatientApi, deviceBaseApi: IccDeviceApi, crypto?: Crypto);
|
|
69
71
|
randomUuid(): string;
|
|
70
72
|
sha256(data: ArrayBuffer | Uint8Array): Promise<ArrayBuffer>;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
private getPublicKeys;
|
|
74
|
+
encryptShamirRSAKey(hcp: HealthcareParty, notaries: Array<HealthcareParty>, threshold?: number): Promise<HealthcareParty>;
|
|
75
|
+
decryptShamirRSAKey(hcp: HealthcareParty, notaries: Array<HealthcareParty>): Promise<void>;
|
|
73
76
|
/**
|
|
74
77
|
* Gets the decryptedHcPartyKey for the given `encryptedHcPartyKey`
|
|
75
78
|
*
|
|
76
79
|
* If the decrypted key exists in the cache, retrieves it from there.
|
|
77
80
|
* Otherwise, decrypts it using the RSA key of the delegator or delegate (depending on the value of `encryptedForDelegator`)
|
|
78
|
-
*
|
|
79
|
-
* @param
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
81
|
+
*
|
|
82
|
+
* @param loggedHcPartyId The logged DataOwner id or the id of his parent
|
|
83
|
+
* @param delegatorId The id of Delegator eg, the DataOwner where this AES exchange key is stored
|
|
84
|
+
* @param delegateHcPartyId The id of the delegate : the data owner for whom this aes exchange key has been created
|
|
85
|
+
* @param publicKey The public key of the delegator : A unique aes exchange key is created for each public key of the delegator. This is the public key corresponding to the encryptedHcPartyKeys
|
|
86
|
+
* @param encryptedHcPartyKeys The encryptedHcPartyKeys to be decrypted
|
|
87
|
+
* @param publicKeys The public keys for which we might have a private key
|
|
88
|
+
*
|
|
82
89
|
* @returns - **delegatorId** the input param `delegatorId`
|
|
83
90
|
* - **key** the decrypted `encryptedHcPartyKey`
|
|
84
91
|
*/
|
|
85
|
-
decryptHcPartyKey(delegatorId: string, delegateHcPartyId: string,
|
|
92
|
+
decryptHcPartyKey(loggedHcPartyId: string, delegatorId: string, delegateHcPartyId: string, publicKey: string, encryptedHcPartyKeys: {
|
|
93
|
+
[key: string]: string;
|
|
94
|
+
}, publicKeys: string[]): Promise<DelegatorAndKeys>;
|
|
86
95
|
/**
|
|
87
96
|
* Cache the RSA private/public key pair for the HcP with the given id `hcPartyKeyOwner`
|
|
88
97
|
*/
|
|
89
98
|
cacheKeyPair(keyPairInJwk: {
|
|
90
|
-
publicKey: JsonWebKey
|
|
91
|
-
privateKey: JsonWebKey
|
|
92
|
-
}
|
|
99
|
+
publicKey: JsonWebKey;
|
|
100
|
+
privateKey: JsonWebKey;
|
|
101
|
+
}): Promise<{
|
|
93
102
|
publicKey: CryptoKey;
|
|
94
103
|
privateKey: CryptoKey;
|
|
95
104
|
}>;
|
|
96
105
|
/**
|
|
97
|
-
* Gets the secret ID (SFKs) that should be used in the prescribed context (
|
|
98
|
-
* @param parent :
|
|
99
|
-
* @param hcpartyId :
|
|
100
|
-
* @param confidential :
|
|
106
|
+
* Gets the secret ID (SFKs) that should be used in the prescribed context (confidential or not) from decrypted SPKs of the given `parent`, decrypted by the HcP with the given `hcpartyId` AND by its HcP parents
|
|
107
|
+
* @param parent :the object of which delegations (SPKs) to decrypt
|
|
108
|
+
* @param hcpartyId :the id of the delegate HcP
|
|
109
|
+
* @param confidential :weather the key is going to be used for a confidential piece or data or not
|
|
101
110
|
* @returns - **extractedKeys** array containing secret IDs (SFKs) from decrypted SPKs, from both given HcP and its parents ; can contain duplicates
|
|
102
111
|
* - **hcpartyId** the given `hcpartyId` OR, if a parent exist, the HcP id of the top parent in the hierarchy (even if that parent has no delegations)
|
|
103
112
|
*/
|
|
104
|
-
extractPreferredSfk(parent:
|
|
113
|
+
extractPreferredSfk(parent: EncryptedParentEntity, hcpartyId: string, confidential: boolean): Promise<string | undefined>;
|
|
105
114
|
/**
|
|
106
115
|
* Gets an array of decrypted HcPartyKeys, shared between the delegate with ID `delegateHcPartyId` and the delegators in `delegatorsHcPartyIdsSet`
|
|
107
116
|
*
|
|
@@ -126,25 +135,27 @@ export declare class IccCryptoXApi {
|
|
|
126
135
|
* 3. Decrypt's delegators' keys and returns them.
|
|
127
136
|
*
|
|
128
137
|
* @param dataOwnerId : the id of the delegate HCP
|
|
129
|
-
* @param delegations :
|
|
138
|
+
* @param delegations : delegations (can be SPKs, CFKs, EKs) for all delegates
|
|
130
139
|
* @param fallbackOnParent default true; use parent's healthCarePartyId in case there's no delegation for the `healthcarePartyId`
|
|
131
140
|
* @returns - **delegatorId** : the id of the delegator HcP that shares the **key** with the `healthcarePartyId`
|
|
132
141
|
* - **key** the decrypted HcPartyKey, shared between **delegatorId** and `healthcarePartyId`
|
|
133
142
|
*/
|
|
134
|
-
|
|
135
|
-
[key: string]: Array<
|
|
143
|
+
getDecryptedAesExchangeKeysOfDelegateAndParentsFromGenericDelegations(dataOwnerId: string, delegations: {
|
|
144
|
+
[key: string]: Array<Delegation>;
|
|
136
145
|
}, fallbackOnParent?: boolean): Promise<Array<DelegatorAndKeys>>;
|
|
137
146
|
/**
|
|
138
|
-
*
|
|
147
|
+
* Retrieve the owner HealthCareParty key and use it to encrypt
|
|
139
148
|
* both the delegations (createdObject.id) and the cryptedForeignKeys
|
|
140
149
|
* (parentObject.id), and returns them in an object.
|
|
141
150
|
*/
|
|
142
151
|
initObjectDelegations(createdObject: any, parentObject: any, ownerId: string, secretForeignKeyOfParent: string | null): Promise<{
|
|
152
|
+
owner: HealthcareParty | Device | Patient;
|
|
143
153
|
delegations: any;
|
|
144
154
|
cryptedForeignKeys: any;
|
|
145
155
|
secretForeignKeys: any[];
|
|
146
156
|
secretId: string;
|
|
147
157
|
}>;
|
|
158
|
+
private decryptAnyAesExchangeKeyForOwner;
|
|
148
159
|
/**
|
|
149
160
|
* Gets updated instances of SPKs and CKFs for the child object `modifiedObject`.
|
|
150
161
|
* These updated SPKs and CKFs contain new SPKs/CFKs to provide delegation from delegator HcP with id `ownerId` to delegate HcP with id `delegateId`
|
|
@@ -167,16 +178,29 @@ export declare class IccCryptoXApi {
|
|
|
167
178
|
* - **cryptedForeignKeys** existing CFKs of the `modifiedObject`, appended with results from steps 6
|
|
168
179
|
* - **secretId** which is the given input parameter `secretIdOfModifiedObject`
|
|
169
180
|
*/
|
|
170
|
-
extendedDelegationsAndCryptedForeignKeys(modifiedObject:
|
|
181
|
+
extendedDelegationsAndCryptedForeignKeys<T extends EncryptedEntity, P extends EncryptedParentEntity>(modifiedObject: T, parentObject: P | null, ownerId: string, delegateId: string, secretIdOfModifiedObject: string | null): Promise<{
|
|
182
|
+
modifiedObject: T;
|
|
171
183
|
delegations: {
|
|
172
|
-
[key: string]: Array<
|
|
184
|
+
[key: string]: Array<Delegation>;
|
|
173
185
|
};
|
|
174
186
|
cryptedForeignKeys: {
|
|
175
|
-
[key: string]: Array<
|
|
187
|
+
[key: string]: Array<Delegation>;
|
|
176
188
|
};
|
|
177
189
|
secretId: string | null;
|
|
178
190
|
}>;
|
|
179
|
-
|
|
191
|
+
getEncryptedAesExchangeKeys(owner: HealthcareParty | Patient | Device, delegateId: string): Promise<{
|
|
192
|
+
[pubKeyIdentifier: string]: {
|
|
193
|
+
[pubKeyFingerprint: string]: string;
|
|
194
|
+
};
|
|
195
|
+
}>;
|
|
196
|
+
getOrCreateHcPartyKeys(owner: HealthcareParty | Patient | Device, delegateId: string): Promise<{
|
|
197
|
+
owner: HealthcareParty | Patient | Device;
|
|
198
|
+
aesExchangeKeys: {
|
|
199
|
+
[pubKeyIdentifier: string]: {
|
|
200
|
+
[pubKeyFingerprint: string]: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
}>;
|
|
180
204
|
/**
|
|
181
205
|
* Retrieve the owners HealthCareParty key, decrypt it, and
|
|
182
206
|
* use it to encrypt & initialize the "encryptionKeys" object
|
|
@@ -200,7 +224,7 @@ export declare class IccCryptoXApi {
|
|
|
200
224
|
*/
|
|
201
225
|
appendEncryptionKeys(modifiedObject: any, ownerId: string, delegateId: string, secretEncryptionKeyOfObject: string): Promise<{
|
|
202
226
|
encryptionKeys: {
|
|
203
|
-
[key: string]: Array<
|
|
227
|
+
[key: string]: Array<Delegation>;
|
|
204
228
|
};
|
|
205
229
|
secretId: string | null;
|
|
206
230
|
}>;
|
|
@@ -216,7 +240,7 @@ export declare class IccCryptoXApi {
|
|
|
216
240
|
* @param secretEncryptionKey the secret Id used in the child object to generate the EK (Content Encryption Key)
|
|
217
241
|
* @returns - an updated `child` object that will contain updated SPKs, CFKs, EKs
|
|
218
242
|
* */
|
|
219
|
-
addDelegationsAndEncryptionKeys<T extends
|
|
243
|
+
addDelegationsAndEncryptionKeys<T extends EncryptedEntity>(parent: EncryptedParentEntity | null, child: T, ownerId: string, delegateId: string, secretDelegationKey: string | null, secretEncryptionKey: string | null): Promise<T>;
|
|
220
244
|
/**
|
|
221
245
|
* Gets the secret IDs (SFKs) inside decrypted SPKs of the given `document`, decrypted by the HcP with the given `hcpartyId` AND by its HcP parents
|
|
222
246
|
* @param document : the object of which delegations (SPKs) to decrypt
|
|
@@ -224,7 +248,7 @@ export declare class IccCryptoXApi {
|
|
|
224
248
|
* @returns - **extractedKeys** array containing secret IDs (SFKs) from decrypted SPKs, from both given HcP and its parents ; can contain duplicates
|
|
225
249
|
* - **hcpartyId** the given `hcpartyId` OR, if a parent exist, the HcP id of the top parent in the hierarchy (even if that parent has no delegations)
|
|
226
250
|
*/
|
|
227
|
-
extractDelegationsSFKs(document:
|
|
251
|
+
extractDelegationsSFKs(document: EncryptedEntity | null, hcpartyId?: string): Promise<{
|
|
228
252
|
extractedKeys: Array<string>;
|
|
229
253
|
hcpartyId?: string;
|
|
230
254
|
}>;
|
|
@@ -235,19 +259,19 @@ export declare class IccCryptoXApi {
|
|
|
235
259
|
* @returns - **extractedKeys** array containing secret IDs (SFKs) from decrypted SPKs, from both given HcP and its parents ; can contain duplicates
|
|
236
260
|
* - **hcpartyId** the given `hcpartyId` OR, if a parent exist, the HcP id of the top parent in the hierarchy (even if that parent has no delegations)
|
|
237
261
|
*/
|
|
238
|
-
extractSFKsHierarchyFromDelegations(document:
|
|
262
|
+
extractSFKsHierarchyFromDelegations(document: EncryptedEntity | null, hcpartyId?: string): Promise<Array<{
|
|
239
263
|
hcpartyId: string;
|
|
240
264
|
extractedKeys: Array<string>;
|
|
241
265
|
}>>;
|
|
242
|
-
extractCryptedFKs(document:
|
|
266
|
+
extractCryptedFKs(document: EncryptedEntity | null, hcpartyId: string): Promise<{
|
|
243
267
|
extractedKeys: Array<string>;
|
|
244
268
|
hcpartyId: string;
|
|
245
269
|
}>;
|
|
246
|
-
extractEncryptionsSKs(document:
|
|
270
|
+
extractEncryptionsSKs(document: EncryptedEntity, hcpartyId: string): Promise<{
|
|
247
271
|
extractedKeys: Array<string>;
|
|
248
272
|
hcpartyId: string;
|
|
249
273
|
}>;
|
|
250
|
-
extractDelegationsSFKsAndEncryptionSKs(ety:
|
|
274
|
+
extractDelegationsSFKsAndEncryptionSKs(ety: EncryptedEntity, ownerId: string): Promise<[string[], string[]]>;
|
|
251
275
|
/**
|
|
252
276
|
* Get decrypted generic secret IDs (secretIdSPKs, parentIds, secretIdEKs) from generic delegations (SPKs, CFKs, EKs)
|
|
253
277
|
* 1. Get HealthCareParty from it's Id.
|
|
@@ -261,7 +285,7 @@ export declare class IccCryptoXApi {
|
|
|
261
285
|
* - **hcpartyId** the given `hcpartyId` OR, if a parent exist, the HCP id of the top parent in the hierarchy (even if that parent has no delegations)
|
|
262
286
|
*/
|
|
263
287
|
extractKeysHierarchyFromDelegationLikes(hcpartyId: string, objectId: string, delegations: {
|
|
264
|
-
[key: string]: Array<
|
|
288
|
+
[key: string]: Array<Delegation>;
|
|
265
289
|
}): Promise<Array<{
|
|
266
290
|
hcpartyId: string;
|
|
267
291
|
extractedKeys: Array<string>;
|
|
@@ -279,7 +303,7 @@ export declare class IccCryptoXApi {
|
|
|
279
303
|
* - **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)
|
|
280
304
|
*/
|
|
281
305
|
extractKeysFromDelegationsForHcpHierarchy(dataOwnerId: string, objectId: string, delegations: {
|
|
282
|
-
[key: string]: Array<
|
|
306
|
+
[key: string]: Array<Delegation>;
|
|
283
307
|
}): Promise<{
|
|
284
308
|
extractedKeys: Array<string>;
|
|
285
309
|
hcpartyId: string;
|
|
@@ -296,14 +320,15 @@ export declare class IccCryptoXApi {
|
|
|
296
320
|
* - even if there's no match, the secret ID is kept as a valid result (and a message logged to console)
|
|
297
321
|
* @returns array of generic secret IDs (secretIdSPK, parentId, secretIdEK)
|
|
298
322
|
*/
|
|
299
|
-
decryptKeyInDelegationLikes(delegationsArray: Array<
|
|
323
|
+
decryptKeyInDelegationLikes(delegationsArray: Array<Delegation>, aesKeysForDataOwnerId: {
|
|
300
324
|
[key: string]: {
|
|
301
325
|
key: CryptoKey;
|
|
302
326
|
rawKey: string;
|
|
303
|
-
};
|
|
327
|
+
}[];
|
|
304
328
|
}, masterId: string): Promise<Array<string>>;
|
|
329
|
+
getPublicKeyFromPrivateKey(privateKey: JsonWebKey, dataOwner: Patient | Device | HealthcareParty): string;
|
|
305
330
|
loadKeyPairsAsTextInBrowserLocalStorage(healthcarePartyId: string, privateKey: Uint8Array): Promise<void>;
|
|
306
|
-
loadKeyPairsAsJwkInBrowserLocalStorage(healthcarePartyId: string,
|
|
331
|
+
loadKeyPairsAsJwkInBrowserLocalStorage(healthcarePartyId: string, privateKey: JsonWebKey): Promise<void>;
|
|
307
332
|
loadKeyPairsInBrowserLocalStorage(healthcarePartyId: string, file: Blob): Promise<void>;
|
|
308
333
|
saveKeychainInBrowserLocalStorage(id: string, keychain: number): void;
|
|
309
334
|
saveKeychainInBrowserLocalStorageAsBase64(id: string, keyChainB64: string): void;
|
|
@@ -314,7 +339,7 @@ export declare class IccCryptoXApi {
|
|
|
314
339
|
* @param hcpId Id of the hcp to modify
|
|
315
340
|
* @returns modified HCP
|
|
316
341
|
*/
|
|
317
|
-
saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise<
|
|
342
|
+
saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise<HealthcareParty>;
|
|
318
343
|
importKeychainInBrowserFromHCP(hcpId: string): Promise<void>;
|
|
319
344
|
/**
|
|
320
345
|
* Synchronizes the eHealth certificate from the database into the LocalStorage, returning information on the presence
|
|
@@ -331,11 +356,59 @@ export declare class IccCryptoXApi {
|
|
|
331
356
|
getKeychainInBrowserLocalStorageAsBase64(id: string): string | null;
|
|
332
357
|
getKeychainValidityDateInBrowserLocalStorage(id: string): string | null;
|
|
333
358
|
loadKeychainFromBrowserLocalStorage(id: string): Uint8Array[] | null;
|
|
334
|
-
|
|
359
|
+
/**
|
|
360
|
+
*
|
|
361
|
+
* @param id
|
|
362
|
+
* @param keyPair should be JWK
|
|
363
|
+
*/
|
|
364
|
+
storeKeyPair(id: string, keyPair: {
|
|
365
|
+
publicKey: any;
|
|
366
|
+
privateKey: any;
|
|
367
|
+
}): void;
|
|
368
|
+
/**
|
|
369
|
+
* loads the RSA key pair (hcparty) in JWK from local storage, not imported
|
|
370
|
+
*
|
|
371
|
+
* @param id doc id - hcpartyId
|
|
372
|
+
* @param publicKeyFingerPrint the 32 last characters of public key this private key is associated with
|
|
373
|
+
* @returns {Object} it is in JWK - not imported
|
|
374
|
+
*/
|
|
375
|
+
loadKeyPairNotImported(id: string, publicKeyFingerPrint?: string): {
|
|
376
|
+
publicKey: JsonWebKey;
|
|
377
|
+
privateKey: JsonWebKey;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Loads and imports the RSA key pair (hcparty) from local storage
|
|
381
|
+
*
|
|
382
|
+
* @param id doc id - hcPartyId
|
|
383
|
+
* @returns {Promise} -> {CryptoKey} - imported RSA
|
|
384
|
+
*/
|
|
385
|
+
loadKeyPairImported(id: string): Promise<{
|
|
386
|
+
publicKey: CryptoKey;
|
|
387
|
+
privateKey: CryptoKey;
|
|
388
|
+
}>;
|
|
389
|
+
addNewKeyPairForOwnerId(maintenanceTasksApi: IccMaintenanceTaskXApi, user: User, ownerId: string, generateTransferKey?: boolean): Promise<{
|
|
390
|
+
dataOwner: HealthcareParty | Patient | Device;
|
|
391
|
+
publicKey: string;
|
|
392
|
+
privateKey: string;
|
|
393
|
+
}>;
|
|
394
|
+
addNewKeyPairForOwner(maintenanceTasksApi: IccMaintenanceTaskXApi, user: User, cdo: CachedDataOwner, generateTransferKey?: boolean): Promise<{
|
|
395
|
+
dataOwner: HealthcareParty | Patient | Device;
|
|
396
|
+
publicKey: string;
|
|
397
|
+
privateKey: string;
|
|
398
|
+
}>;
|
|
399
|
+
private createOrUpdateAesExchangeKeysFor;
|
|
400
|
+
private createOrUpdateTransferKeysFor;
|
|
401
|
+
private encryptAesKeyFor;
|
|
402
|
+
private retrieveDataOwnerInfoAfterPotentialUpdate;
|
|
403
|
+
private sendMaintenanceTasks;
|
|
404
|
+
private createMaintenanceTask;
|
|
405
|
+
private getDataOwnerHexPublicKeys;
|
|
406
|
+
private getDataOwnerPublicKeys;
|
|
407
|
+
generateKeyForDelegate(ownerId: string, delegateId: string): PromiseLike<HealthcareParty | Patient>;
|
|
335
408
|
getDataOwner(ownerId: string): Promise<CachedDataOwner>;
|
|
336
|
-
checkPrivateKeyValidity(dataOwner:
|
|
409
|
+
checkPrivateKeyValidity(dataOwner: HealthcareParty | Patient | Device): Promise<boolean>;
|
|
337
410
|
private throwDetailedExceptionForInvalidParameter;
|
|
338
|
-
getEncryptionDecryptionKeys(dataOwnerId: string, document:
|
|
339
|
-
encryptDecrypt(method: 'encrypt' | 'decrypt', content: Uint8Array | ArrayBuffer, edKey?: string, user?: User, documentObject?:
|
|
411
|
+
getEncryptionDecryptionKeys(dataOwnerId: string, document: EncryptedEntity): Promise<Array<string> | undefined>;
|
|
412
|
+
encryptDecrypt(method: 'encrypt' | 'decrypt', content: Uint8Array | ArrayBuffer, edKey?: string, user?: User, documentObject?: Document): Promise<Uint8Array | Array<any> | any>;
|
|
340
413
|
}
|
|
341
414
|
export {};
|