/**
 * Copyright 2020-2021 Hyperledger Cactus Contributors
 * SPDX-License-Identifier: Apache-2.0
 *
 * @cactus-api-client/socketio-api-client.ts
 */
import { LogLevelDesc } from "@hyperledger/cactus-common";
import { ISocketApiClient } from "@hyperledger/cactus-core-api";
import { SocketOptions, ManagerOptions } from "socket.io-client-fixed-types";
import { JwtPayload } from "jsonwebtoken";
import { Observable } from "rxjs";
/**
 * Default logic for validating responses from socketio connector (validator).
 * Assumes that message is JWT signed with validator private key.
 * @param publicKey - Validator public key.
 * @param targetData - Signed JWT message to be decoded.
 * @returns Promise resolving to decoded JwtPayload.
 */
export declare function verifyValidatorJwt(publicKey: string, targetData: string): Promise<JwtPayload>;
/**
 * Input parameters for SocketIOApiClient construction.
 */
export type SocketIOApiClientOptions = {
    readonly validatorID: string;
    readonly validatorURL: string;
    readonly validatorKeyValue?: string;
    readonly validatorKeyPath?: string;
    readonly logLevel?: LogLevelDesc;
    readonly maxCounterRequestID?: number;
    readonly syncFunctionTimeoutMillisecond?: number;
    readonly socketOptions?: Partial<ManagerOptions & SocketOptions>;
};
/**
 * Type of the message emitted from ledger monitoring.
 */
export type SocketLedgerEvent = {
    status: number;
    blockData: [Record<string, unknown>];
};
/**
 * Client for sending requests to some socketio ledger connectors (validators) using socketio protocol.
 *
 * @todo Analyze and handle broken connection / socket disconnected scenarios
 */
export declare class SocketIOApiClient implements ISocketApiClient<SocketLedgerEvent> {
    readonly options: SocketIOApiClientOptions;
    private readonly log;
    private readonly socket;
    private readonly validatorKey;
    private monitorSubject;
    readonly className: string;
    counterReqID: number;
    checkValidator: (publicKey: string, data: string) => Promise<JwtPayload>;
    /**
     * @param validatorID - (required) ID of validator.
     * @param validatorURL - (required) URL to validator socketio endpoint.
     * @param validatorKeyValue - (required if no validatorKeyPath) Validator public key.
     * @param validatorKeyPath - (required if no validatorKeyValue) Path to validator public key in local storage.
     */
    constructor(options: SocketIOApiClientOptions);
    /**
     * Immediately sends request to the validator, doesn't report any error or responses.
     * @param contract - contract to execute on the ledger.
     * @param method - function / method to be executed by validator.
     * @param args - arguments.
     */
    sendAsyncRequest(contract: Record<string, unknown>, method: Record<string, unknown>, args: any): void;
    /**
     * Sends request to be executed on the ledger, watches and reports any error and the response from a ledger.
     * @param contract - contract to execute on the ledger.
     * @param method - function / method to be executed by validator.
     * @param args - arguments.
     * @returns Promise that will resolve with response from the ledger, or reject when error occurred.
     * @todo Refactor to RxJS
     */
    sendSyncRequest(contract: Record<string, unknown>, method: Record<string, unknown>, args: any): Promise<any>;
    /**
     * Start monitoring for new blocks on the ledger associated with given connector.
     * @param monitorOptions - Options to be passed to validator `startMonitoring` procedure.
     * @returns RxJs Observable, `next` - new block, `error` - any error from the validator.
     */
    watchBlocksV1(monitorOptions?: Record<string, unknown>): Observable<SocketLedgerEvent>;
    /**
     * Generated sync request id used to track and match responses from the validator.
     * @returns ID lower than maxCounterRequestID.
     */
    private genarateReqID;
    /**
     * Closes internal socket.io connection to the validator.
     */
    close(): void;
}
