import { IccDataOwnerXApi } from '../icc-data-owner-x-api';
import { KeyPair } from './RSA';
import { ExchangeData } from '../../icc-api/model/internal/ExchangeData';
import { IccExchangeDataApi } from '../../icc-api/api/internal/IccExchangeDataApi';
import { CryptoPrimitives } from './CryptoPrimitives';
/**
 * @internal this class is intended for internal use only and may be modified without notice
 * Functions to create and get exchange data.
 * The methods of this api require to pass the appropriate keys for encryption/decryption manually.
 */
export declare class BaseExchangeDataManager {
    readonly api: IccExchangeDataApi;
    private readonly dataOwnerApi;
    private readonly primitives;
    private readonly selfRequiresAnonymousDelegations;
    private readonly doNotUseBulkGet;
    constructor(api: IccExchangeDataApi, dataOwnerApi: IccDataOwnerXApi, primitives: CryptoPrimitives, selfRequiresAnonymousDelegations: boolean, doNotUseBulkGet: boolean);
    /**
     * Get all the exchange data where the current data owner is the delegator or the delegate. However, some data owners, generally HCPs, may have a
     * prohibitively high amount of exchange data. If the crypto strategies specify that the current data owner requires anonymous delegation this
     * method returns all the exchange data found for the data owner, else the method returns undefined.
     * @return all the exchange data for the current data owner or undefined if the crypto strategies don't allow to retrieve all data for the current
     * data owner.
     */
    getAllExchangeDataForCurrentDataOwnerIfAllowed(): Promise<ExchangeData[] | undefined>;
    /**
     * Get all exchange data for the provided delegator-delegate pair.
     * @param delegatorId id of a delegator data owner.
     * @param delegateId id of a delegate data owner.
     * @return all exchange data for the provided delegator-delegate pair.
     */
    getExchangeDataByDelegatorDelegatePair(delegatorId: string, delegateId: string): Promise<ExchangeData[]>;
    /**
     * Get the exchange data with the provided id.
     * @param exchangeDataId id of the exchange data.
     * @return the exchange data with the provided id or undefined if no exchange data with such id could be found.
     */
    getExchangeDataById(exchangeDataId: string): Promise<ExchangeData | undefined>;
    getExchangeDataByIds(exchangeDataIds: string[]): Promise<ExchangeData[]>;
    /**
     * Verifies the authenticity of the exchange data by checking the signature.
     * Note that all exchange data created by data owners other than the current data owner (including members of his hierarchy)
     * will always be unverified.
     * @param data collects the following information about the exchange data being verified:
     * - exchangeData the exchange data to verify.
     * - decryptedAccessControlSecret the access control secret decrypted from the exchange data.
     * - decryptedExchangeKey the exchange key decrypted from the exchange data.
     * - decryptedSharedSignatureKey the shared signature key decrypted from the exchange data.
     * @param verificationKeys verification keys for delegator signature by fingerprint.
     * @param verifyAsDelegator if true the method will also verify that the hmac key used for the signature was created by the delegator of the
     * exchange data. If true and the data was not created by the current data owner this method will return false.
     * @return the exchange data which could be verified given his signature and the available verification keys.
     * @throws if any of the provided exchange data has been created by a data owner other than the current data owner.
     */
    verifyExchangeData(data: {
        exchangeData: ExchangeData;
        decryptedAccessControlSecret: string;
        decryptedExchangeKey: CryptoKey;
        decryptedSharedSignatureKey: CryptoKey;
    }, verificationKeys: {
        [fp: string]: CryptoKey;
    }, verifyAsDelegator: boolean): Promise<boolean>;
    /**
     * Extracts and decrypts the access control secret from the provided exchange data.
     * These need to be hashed together with the entity class and confidentiality level in order to get the actual access control key
     * which will be sent to the server.
     * @param exchangeData the exchange data from which to extract access control secrets.
     * @param decryptionKeys rsa key pairs to use for decryption of the access control secret.
     * @return an object composed of:
     * - successfulDecryptions: array of all successfully decrypted access control keys
     * - failedDecryptions: array containing all exchange data for which the access control key could not be decrypted (using the provided keys).
     */
    tryDecryptAccessControlSecret(exchangeData: ExchangeData[], decryptionKeys: {
        [publicKeyFingerprint: string]: KeyPair<CryptoKey>;
    }): Promise<{
        successfulDecryptions: string[];
        failedDecryptions: ExchangeData[];
    }>;
    /**
     * Extract and decrypts the exchange keys from the provided exchange data.
     * @param exchangeData the exchange data from which to extract exchange keys.
     * @param decryptionKeys rsa key pairs to use for the decryption of the exchange keys.
     * @return an object composed of:
     * - successfulDecryptions: array containing the successfully decrypted exchange keys.
     * - failedDecryptions: array containing all exchange data for which the access control key could not be decrypted (using the provided keys).
     */
    tryDecryptExchangeKeys(exchangeData: ExchangeData[], decryptionKeys: {
        [publicKeyFingerprint: string]: KeyPair<CryptoKey>;
    }): Promise<{
        successfulDecryptions: CryptoKey[];
        failedDecryptions: ExchangeData[];
    }>;
    /**
     * Extract and decrypts the shared signature key from the provided exchange data.
     * @param exchangeData the exchange data from which to extract exchange keys.
     * @param decryptionKeys rsa key pairs to use for the decryption of the exchange keys.
     * @return an object composed of:
     * - successfulDecryptions: array containing the successfully decrypted exchange keys.
     * - failedDecryptions: array containing all exchange data for which the access control key could not be decrypted (using the provided keys).
     */
    tryDecryptSharedSignatureKeys(exchangeData: ExchangeData[], decryptionKeys: {
        [publicKeyFingerprint: string]: KeyPair<CryptoKey>;
    }): Promise<{
        successfulDecryptions: CryptoKey[];
        failedDecryptions: ExchangeData[];
    }>;
    private tryDecryptExchangeData;
    private tryDecrypt;
    /**
     * Creates exchange data from the current data owner to the provided delegate, uploading the newly created exchange data to the cloud.
     * This assumes that the keys have been verified.
     * @param delegateId id of the delegate for the new exchange data.
     * @param signatureKeys private keys to use for signing the created data.
     * @param encryptionKeys public keys to use for the encryption of the exchange data (from delegator and delegate).
     * @param optionalAttributes optional precalculated attributes for the creation of data
     * @return the newly created exchange data, and its decrypted exchange key and access control secret.
     */
    createExchangeData(delegateId: string, signatureKeys: {
        [keyPairFingerprint: string]: CryptoKey;
    }, encryptionKeys: {
        [keyPairFingerprint: string]: CryptoKey;
    }, optionalAttributes?: {
        id?: string;
    }): Promise<{
        exchangeData: ExchangeData;
        exchangeKey: CryptoKey;
        accessControlSecret: string;
        sharedSignatureKey: CryptoKey;
    }>;
    tryRawDecryptExchangeData(exchangeData: ExchangeData, decryptionKeys: {
        [publicKeyFingerprint: string]: KeyPair<CryptoKey>;
    }): Promise<{
        rawExchangeKey: ArrayBuffer;
        rawAccessControlSecret: ArrayBuffer;
        rawSharedSignatureKey: ArrayBuffer;
    } | undefined>;
    /**
     * Updates existing exchange data and uploads it to the cloud in order to share it also with additional public keys, useful for example in cases
     * where one of the data owners involved in the exchange data has lost one of his keys.
     * If the content of the exchange data could not be decrypted using the provided keys the method will not update anything and will return undefined.
     * This method assumes that the new encryption keys have been verified.
     * @param exchangeData exchange data to update.
     * @param decryptionKeys keys to use to extract the content of the exchange data which will be shared with the new keys.
     * @param newEncryptionKeys new keys to add to the exchange data.
     * @return the updated exchange data, and its decrypted exchange key and access control secret, or undefined if the exchange data content could not
     * be decrypted and the exchange data could not be updated.
     */
    tryUpdateExchangeData(exchangeData: ExchangeData, decryptionKeys: {
        [publicKeyFingerprint: string]: KeyPair<CryptoKey>;
    }, newEncryptionKeys: {
        [keyPairFingerprint: string]: CryptoKey;
    }): Promise<{
        exchangeData: ExchangeData;
        exchangeKey: CryptoKey;
        accessControlSecret: string;
    } | undefined>;
    /**
     * Same as [tryUpdateExchangeData] but the decrypted content is already provided.
     */
    updateExchangeDataWithRawDecryptedContent({ exchangeData, newEncryptionKeys, rawExchangeKey, rawAccessControlSecret, rawSharedSignatureKey, newDelegatorSignatureKeys, }: {
        exchangeData: ExchangeData;
        newEncryptionKeys: {
            [fp: string]: CryptoKey;
        };
        newDelegatorSignatureKeys: {
            [keyPairFingerprint: string]: CryptoKey;
        };
        rawExchangeKey: ArrayBuffer;
        rawAccessControlSecret: ArrayBuffer;
        rawSharedSignatureKey: ArrayBuffer;
    }): Promise<{
        exchangeData: ExchangeData;
        exchangeKey: CryptoKey;
        accessControlSecret: string;
    }>;
    private bytesToSignForSharedSignature;
    private bytesToSignForDelegatorSignature;
    private generateExchangeKey;
    importExchangeKey(decryptedBytes: ArrayBuffer): Promise<CryptoKey>;
    exportExchangeKey(key: CryptoKey): Promise<ArrayBuffer>;
    private generateSharedSignatureKey;
    importSharedSignatureKey(decryptedBytes: ArrayBuffer): Promise<CryptoKey>;
    exportSharedSignatureKey(key: CryptoKey): Promise<ArrayBuffer>;
    private generateAccessControlSecret;
    importAccessControlSecret(decryptedBytes: ArrayBuffer): Promise<string>;
    exportAccessControlSecret(secret: string): Promise<ArrayBuffer>;
    private encryptDataWithKeys;
    private extractHmacFromRsaPrivate;
    private signDataWithDelegatorKeys;
    private verifyDelegatorSignature;
    private signDataWithSharedKey;
    private verifyDataWithSharedKey;
}
