import { iccHcpartyApi } from "../icc-api/iccApi"; import { AESUtils } from "./crypto/AES"; import { RSAUtils } from "./crypto/RSA"; import { UtilsClass } from "./crypto/utils"; import { XHR } from "../icc-api/api/XHR"; import * as models from "../icc-api/model/models"; import { HealthcarePartyDto } from "../icc-api/model/models"; export declare class IccCryptoXApi { hcPartyKeysCache: { [key: string]: { delegatorId: string; key: CryptoKey; }; }; hcPartiesRequestsCache: { [key: string]: Promise; }; hcPartyKeysRequestsCache: { [key: string]: Promise; }; emptyHcpCache(hcpartyId: string): void; private getHealthcareParty; private getHcPartyKeysForDelegate; keychainLocalStoreIdPrefix: String; hcpPreferenceKeyEhealthCert: string; hcpartyBaseApi: iccHcpartyApi; AES: AESUtils; RSA: RSAUtils; utils: UtilsClass; constructor(host: string, headers: Array, hcpartyBaseApi: iccHcpartyApi); randomUuid(): string; decryptHcPartyKey(delegatorId: string, delegateHcPartyId: string, encryptedHcPartyKey: string, encryptedForDelegator?: boolean): Promise<{ delegatorId: string; key: CryptoKey; }>; cacheKeyPair(keyPairInJwk: { publicKey: JsonWebKey | ArrayBuffer; privateKey: JsonWebKey | ArrayBuffer; }, hcPartyKeyOwner: string): Promise<{ publicKey: CryptoKey; privateKey: CryptoKey; }>; decryptAndImportAesHcPartyKeysForDelegators(delegatorsHcPartyIdsSet: Array, delegateHcPartyId: string): Promise>; decryptAndImportAesHcPartyKeysInDelegations(healthcarePartyId: string, delegations: { [key: string]: Array; }, fallbackOnParent?: boolean): Promise>; initObjectDelegations(createdObject: any, parentObject: any, ownerId: string, secretForeignKeyOfParent: string | null): Promise<{ delegations: any; cryptedForeignKeys: any; secretForeignKeys: any[]; secretId: string; }>; extendedDelegationsAndCryptedForeignKeys(modifiedObject: any | null, parentObject: any | null, ownerId: string, delegateId: string, secretIdOfModifiedObject: string | null): Promise<{ delegations: { [key: string]: Array; }; cryptedForeignKeys: { [key: string]: Array; }; secretId: string | null; }>; initEncryptionKeys(createdObject: any, ownerId: string): Promise<{ encryptionKeys: any; secretId: string; }>; appendEncryptionKeys(modifiedObject: any, ownerId: string, delegateId: string, secretIdOfModifiedObject: string): Promise<{ encryptionKeys: { [key: string]: Array; }; secretId: string | null; }>; addDelegationsAndEncryptionKeys(parent: models.PatientDto | models.MessageDto | null, child: models.PatientDto | models.ContactDto | models.InvoiceDto | models.DocumentDto | models.HealthElementDto | models.ReceiptDto, ownerId: string, delegateId: string, secretDelegationKey: string, secretEncryptionKey: string): Promise<(models.ContactDto & { delegations: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); cryptedForeignKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); encryptionKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); }) | (models.DocumentDto & { delegations: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); cryptedForeignKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); encryptionKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); }) | (models.HealthElementDto & { delegations: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); cryptedForeignKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); encryptionKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); }) | (models.PatientDto & { delegations: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); cryptedForeignKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); encryptionKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); }) | (models.InvoiceDto & { delegations: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); cryptedForeignKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); encryptionKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); }) | (models.ReceiptDto & { delegations: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); cryptedForeignKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); encryptionKeys: ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }) | ({ [key: string]: models.DelegationDto[]; } & { [key: string]: models.DelegationDto[]; }); })>; /** * Walk up the hierarchy of hcps and extract matching delegations * @param document * @param hcpartyId */ extractDelegationsSFKs(document: models.PatientDto | models.MessageDto | models.ContactDto | models.DocumentDto | models.InvoiceDto | models.HealthElementDto | models.ReceiptDto | models.ClassificationDto | null, hcpartyId: string): Promise<{ extractedKeys: Array; hcpartyId: string; }>; extractCryptedFKs(document: models.PatientDto | models.MessageDto | models.ContactDto | models.DocumentDto | models.InvoiceDto | models.HealthElementDto | models.ReceiptDto | models.ClassificationDto | null, hcpartyId: string): Promise<{ extractedKeys: Array; hcpartyId: string; }>; extractEncryptionsSKs(document: models.PatientDto | models.MessageDto | models.ContactDto | models.DocumentDto | models.InvoiceDto | models.ReceiptDto | models.HealthElementDto | models.ClassificationDto, hcpartyId: string): Promise<{ extractedKeys: Array; hcpartyId: string; }>; extractKeysFromDelegationsForHcpHierarchy(hcpartyId: string, objectId: string, delegations: { [key: string]: Array; }): Promise<{ extractedKeys: Array; hcpartyId: string; }>; decryptKeyInDelegationLikes(delegationsArray: Array, aesKeys: { [key: string]: CryptoKey; }, masterId: string): Promise>; loadKeyPairsAsTextInBrowserLocalStorage(healthcarePartyId: string, privateKey: Uint8Array): Promise; loadKeyPairsAsJwkInBrowserLocalStorage(healthcarePartyId: string, privKey: JsonWebKey): Promise; loadKeyPairsInBrowserLocalStorage(healthcarePartyId: string, file: Blob): Promise<{}>; saveKeychainInBrowserLocalStorage(id: string, keychain: number): void; saveKeychainInBrowserLocalStorageAsBase64(id: string, keyChainB64: string): void; saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise; importKeychainInBrowserFromHCP(hcpId: string): Promise; /** * Returns true if a key has been set in the localstorage * @param hcp The healthcare party */ syncEhealthCertificate(hcpId: string): Promise; getKeychainInBrowserLocalStorageAsBase64(id: string): string | null; loadKeychainFromBrowserLocalStorage(id: String): Uint8Array[] | null; generateKeyForDelegate(ownerId: string, delegateId: string): Promise; checkPrivateKeyValidity(hcp: models.HealthcarePartyDto): Promise; }