/// <reference types="node" />
import { Request, Method, MethodArgs, Params } from './interfaces';
/**
 * Interface to pass Error constructor as parameter to function
 */
export interface ErrorType<T extends Error> extends Function {
    new (...args: Array<any>): T;
}
/**
 * Assertion to ensure value to be string or Buffer
 *
 * @param val {*} - value to be asserted on
 * @param Err {ErrorType} - Error to be thrown if assertion fails
 */
export declare function assertStringOrBuffer(val: any, Err: ErrorType<Error>): asserts val is string | Buffer;
/**
 * Assertion to ensure value is a valid rpc request object
 *
 * @param val {*} - value to be asserted on
 * @param Err {ErrorType} - Error to be thrown if assertion fails
 */
export declare function assertValidRequest(val: any, Err: ErrorType<Error>): asserts val is Request;
/**
 * Validates and parses a message. Will throw error if parse/validation fails.
 *
 * @param message {*} - message to be parsed and validated
 * @param Err {ErrorType} - Error to be thrown if parse/validation fails
 * @returns {object} - parsed message
 */
export declare function validateAndParseMessage(message: any, Err: ErrorType<Error>): object;
/**
 * Validates method for existence
 *
 * @param methodName {string} - method to be found
 * @param registeredMethods - registered method pool to find method in
 * @param Err - Error to be thrown if method could not be found
 * @returns {Method}
 */
export declare function validateMethod(methodName: string, registeredMethods: Map<string, Method>, Err: ErrorType<Error>): Method;
/**
 * Validates params for correctness
 *
 * @param providedParams {Params | MethodArgs | undefined} - params provided by client
 * @param expectedParams {Params} - expected params of registered method
 * @param Err {ErrorType} - Error to be thrown if params are incorrect
 * @returns {MethodArgs} - args to be passed to function
 */
export declare function validateParams(providedParams: Params | MethodArgs | undefined, expectedParams: Params, Err: ErrorType<Error>): MethodArgs;
