import { ExchangeData } from '../../icc-api/model/internal/ExchangeData';
import { IccDataOwnerXApi } from '../icc-data-owner-x-api';
import { BaseExchangeDataManager } from './BaseExchangeDataManager';
import { UserEncryptionKeysManager } from './UserEncryptionKeysManager';
import { AccessControlSecretUtils } from './AccessControlSecretUtils';
import { CryptoStrategies } from './CryptoStrategies';
import { CryptoPrimitives } from './CryptoPrimitives';
import { EntityWithDelegationTypeName } from '../utils';
export type ExchangeDataManagerOptionalParameters = {
    lruCacheSize?: number;
};
/**
 * @internal this function is for internal use only and may be changed without notice.
 * Initialises and returns the exchange data manager which is most appropriate for the current data owner.
 */
export declare function initialiseExchangeDataManagerForCurrentDataOwner(base: BaseExchangeDataManager, encryptionKeys: UserEncryptionKeysManager, accessControlSecret: AccessControlSecretUtils, cryptoStrategies: CryptoStrategies, dataOwnerApi: IccDataOwnerXApi, primitives: CryptoPrimitives, useParentKeys: boolean, optionalParameters?: ExchangeDataManagerOptionalParameters): Promise<ExchangeDataManager>;
/**
 * @internal this class is intended for internal use only and may be changed without notice.
 * Exchange data manager which automatically handles decryption and cache
 */
export interface ExchangeDataManager {
    readonly base: BaseExchangeDataManager;
    /**
     * Updates all exchange data between the current data owner and another data owner to allow the other data owner to access existing exchange data
     * using a new public key. Note that this will make existing exchange keys from the other data owner to the current data owner unverified, therefore
     * invalid for encryption.
     * @param otherDataOwner the other data owner.
     * @param newDataOwnerPublicKey a new public key of the other data owner.
     */
    giveAccessBackTo(otherDataOwner: string, newDataOwnerPublicKey: string): Promise<void>;
    /**
     * Gets any existing and verified exchange data from the current data owner to the provided delegate or creates new data if no verified data is
     * available, then caches it.
     * @param delegateId the id of the delegate.
     * @param options
     * - allowCreationWithoutDelegatorKey if true, when creating new exchange data, even if no verified key is available for the delegator the method
     * will create the new exchange data anyway (will not be usable by the delegate without additional steps).
     * - allowCreationWithoutDelegateKey if true, when creating new exchange data, even if no verified key is available for the delegate the method
     * will create the new exchange data anyway (will not be usable by the delegate without additional steps).
     * @return the access control secret and key of the data to use for encryption.
     */
    getOrCreateEncryptionDataTo(delegateId: string, options?: {
        allowCreationWithoutDelegatorKey?: boolean;
        allowCreationWithoutDelegateKey?: boolean;
    }): Promise<{
        exchangeData: ExchangeData;
        accessControlSecret: string;
        exchangeKey: CryptoKey;
        sharedSignatureKey: CryptoKey;
    }>;
    /**
     * Retrieve the cached decrypted exchange data key associated with any of the provided hashes/entry keys of secure delegations.
     * @param hashes hashes of access control secrets for a specific entity, as they appear in the key of secure delegation entries
     * @return the exchange data and decrypted key associated to that hash if cached
     */
    getCachedDecryptionDataKeyByAccessControlHash(hashes: string[]): Promise<{
        [hash: string]: {
            exchangeData: ExchangeData;
            accessControlSecret: string;
            exchangeKey: CryptoKey;
        };
    }>;
    /**
     * Retrieves the exchange data with the provided id (from the cache if available or from the server otherwise if allowed by
     * and attempts to decrypt it, then caches the result.
     * @param ids ids of the exchange datas to retrieve
     * @param retrieveIfNotCached if false only cached data will be returned, and the access control hases options will be
     * ignored
     * @return a map containing the exchange data id associated with:
     * - exchangeData: the exchange data with the provided id
     * - exchangeKey: the exchange key corresponding to the provided exchange data if it could be decrypted, else undefined
     * - accessControlSecret: the access control secret corresponding to the provided exchange data if it could be decrypted, else undefined
     */
    getDecryptionDataKeyByIds(ids: string[], retrieveIfNotCached: boolean): Promise<{
        [id: string]: {
            exchangeKey: CryptoKey | undefined;
            accessControlSecret: string | undefined;
            exchangeData: ExchangeData;
        };
    }>;
    /**
     * Clears the cache or fully repopulates the cache if the current data owner can retrieve all of his exchange data according to the crypto
     * strategies.
     */
    clearOrRepopulateCache(): Promise<void>;
    /**
     * If the current data owner requires anonymous delegations this returns the base64 representation of the concatenation of all available access
     * control keys for the current data owner.
     */
    getAccessControlKeysValue(entityType: EntityWithDelegationTypeName): Promise<string | undefined>;
    /**
     * If the current data owner requires anonymous delegations this returns the access control keys which may be used in secure delegations for the
     * data owner, which can be used to search for data.
     */
    getAllDelegationKeys(entityType: EntityWithDelegationTypeName): Promise<string[] | undefined>;
    /**
     * Injects already decrypted exchange data, allowing it to be used by the sdk.
     * @param exchangeDataDetails the exchange data to inject, with the decrypted content and verified status.
     * Note that the SDK won't verify that the provided decrypted content actually matches what is stored in the exchange
     * data.
     * @param reEncryptWithOwnKeys if true all the provided exchange data that is not encrypted with any of the self
     * verified keys of the user will be re-encrypted with them. In case the user is also the delegator and the data is
     * verified the delegator signature will be updated.
     */
    injectDecryptedExchangeData(exchangeDataDetails: {
        exchangeDataId: string;
        accessControlSecret: ArrayBuffer;
        exchangeKey: ArrayBuffer;
        sharedSignatureKey: ArrayBuffer;
        verified: boolean;
    }[], reEncryptWithOwnKeys: boolean): Promise<void>;
}
