@icure/api 4.2.31 → 4.2.32

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.
Files changed (82) hide show
  1. package/icc-api/api/IccAuthApi.js +3 -1
  2. package/icc-api/api/IccAuthApi.js.map +1 -1
  3. package/icc-api/api/XHR.js +1 -1
  4. package/icc-api/api/XHR.js.map +1 -1
  5. package/icc-api/iccApi.js +5 -1
  6. package/icc-api/iccApi.js.map +1 -1
  7. package/icc-api/index.js +5 -1
  8. package/icc-api/index.js.map +1 -1
  9. package/icc-api/model/Body.js +1 -1
  10. package/icc-api/model/Body.js.map +1 -1
  11. package/icc-api/model/Body1.js +1 -1
  12. package/icc-api/model/Body1.js.map +1 -1
  13. package/icc-api/model/Body2.js +1 -1
  14. package/icc-api/model/Body2.js.map +1 -1
  15. package/icc-api/model/Body3.js +1 -1
  16. package/icc-api/model/Body3.js.map +1 -1
  17. package/icc-api/model/ByteArray.js +1 -1
  18. package/icc-api/model/ByteArray.js.map +1 -1
  19. package/icc-api/model/Content.js +1 -1
  20. package/icc-api/model/Content.js.map +1 -1
  21. package/icc-api/model/Device.js +1 -1
  22. package/icc-api/model/Device.js.map +1 -1
  23. package/icc-api/model/Document.js +1 -1
  24. package/icc-api/model/Document.js.map +1 -1
  25. package/icc-api/model/DocumentTemplate.js +1 -1
  26. package/icc-api/model/DocumentTemplate.js.map +1 -1
  27. package/icc-api/model/HealthcareParty.js +1 -1
  28. package/icc-api/model/HealthcareParty.js.map +1 -1
  29. package/icc-api/model/MimeAttachment.js +1 -1
  30. package/icc-api/model/MimeAttachment.js.map +1 -1
  31. package/icc-api/model/Patient.js +1 -1
  32. package/icc-api/model/Patient.js.map +1 -1
  33. package/icc-api/model/models.js +5 -1
  34. package/icc-api/model/models.js.map +1 -1
  35. package/icc-x-api/crypto/AES.js +1 -1
  36. package/icc-x-api/crypto/AES.js.map +1 -1
  37. package/icc-x-api/crypto/RSA.js.map +1 -1
  38. package/icc-x-api/crypto/utils.d.ts +1 -0
  39. package/icc-x-api/crypto/utils.js +43 -27
  40. package/icc-x-api/crypto/utils.js.map +1 -1
  41. package/icc-x-api/filters/filters.js +7 -3
  42. package/icc-x-api/filters/filters.js.map +1 -1
  43. package/icc-x-api/icc-accesslog-x-api.js +4 -4
  44. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  45. package/icc-x-api/icc-bekmehr-x-api.js +2 -2
  46. package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
  47. package/icc-x-api/icc-calendar-item-x-api.js +4 -4
  48. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  49. package/icc-x-api/icc-contact-x-api.js +11 -11
  50. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  51. package/icc-x-api/icc-crypto-x-api.js +46 -46
  52. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  53. package/icc-x-api/icc-doctemplate-x-api.js +2 -2
  54. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  55. package/icc-x-api/icc-document-x-api.js +3 -3
  56. package/icc-x-api/icc-document-x-api.js.map +1 -1
  57. package/icc-x-api/icc-form-x-api.js +3 -3
  58. package/icc-x-api/icc-form-x-api.js.map +1 -1
  59. package/icc-x-api/icc-hcparty-x-api.js +4 -4
  60. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  61. package/icc-x-api/icc-helement-x-api.js +5 -5
  62. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  63. package/icc-x-api/icc-maintenance-task-x-api.js +5 -5
  64. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  65. package/icc-x-api/icc-patient-x-api.d.ts +3 -1
  66. package/icc-x-api/icc-patient-x-api.js +57 -47
  67. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  68. package/icc-x-api/index.d.ts +1 -1
  69. package/icc-x-api/index.js +6 -2
  70. package/icc-x-api/index.js.map +1 -1
  71. package/icc-x-api/utils/binary-utils.js +5 -5
  72. package/icc-x-api/utils/binary-utils.js.map +1 -1
  73. package/icc-x-api/utils/formatting-util.js +3 -3
  74. package/icc-x-api/utils/formatting-util.js.map +1 -1
  75. package/icc-x-api/utils/index.js +5 -1
  76. package/icc-x-api/utils/index.js.map +1 -1
  77. package/index.js +5 -1
  78. package/index.js.map +1 -1
  79. package/node-compat.d.ts +1 -2
  80. package/node-compat.js +3 -4
  81. package/node-compat.js.map +1 -1
  82. package/package.json +1 -1
@@ -89,7 +89,7 @@ class IccCryptoXApi {
89
89
  return this._RSA.loadKeyPairImported(hcp.id).then((keyPair) => this._RSA.exportKey(keyPair.privateKey, 'pkcs8').then((exportedKey) => {
90
90
  const privateKey = exportedKey;
91
91
  const nLen = notaries.length;
92
- const shares = nLen == 1 ? [privateKey] : this._shamir.share(binary_utils_1.ua2hex(privateKey), nLen, threshold || nLen).map((share) => binary_utils_1.hex2ua(share));
92
+ const shares = nLen == 1 ? [privateKey] : this._shamir.share((0, binary_utils_1.ua2hex)(privateKey), nLen, threshold || nLen).map((share) => (0, binary_utils_1.hex2ua)(share));
93
93
  return _.reduce(notaries, (queue, notary, idx) => {
94
94
  return queue.then((hcp) => __awaiter(this, void 0, void 0, function* () {
95
95
  const hcParty = hcp.hcPartyKeys[notary.id] ? hcp : (yield this.generateKeyForDelegate(hcp.id, notary.id));
@@ -97,7 +97,7 @@ class IccCryptoXApi {
97
97
  const importedAESHcPartyKey = yield this.decryptHcPartyKey(hcParty.id, notary.id, hcParty.hcPartyKeys[notary.id][1], false);
98
98
  const encryptedShamirPartition = yield this.AES.encrypt(importedAESHcPartyKey.key, shares[idx]);
99
99
  hcParty.privateKeyShamirPartitions = hcParty.privateKeyShamirPartitions || {};
100
- hcParty.privateKeyShamirPartitions[notary.id] = binary_utils_1.ua2hex(encryptedShamirPartition);
100
+ hcParty.privateKeyShamirPartitions[notary.id] = (0, binary_utils_1.ua2hex)(encryptedShamirPartition);
101
101
  }
102
102
  catch (e) {
103
103
  console.log('Error during encryptedShamirRSAKey', notary.id, e);
@@ -121,7 +121,7 @@ class IccCryptoXApi {
121
121
  if (nLen == 1) {
122
122
  const importedAESHcPartyKey = yield this.decryptHcPartyKey(hcp.id, notaries[0].id, hcp.hcPartyKeys[notaries[0].id][1], false);
123
123
  const cryptedPrivatedKey = hcp.privateKeyShamirPartitions[notaries[0].id];
124
- decryptedPrivatedKey = binary_utils_1.ua2hex(yield this.AES.decrypt(importedAESHcPartyKey.key, binary_utils_1.hex2ua(cryptedPrivatedKey)));
124
+ decryptedPrivatedKey = (0, binary_utils_1.ua2hex)(yield this.AES.decrypt(importedAESHcPartyKey.key, (0, binary_utils_1.hex2ua)(cryptedPrivatedKey)));
125
125
  }
126
126
  else {
127
127
  const decryptedShares = yield _.reduce(notaries, (queue, notary) => {
@@ -132,7 +132,7 @@ class IccCryptoXApi {
132
132
  // give hcp the decrypted shares without having to also share their private keys.
133
133
  const importedAESHcPartyKey = yield this.decryptHcPartyKey(hcp.id, notary.id, hcp.hcPartyKeys[notary.id][1], false);
134
134
  const encryptedShare = hcp.privateKeyShamirPartitions[notary.id];
135
- const decryptedShamirPartition = binary_utils_1.ua2hex(yield this.AES.decrypt(importedAESHcPartyKey.key, binary_utils_1.hex2ua(encryptedShare)));
135
+ const decryptedShamirPartition = (0, binary_utils_1.ua2hex)(yield this.AES.decrypt(importedAESHcPartyKey.key, (0, binary_utils_1.hex2ua)(encryptedShare)));
136
136
  shares.push(decryptedShamirPartition);
137
137
  }
138
138
  catch (e) {
@@ -143,8 +143,8 @@ class IccCryptoXApi {
143
143
  }, Promise.resolve([]));
144
144
  decryptedPrivatedKey = this._shamir.combine(decryptedShares);
145
145
  }
146
- const importedPrivateKey = yield this.RSA.importKey('pkcs8', binary_utils_1.hex2ua(decryptedPrivatedKey), ['decrypt']);
147
- const importedPublicKey = yield this.RSA.importKey('spki', binary_utils_1.hex2ua(hcp.publicKey), ['encrypt']);
146
+ const importedPrivateKey = yield this.RSA.importKey('pkcs8', (0, binary_utils_1.hex2ua)(decryptedPrivatedKey), ['decrypt']);
147
+ const importedPublicKey = yield this.RSA.importKey('spki', (0, binary_utils_1.hex2ua)(hcp.publicKey), ['encrypt']);
148
148
  const exportedKeyPair = yield this.RSA.exportKeys({ publicKey: importedPublicKey, privateKey: importedPrivateKey }, 'jwk', 'jwk');
149
149
  this.RSA.storeKeyPair(hcp.id, exportedKeyPair);
150
150
  }
@@ -178,7 +178,7 @@ class IccCryptoXApi {
178
178
  return (keyPair
179
179
  ? Promise.resolve(keyPair)
180
180
  : Promise.resolve(this._RSA.loadKeyPairNotImported(hcPartyKeyOwner)).then((keyPairInJwk) => this.cacheKeyPair(keyPairInJwk, hcPartyKeyOwner)))
181
- .then((keyPair) => this._RSA.decrypt(keyPair.privateKey, binary_utils_1.hex2ua(encryptedHcPartyKey)))
181
+ .then((keyPair) => this._RSA.decrypt(keyPair.privateKey, (0, binary_utils_1.hex2ua)(encryptedHcPartyKey)))
182
182
  .catch((e) => {
183
183
  console.log(`Cannot decrypt RSA encrypted AES HcPartyKey from ${delegatorId} to ${delegateHcPartyId} as ${encryptedForDelegator ? 'delegator' : 'delegate'}`);
184
184
  throw e;
@@ -190,7 +190,7 @@ class IccCryptoXApi {
190
190
  .then(({ decryptedHcPartyKey, decryptedImportedHcPartyKey }) => (this.hcPartyKeysCache[cacheKey] = {
191
191
  delegatorId: delegatorId,
192
192
  key: decryptedImportedHcPartyKey,
193
- rawKey: binary_utils_1.ua2hex(new Uint8Array(decryptedHcPartyKey)),
193
+ rawKey: (0, binary_utils_1.ua2hex)(new Uint8Array(decryptedHcPartyKey)),
194
194
  }));
195
195
  }
196
196
  }
@@ -314,9 +314,9 @@ class IccCryptoXApi {
314
314
  })
315
315
  .then((encryptedHcPartyKey) => this.decryptHcPartyKey(ownerId, ownerId, encryptedHcPartyKey, true))
316
316
  .then((importedAESHcPartyKey) => Promise.all([
317
- this._AES.encrypt(importedAESHcPartyKey.key, binary_utils_1.string2ua(createdObject.id + ':' + secretId).buffer, importedAESHcPartyKey.rawKey),
317
+ this._AES.encrypt(importedAESHcPartyKey.key, (0, binary_utils_1.string2ua)(createdObject.id + ':' + secretId).buffer, importedAESHcPartyKey.rawKey),
318
318
  parentObject
319
- ? this._AES.encrypt(importedAESHcPartyKey.key, binary_utils_1.string2ua(createdObject.id + ':' + parentObject.id).buffer, importedAESHcPartyKey.rawKey)
319
+ ? this._AES.encrypt(importedAESHcPartyKey.key, (0, binary_utils_1.string2ua)(createdObject.id + ':' + parentObject.id).buffer, importedAESHcPartyKey.rawKey)
320
320
  : Promise.resolve(null),
321
321
  ]))
322
322
  .then((encryptedDelegationAndSecretForeignKey) => ({
@@ -327,7 +327,7 @@ class IccCryptoXApi {
327
327
  {
328
328
  owner: ownerId,
329
329
  delegatedTo: ownerId,
330
- key: binary_utils_1.ua2hex(encryptedDelegationAndSecretForeignKey[0]),
330
+ key: (0, binary_utils_1.ua2hex)(encryptedDelegationAndSecretForeignKey[0]),
331
331
  },
332
332
  ],
333
333
  ],
@@ -340,7 +340,7 @@ class IccCryptoXApi {
340
340
  {
341
341
  owner: ownerId,
342
342
  delegatedTo: ownerId,
343
- key: binary_utils_1.ua2hex(encryptedDelegationAndSecretForeignKey[1]),
343
+ key: (0, binary_utils_1.ua2hex)(encryptedDelegationAndSecretForeignKey[1]),
344
344
  },
345
345
  ],
346
346
  ],
@@ -385,21 +385,21 @@ class IccCryptoXApi {
385
385
  .then((importedAESHcPartyKey) => Promise.all([
386
386
  Promise.all(((modifiedObject.delegations || {})[delegateId] || []).map((d) => (d.key &&
387
387
  d.owner === ownerId &&
388
- this._AES.decrypt(importedAESHcPartyKey.key, binary_utils_1.hex2ua(d.key), importedAESHcPartyKey.rawKey).catch(() => {
388
+ this._AES.decrypt(importedAESHcPartyKey.key, (0, binary_utils_1.hex2ua)(d.key), importedAESHcPartyKey.rawKey).catch(() => {
389
389
  console.log(`Cannot decrypt delegation from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, modifiedObject);
390
390
  return null;
391
391
  })) ||
392
392
  Promise.resolve(null))),
393
393
  Promise.all(((modifiedObject.cryptedForeignKeys || {})[delegateId] || []).map((d) => (d.key &&
394
394
  d.owner === ownerId &&
395
- this._AES.decrypt(importedAESHcPartyKey.key, binary_utils_1.hex2ua(d.key), importedAESHcPartyKey.rawKey).catch(() => {
395
+ this._AES.decrypt(importedAESHcPartyKey.key, (0, binary_utils_1.hex2ua)(d.key), importedAESHcPartyKey.rawKey).catch(() => {
396
396
  console.log(`Cannot decrypt cryptedForeignKeys from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, modifiedObject);
397
397
  return null;
398
398
  })) ||
399
399
  Promise.resolve(null))),
400
- this._AES.encrypt(importedAESHcPartyKey.key, binary_utils_1.string2ua(modifiedObject.id + ':' + secretIdOfModifiedObject).buffer, importedAESHcPartyKey.rawKey),
400
+ this._AES.encrypt(importedAESHcPartyKey.key, (0, binary_utils_1.string2ua)(modifiedObject.id + ':' + secretIdOfModifiedObject).buffer, importedAESHcPartyKey.rawKey),
401
401
  parentObject
402
- ? this._AES.encrypt(importedAESHcPartyKey.key, binary_utils_1.string2ua(modifiedObject.id + ':' + parentObject.id).buffer, importedAESHcPartyKey.rawKey)
402
+ ? this._AES.encrypt(importedAESHcPartyKey.key, (0, binary_utils_1.string2ua)(modifiedObject.id + ':' + parentObject.id).buffer, importedAESHcPartyKey.rawKey)
403
403
  : Promise.resolve(null),
404
404
  ]))
405
405
  .then(([previousDecryptedDelegations, previousDecryptedCryptedForeignKeys, cryptedDelegation, cryptedForeignKey]) => {
@@ -410,7 +410,7 @@ class IccCryptoXApi {
410
410
  // We merge them to get one array of objects: { d: {owner,delegatedTo,encrypted(key)}, k: decrypted(key)}
411
411
  const delegationCryptedDecrypted = _.merge(((modifiedObject.delegations || {})[delegateId] || []).map((d) => ({
412
412
  d,
413
- })), (previousDecryptedDelegations || []).map((dd) => (dd ? binary_utils_1.ua2string(dd) : null)).map((k) => ({ k })))
413
+ })), (previousDecryptedDelegations || []).map((dd) => (dd ? (0, binary_utils_1.ua2string)(dd) : null)).map((k) => ({ k })))
414
414
  .filter(({ d, k }) => !!k || d.owner !== ownerId) //Only keep the ones created by us that can still be decrypted
415
415
  .map(({ d, k }) => ({ d, k: k || this.randomUuid() })) // Use some unique id that ensures the delegation not created by us are going to be held
416
416
  .concat([
@@ -418,7 +418,7 @@ class IccCryptoXApi {
418
418
  d: {
419
419
  owner: ownerId,
420
420
  delegatedTo: delegateId,
421
- key: binary_utils_1.ua2hex(cryptedDelegation),
421
+ key: (0, binary_utils_1.ua2hex)(cryptedDelegation),
422
422
  },
423
423
  k: modifiedObject.id + ':' + secretIdOfModifiedObject,
424
424
  },
@@ -428,7 +428,7 @@ class IccCryptoXApi {
428
428
  allDelegations[delegateId] = _.uniqBy(delegationCryptedDecrypted, (x) => x.k).map((x) => x.d);
429
429
  const cryptedForeignKeysCryptedDecrypted = _.merge(((modifiedObject.cryptedForeignKeys || {})[delegateId] || []).map((d) => ({
430
430
  d,
431
- })), (previousDecryptedCryptedForeignKeys || []).map((dd) => (dd ? binary_utils_1.ua2string(dd) : null)).map((k) => ({ k })))
431
+ })), (previousDecryptedCryptedForeignKeys || []).map((dd) => (dd ? (0, binary_utils_1.ua2string)(dd) : null)).map((k) => ({ k })))
432
432
  .filter(({ d, k }) => !!k || d.owner !== ownerId) //Only keep the ones created by us that can still be decrypted
433
433
  .map(({ d, k }) => ({ d, k: k || this.randomUuid() })) // Use some unique id that ensures the delegation not created by us are going to be held
434
434
  .concat(cryptedForeignKey
@@ -437,7 +437,7 @@ class IccCryptoXApi {
437
437
  d: {
438
438
  owner: ownerId,
439
439
  delegatedTo: delegateId,
440
- key: binary_utils_1.ua2hex(cryptedForeignKey),
440
+ key: (0, binary_utils_1.ua2hex)(cryptedForeignKey),
441
441
  },
442
442
  k: modifiedObject.id + ':' + parentObject.id,
443
443
  },
@@ -472,7 +472,7 @@ class IccCryptoXApi {
472
472
  return this.getDataOwner(ownerId)
473
473
  .then(({ dataOwner: owner }) => this.getOrCreateHcPartyKey(owner, ownerId))
474
474
  .then((encryptedHcPartyKey) => this.decryptHcPartyKey(ownerId, ownerId, encryptedHcPartyKey, true))
475
- .then((importedAESHcPartyKey) => this._AES.encrypt(importedAESHcPartyKey.key, binary_utils_1.string2ua(createdObject.id + ':' + secretId)))
475
+ .then((importedAESHcPartyKey) => this._AES.encrypt(importedAESHcPartyKey.key, (0, binary_utils_1.string2ua)(createdObject.id + ':' + secretId)))
476
476
  .then((encryptedEncryptionKeys) => ({
477
477
  encryptionKeys: _.fromPairs([
478
478
  [
@@ -481,7 +481,7 @@ class IccCryptoXApi {
481
481
  {
482
482
  owner: ownerId,
483
483
  delegatedTo: ownerId,
484
- key: binary_utils_1.ua2hex(encryptedEncryptionKeys),
484
+ key: (0, binary_utils_1.ua2hex)(encryptedEncryptionKeys),
485
485
  },
486
486
  ],
487
487
  ],
@@ -510,12 +510,12 @@ class IccCryptoXApi {
510
510
  .then((importedAESHcPartyKey) => Promise.all([
511
511
  Promise.all(((modifiedObject.encryptionKeys || {})[delegateId] || []).map((d) => (d.key &&
512
512
  d.owner === ownerId &&
513
- this._AES.decrypt(importedAESHcPartyKey.key, binary_utils_1.hex2ua(d.key), importedAESHcPartyKey.rawKey).catch(() => {
513
+ this._AES.decrypt(importedAESHcPartyKey.key, (0, binary_utils_1.hex2ua)(d.key), importedAESHcPartyKey.rawKey).catch(() => {
514
514
  console.log(`Cannot decrypt encryption key from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, modifiedObject);
515
515
  return null;
516
516
  })) ||
517
517
  Promise.resolve(null))),
518
- this._AES.encrypt(importedAESHcPartyKey.key, binary_utils_1.string2ua(modifiedObject.id + ':' + secretEncryptionKeyOfObject)),
518
+ this._AES.encrypt(importedAESHcPartyKey.key, (0, binary_utils_1.string2ua)(modifiedObject.id + ':' + secretEncryptionKeyOfObject)),
519
519
  ]))
520
520
  .then(([previousDecryptedEncryptionKeys, encryptedEncryptionKey]) => {
521
521
  //try to limit the extent of the modifications to the delegations by preserving the redundant encryption keys already present and removing duplicates
@@ -525,7 +525,7 @@ class IccCryptoXApi {
525
525
  // We merge them to get one array of objects: { d: {owner,delegatedTo,encrypted(key)}, k: decrypted(key)}
526
526
  const encryptionKeysCryptedDecrypted = _.merge(((modifiedObject.encryptionKeys || {})[delegateId] || []).map((d) => ({
527
527
  d,
528
- })), (previousDecryptedEncryptionKeys || []).map((dd) => (dd ? binary_utils_1.ua2string(dd) : null)).map((k) => ({ k })))
528
+ })), (previousDecryptedEncryptionKeys || []).map((dd) => (dd ? (0, binary_utils_1.ua2string)(dd) : null)).map((k) => ({ k })))
529
529
  .filter(({ d, k }) => !!k || d.owner !== ownerId) //Only keep the ones created by us that can still be decrypted
530
530
  .map(({ d, k }) => ({ d, k: k || this.randomUuid() }))
531
531
  .concat([
@@ -533,7 +533,7 @@ class IccCryptoXApi {
533
533
  d: {
534
534
  owner: ownerId,
535
535
  delegatedTo: delegateId,
536
- key: binary_utils_1.ua2hex(encryptedEncryptionKey),
536
+ key: (0, binary_utils_1.ua2hex)(encryptedEncryptionKey),
537
537
  },
538
538
  k: modifiedObject.id + ':' + secretEncryptionKeyOfObject,
539
539
  },
@@ -735,9 +735,9 @@ class IccCryptoXApi {
735
735
  const aesKey = aesKeys[genericDelegationItem.owner];
736
736
  if (aesKey) {
737
737
  decryptPromises.push(this._AES
738
- .decrypt(aesKey.key, binary_utils_1.hex2ua(genericDelegationItem.key), aesKey.rawKey)
738
+ .decrypt(aesKey.key, (0, binary_utils_1.hex2ua)(genericDelegationItem.key), aesKey.rawKey)
739
739
  .then((decryptedGenericDelegationKey) => {
740
- const results = binary_utils_1.ua2string(decryptedGenericDelegationKey).split(':');
740
+ const results = (0, binary_utils_1.ua2string)(decryptedGenericDelegationKey).split(':');
741
741
  const objectId = results[0]; //must be the ID of the object, for checksum
742
742
  const genericSecretId = results[1];
743
743
  const details = 'object ID: ' + masterId + '; generic delegation from ' + genericDelegationItem.owner + ' to ' + genericDelegationItem.delegatedTo;
@@ -771,7 +771,7 @@ class IccCryptoXApi {
771
771
  if (!publicKey) {
772
772
  throw new Error('No public key has been defined for hcp');
773
773
  }
774
- return this._RSA.importKeyPair('jwk', this._utils.pkcs8ToJwk(privateKey), 'jwk', this._utils.spkiToJwk(binary_utils_1.hex2ua(publicKey)));
774
+ return this._RSA.importKeyPair('jwk', this._utils.pkcs8ToJwk(privateKey), 'jwk', this._utils.spkiToJwk((0, binary_utils_1.hex2ua)(publicKey)));
775
775
  })
776
776
  .then((keyPair) => {
777
777
  this._RSA.rsaKeyPairs[healthcarePartyId] = keyPair;
@@ -785,7 +785,7 @@ class IccCryptoXApi {
785
785
  loadKeyPairsAsJwkInBrowserLocalStorage(healthcarePartyId, privKey) {
786
786
  return this.getDataOwner(healthcarePartyId)
787
787
  .then(({ dataOwner }) => {
788
- const pubKey = this._utils.spkiToJwk(binary_utils_1.hex2ua(dataOwner.publicKey));
788
+ const pubKey = this._utils.spkiToJwk((0, binary_utils_1.hex2ua)(dataOwner.publicKey));
789
789
  privKey.n = pubKey.n;
790
790
  privKey.e = pubKey.e;
791
791
  return this._RSA.importKeyPair('jwk', privKey, 'jwk', pubKey);
@@ -807,14 +807,14 @@ class IccCryptoXApi {
807
807
  fr.onload = (e) => {
808
808
  //TODO remove any
809
809
  const privateKey = e.target.result;
810
- this.loadKeyPairsAsTextInBrowserLocalStorage(healthcarePartyId, binary_utils_1.hex2ua(privateKey)).then(resolve).catch(reject);
810
+ this.loadKeyPairsAsTextInBrowserLocalStorage(healthcarePartyId, (0, binary_utils_1.hex2ua)(privateKey)).then(resolve).catch(reject);
811
811
  };
812
812
  fr.readAsText(file);
813
813
  });
814
814
  }
815
815
  // noinspection JSUnusedGlobalSymbols
816
816
  saveKeychainInBrowserLocalStorage(id, keychain) {
817
- localStorage.setItem(this.keychainLocalStoreIdPrefix + id, binary_utils_1.b2a(new Uint8Array(keychain).reduce((data, byte) => data + String.fromCharCode(byte), '')));
817
+ localStorage.setItem(this.keychainLocalStoreIdPrefix + id, (0, binary_utils_1.b2a)(new Uint8Array(keychain).reduce((data, byte) => data + String.fromCharCode(byte), '')));
818
818
  }
819
819
  saveKeychainInBrowserLocalStorageAsBase64(id, keyChainB64) {
820
820
  localStorage.setItem(this.keychainLocalStoreIdPrefix + id, keyChainB64);
@@ -854,13 +854,13 @@ class IccCryptoXApi {
854
854
  if (!!aesKey && !!crt) {
855
855
  let crtEncrypted = null;
856
856
  try {
857
- crtEncrypted = yield this.AES.encrypt(aesKey, new Uint8Array(binary_utils_1.string2ua(atob(crt))));
857
+ crtEncrypted = yield this.AES.encrypt(aesKey, new Uint8Array((0, binary_utils_1.string2ua)(atob(crt))));
858
858
  }
859
859
  catch (e) {
860
860
  console.error('Error while encrypting the certificate', e);
861
861
  }
862
862
  // add the encrypted certificate to the options
863
- _.set(opts, this.hcpPreferenceKeyEhealthCert, binary_utils_1.ua2string(new Uint8Array(crtEncrypted)));
863
+ _.set(opts, this.hcpPreferenceKeyEhealthCert, (0, binary_utils_1.ua2string)(new Uint8Array(crtEncrypted)));
864
864
  }
865
865
  const crtValidityDate = this.getKeychainValidityDateInBrowserLocalStorage(hcp.id);
866
866
  if (!!crtValidityDate) {
@@ -875,7 +875,7 @@ class IccCryptoXApi {
875
875
  return this.hcpartyBaseApi.getHealthcareParty(hcpId).then((hcp) => __awaiter(this, void 0, void 0, function* () {
876
876
  let crtCryp = null;
877
877
  if (!!hcp.options && !!hcp.options[this.hcpPreferenceKeyEhealthCert]) {
878
- crtCryp = binary_utils_1.string2ua(hcp.options[this.hcpPreferenceKeyEhealthCert]);
878
+ crtCryp = (0, binary_utils_1.string2ua)(hcp.options[this.hcpPreferenceKeyEhealthCert]);
879
879
  }
880
880
  const crtValidityDate = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertDate);
881
881
  // store the validity date
@@ -941,7 +941,7 @@ class IccCryptoXApi {
941
941
  // noinspection JSUnusedGlobalSymbols
942
942
  loadKeychainFromBrowserLocalStorage(id) {
943
943
  const lsItem = localStorage.getItem('org.taktik.icure.ehealth.keychain.' + id);
944
- return lsItem !== null ? binary_utils_1.b64_2uas(lsItem) : null;
944
+ return lsItem !== null ? (0, binary_utils_1.b64_2uas)(lsItem) : null;
945
945
  }
946
946
  generateKeyForDelegate(ownerId, delegateId) {
947
947
  //Preload hcp and patient because we need them and they are going to be invalidated from the caches
@@ -954,17 +954,17 @@ class IccCryptoXApi {
954
954
  ? this._AES
955
955
  .generateCryptoKey(true)
956
956
  .then((AESKey) => {
957
- const ownerPubKey = this._utils.spkiToJwk(binary_utils_1.hex2ua(owner.publicKey));
958
- const delegatePubKey = this._utils.spkiToJwk(binary_utils_1.hex2ua(delegate.publicKey));
957
+ const ownerPubKey = this._utils.spkiToJwk((0, binary_utils_1.hex2ua)(owner.publicKey));
958
+ const delegatePubKey = this._utils.spkiToJwk((0, binary_utils_1.hex2ua)(delegate.publicKey));
959
959
  return Promise.all([
960
960
  this._RSA.importKey('jwk', ownerPubKey, ['encrypt']),
961
961
  this._RSA.importKey('jwk', delegatePubKey, ['encrypt']),
962
962
  ]).then(([ownerImportedKey, delegateImportedKey]) => Promise.all([
963
- this._RSA.encrypt(ownerImportedKey, binary_utils_1.hex2ua(AESKey)),
964
- this._RSA.encrypt(delegateImportedKey, binary_utils_1.hex2ua(AESKey)),
963
+ this._RSA.encrypt(ownerImportedKey, (0, binary_utils_1.hex2ua)(AESKey)),
964
+ this._RSA.encrypt(delegateImportedKey, (0, binary_utils_1.hex2ua)(AESKey)),
965
965
  ]));
966
966
  })
967
- .then(([ownerKey, delegateKey]) => (owner.hcPartyKeys[delegateId] = [binary_utils_1.ua2hex(ownerKey), binary_utils_1.ua2hex(delegateKey)]))
967
+ .then(([ownerKey, delegateKey]) => (owner.hcPartyKeys[delegateId] = [(0, binary_utils_1.ua2hex)(ownerKey), (0, binary_utils_1.ua2hex)(delegateKey)]))
968
968
  .then(() => {
969
969
  return ownerType === 'hcp'
970
970
  ? (this.dataOwnerCache[owner.id] = this.hcpartyBaseApi
@@ -1007,8 +1007,8 @@ class IccCryptoXApi {
1007
1007
  checkPrivateKeyValidity(dataOwner) {
1008
1008
  return new Promise((resolve) => {
1009
1009
  this._RSA
1010
- .importKey('jwk', this._utils.spkiToJwk(binary_utils_1.hex2ua(dataOwner.publicKey)), ['encrypt'])
1011
- .then((k) => this._RSA.encrypt(k, binary_utils_1.utf8_2ua('shibboleth')))
1010
+ .importKey('jwk', this._utils.spkiToJwk((0, binary_utils_1.hex2ua)(dataOwner.publicKey)), ['encrypt'])
1011
+ .then((k) => this._RSA.encrypt(k, (0, binary_utils_1.utf8_2ua)('shibboleth')))
1012
1012
  .then((cipher) => {
1013
1013
  const kp = this._RSA.loadKeyPairNotImported(dataOwner.id);
1014
1014
  return this._RSA
@@ -1016,7 +1016,7 @@ class IccCryptoXApi {
1016
1016
  .then((ikp) => this._RSA.decrypt(ikp.privateKey, new Uint8Array(cipher)));
1017
1017
  })
1018
1018
  .then((plainText) => {
1019
- const pt = binary_utils_1.ua2utf8(plainText);
1019
+ const pt = (0, binary_utils_1.ua2utf8)(plainText);
1020
1020
  console.log(pt);
1021
1021
  resolve(pt === 'shibboleth');
1022
1022
  })
@@ -1050,7 +1050,7 @@ class IccCryptoXApi {
1050
1050
  if (!content || !(edKey || ((user === null || user === void 0 ? void 0 : user.healthcarePartyId) && documentObject)))
1051
1051
  return content;
1052
1052
  if (edKey) {
1053
- const importedEdKey = yield this._AES.importKey('raw', binary_utils_1.hex2ua(edKey.replace(/-/g, '')));
1053
+ const importedEdKey = yield this._AES.importKey('raw', (0, binary_utils_1.hex2ua)(edKey.replace(/-/g, '')));
1054
1054
  try {
1055
1055
  return this._AES[method](importedEdKey, content);
1056
1056
  }
@@ -1059,7 +1059,7 @@ class IccCryptoXApi {
1059
1059
  }
1060
1060
  }
1061
1061
  const sfks = yield this.extractKeysFromDelegationsForHcpHierarchy(user === null || user === void 0 ? void 0 : user.healthcarePartyId, documentObject === null || documentObject === void 0 ? void 0 : documentObject.id, documentObject === null || documentObject === void 0 ? void 0 : documentObject.encryptionKeys);
1062
- const importedEdKey = yield this._AES.importKey('raw', binary_utils_1.hex2ua(sfks.extractedKeys[0].replace(/-/g, '')));
1062
+ const importedEdKey = yield this._AES.importKey('raw', (0, binary_utils_1.hex2ua)(sfks.extractedKeys[0].replace(/-/g, '')));
1063
1063
  try {
1064
1064
  return this._AES[method](importedEdKey, content);
1065
1065
  }