import { KeyPair } from './RSA';
import { IccDataOwnerXApi } from '../icc-data-owner-x-api';
import { CryptoPrimitives } from './CryptoPrimitives';
import { IccDeviceApi, IccHcpartyApi, IccPatientApi } from '../../icc-api';
import { DataOwnerTypeEnum } from '../../icc-api/model/DataOwnerTypeEnum';
/**
 * @internal This class is meant only for internal use and may be changed without notice.
 * Functions to create and get exchange keys.
 * The methods of this api require to pass the appropriate keys for encryption/decryption manually.
 */
export declare class BaseExchangeKeysManager {
    private readonly generateKeyConcurrencyMap;
    private readonly primitives;
    private readonly dataOwnerApi;
    private readonly hcpartyBaseApi;
    private readonly patientBaseApi;
    private readonly deviceBaseApi;
    constructor(primitives: CryptoPrimitives, dataOwnerApi: IccDataOwnerXApi, hcpartyBaseApi: IccHcpartyApi, patientBaseApi: IccPatientApi, deviceBaseApi: IccDeviceApi);
    /**
     * Updates the aes exchange keys between the current data owner and another data owner to allow the other data owner to access the exchange key
     * using his new public key. Note that this will make existing exchange keys from the other data owner to the current data owner invalid for
     * encryption.
     * @param otherDataOwner the other data owner.
     * @param newDataOwnerPublicKey a new public key of the other data owner.
     * @param keyPairsByFingerprint all available key pairs to use for the decryption of existing aes exchange keys.
     */
    giveAccessBackTo(otherDataOwner: string, newDataOwnerPublicKey: string, keyPairsByFingerprint: {
        [publicKeyFingerprint: string]: KeyPair<CryptoKey>;
    }): Promise<void>;
    /**
     * Get the encrypted exchange keys for a delegator-delegate pair.
     * @param delegatorId id of the delegator data owner.
     * @param delegateId id of the delegate data owner.
     * @return an array of exchange keys from the delegator to delegate where each key is encrypted with one or more public keys.
     */
    getEncryptedExchangeKeysFor(delegatorId: string, delegateId: string): Promise<{
        [publicKeyFingerprint: string]: string;
    }[]>;
    /**
     * Get all exchange keys where the provided data owner is involved either as the delegator or as the delegate.
     * @param dataOwnerId id of a data owner.
     * @param otherOwnerTypes only exchange keys between the current data owner and data owners of this type will be included in the result. If null considers all delegates
     * @return all exchange keys involving the provided data owner. Note that there may be an overlap between some keys to and from the data owner.
     */
    getAllExchangeKeysWith(dataOwnerId: string, otherOwnerTypes: DataOwnerTypeEnum[] | null): Promise<{
        keysToOwner: {
            [delegatorId: string]: {
                [delegatorFp: string]: {
                    [entryFp: string]: string;
                };
            };
        };
        keysFromOwner: {
            [delegatorFp: string]: {
                [delegateId: string]: {
                    [entryFp: string]: string;
                };
            };
        };
    }>;
    /**
     * Attempts to decrypt many exchange keys using any of the provided key pairs.
     * @param encryptedExchangeKeys an array of exchange keys where each key is encrypted with one or more public keys.
     * @param keyPairsByFingerprint rsa key pairs to use for decryption.
     * @return an array all successfully decrypted exchange keys and an array containing all exchange keys which could not be decrypted.
     */
    tryDecryptExchangeKeys(encryptedExchangeKeys: {
        [publicKeyFingerprint: string]: string;
    }[], keyPairsByFingerprint: {
        [publicKeyFingerprint: string]: KeyPair<CryptoKey>;
    }): Promise<{
        successfulDecryptions: CryptoKey[];
        failedDecryptions: {
            [publicKeyFingerprint: string]: string;
        }[];
    }>;
    private extendForGiveAccessBackTo;
    /**
     * Attempts to decrypt an exchange key using any of the provided key pairs.
     * @param encryptedExchangeKey an encrypted exchange key, in the form publicKeyXyzFingerprint -> hex(exchangeKeyEncryptedByPrivateKeyXyz).
     * @param keyPairsByFingerprint rsa key pairs to use for decryption.
     * @return the decrypted exchange key, in raw and key format (to allow deduplication), or undefined if the key could not be decrypted using the
     * provided keys.
     */
    private tryDecryptExchangeKey;
    /**
     * Creates an encrypted exchange key for the provided public keys.
     * @param exchangeKey the exchange key in raw and imported format. If undefined a new key will be automatically created.
     * @param publicKeys additional public keys that will have access to the exchange key in spki format, hex-encoded.
     * @return the exchangeKey and an object with the exchange key encrypted with each of the provided public keys, hex-encoded, by fingerprint.
     */
    private encryptExchangeKey;
    /**
     * Attempts to decrypt an exchange key using the provided key pairs.
     * If you are confident that the provided {@link keyPair} was used to encrypt {@link encryptedByOneKey} you should also provide {@link keyPairFp},
     * so that if the decryption fail an error will be logged to console before returning undefined.
     * @param encryptedByOneKey an exchange key which may be encrypted with {@link keyPair}.
     * @param keyPair an rsa key pair.
     * @param keyPairFp the fingerprint of the provided key pair or undefined to disable logging of error if the decryption failed.
     * @return the decrypted exchange key, in raw and key format (to allow deduplication), or undefined if the key could not be decrypted using the
     * provided key.
     */
    private tryDecryptExchangeKeyWith;
    private combineLegacyHcpKeysWithAesExchangeKeys;
}
