oro-sdk 2.19.3 → 2.20.0

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.19.3",
2
+ "version": "2.20.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
package/src/client.ts CHANGED
@@ -81,7 +81,7 @@ export class OroClient {
81
81
  public workflowClient: WorkflowService,
82
82
  public diagnosisClient: DiagnosisService,
83
83
  private authenticationCallback?: (err: Error) => void
84
- ) {}
84
+ ) { }
85
85
 
86
86
  /**
87
87
  * clears the vaultIndex and cached metadata grants
@@ -389,18 +389,18 @@ export class OroClient {
389
389
  }))
390
390
  .map(
391
391
  (e: IndexConsultLockbox) =>
392
- ({
393
- uuid: e.uuid,
394
- timestamp: e.timestamp,
395
- uniqueHash: e.uniqueHash,
396
- encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
397
- {
398
- consultationId: e.consultationId,
399
- grant: e.grant,
400
- },
401
- rsaPub
402
- ),
403
- } as EncryptedIndexEntry)
392
+ ({
393
+ uuid: e.uuid,
394
+ timestamp: e.timestamp,
395
+ uniqueHash: e.uniqueHash,
396
+ encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
397
+ {
398
+ consultationId: e.consultationId,
399
+ grant: e.grant,
400
+ },
401
+ rsaPub
402
+ ),
403
+ } as EncryptedIndexEntry)
404
404
  )
405
405
  break
406
406
  //// DEPRECATED : REMOVE ME : BEGIN ///////////////////////////////////////////
@@ -422,18 +422,18 @@ export class OroClient {
422
422
  )
423
423
  .map(
424
424
  (e: IndexConsultLockbox) =>
425
- ({
426
- uuid: e.uuid,
427
- timestamp: e.timestamp,
428
- uniqueHash: e.uniqueHash,
429
- encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
430
- {
431
- consultationId: e.consultationId,
432
- grant: e.grant,
433
- },
434
- rsaPub
435
- ),
436
- } as EncryptedIndexEntry)
425
+ ({
426
+ uuid: e.uuid,
427
+ timestamp: e.timestamp,
428
+ uniqueHash: e.uniqueHash,
429
+ encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
430
+ {
431
+ consultationId: e.consultationId,
432
+ grant: e.grant,
433
+ },
434
+ rsaPub
435
+ ),
436
+ } as EncryptedIndexEntry)
437
437
  )
438
438
  break
439
439
  //// DEPRECATED : REMOVE ME : END ///////////////////////////////////////////
@@ -781,14 +781,16 @@ export class OroClient {
781
781
  // Note: if filters is set to empty, it will be stored in the `undefined` key
782
782
  if (!forceRefresh && this.cachedMetadataGrants[filterString]) return this.cachedMetadataGrants[filterString]
783
783
 
784
- // retrieves the consult lockbox from the vault directly if it exists
784
+ // if there is a filter to apply, then the grant can be retrieved from the vault index, otherwise, all grants are fetched
785
785
  // Note: will work only if the filter being applied is exclusively a consult id
786
- const grantsByConsultLockbox = (
787
- await this.vaultClient.vaultIndexGet(
788
- [IndexKey.ConsultationLockbox],
789
- filter ? [filter.consultationId] : undefined
790
- )
791
- )[IndexKey.ConsultationLockbox]
786
+ const grantsByConsultLockbox = filter ? (
787
+ await this.vaultClient.vaultIndexGet([IndexKey.ConsultationLockbox], [filter.consultationId])
788
+ .then((res) => res[IndexKey.ConsultationLockbox])
789
+ .catch((e) => {
790
+ console.error(e)
791
+ return []
792
+ })
793
+ ) : undefined
792
794
  const decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox ?? [], this.rsa)
793
795
  if (decryptedConsults.length > 0) {
794
796
  console.info('[sdk:index] Grants found in user`s constant time secure index')