/// <reference types="node" />
/// <reference types="node" />
import { Readable } from "stream";
import { KeyType, KeyPolicy } from "./consts";
export type TeeDeviceInfoType = {
    cpus: Array<{
        vendorId: string;
        cpuFamily: number;
        model: number;
        modelName: string;
        physicalCores: number;
        logicalCores: number;
        baseFreq: number;
        maxFreq: number;
    }>;
    memSize: number;
    totalPhysicalCores: number;
    totalLogicalCores: number;
};
export type TeeRunCpuBenchmarkType = {
    cpuScore: number;
    cpuBenchmark: string;
    cpuCoresCount: number;
};
export type TeeRunMemoryBenchmarkType = {
    memBandwidth: number;
    memСonfirmedSize: number;
};
export type TeeGetKeyResult = {
    key: Buffer;
    request: Buffer;
};
export declare class EnclaveService {
    private readonly tmpFolder;
    private readonly sgx;
    constructor(tmpFolder?: string);
    /**
     * Requests secret keys from cpu.
     * @param type Value from enum @type KeyType
     * @param policy Value from enum @type KeyPolicy
     * @param previousRequest Request, for example received in a previous call to this method,
     *                        can be undefined - this way a new request will be generated
     * @returns Key and request, generated by method.
     */
    getSecretKey(type: KeyType, policy: KeyPolicy, previousRequest?: Buffer): Promise<TeeGetKeyResult>;
    /**
     * Determines whether the request to obtain the key is outdated, for example, cpu_svn or isv_svn were updated
     * @param previousRequest - Key Request
     * @returns True if the request is outdated, false - the request is up to date
     */
    isOutdatedRequest(previousRequest: Buffer): Promise<boolean>;
    /**
     * Returns TEE device information.
     * @returns
     */
    getTeeDeviceInfo(): Promise<TeeDeviceInfoType>;
    /**
     * Returns TEE cpu benchmark.
     * @param deviceInfoMemSize
     * @returns
     */
    getTeeDeviceCpuBenchmark(deviceInfoMemSize: number): Promise<TeeRunCpuBenchmarkType>;
    /**
     * Returns TEE memory benchmark.
     * @param deviceInfoTotalPhysicalCores
     * @returns
     */
    getTeeDeviceMemoryBenchmark(deviceInfoTotalPhysicalCores: number): Promise<TeeRunMemoryBenchmarkType>;
    /**
     * Writes input stream to the protected file.
     * @param inputStream
     * @param outputStream
     * @param filepath
     * @param secretKey
     */
    writeGramineProtectedFile(filepath: string, inputStream: Readable, secretKey: Buffer): Promise<{
        writtenSize: number;
        filesize: number;
        filepath: string;
    }>;
    /**
     * Reads protected file and write to output stream.
     * @param filepath
     * @param inputStream
     * @param outputStream
     * @param secretKey
     */
    readGramineProtectedFile(filepath: string, inputStream: Readable, secretKey: Buffer): Promise<{
        fileStream: Readable;
        filesize: number;
        filepath: string;
    }>;
}
