import type { CipherSuite, TLSProtocolVersion } from '@reclaimprotocol/tls';
import { uint8ArrayToBinaryStr } from '@reclaimprotocol/tls';
import { RPCMessage, RPCMessages } from '../proto/api.ts';
import type { CompleteTLSPacket, IDecryptedTranscript, IDecryptedTranscriptMessage, ProviderField, RPCEvent, RPCEventMap, RPCEventType, RPCType, Transcript } from '../types/index.ts';
export { uint8ArrayToBinaryStr };
/**
 * Decodes a Uint8Array to a UTF-8 string.
 */
export declare function uint8ArrayToStr(arr: Uint8Array): string;
/**
 * Encodes a UTF-8 string to a Uint8Array.
 */
export declare function strToUint8Array(str: string): Uint8Array;
export declare function getTranscriptString(receipt: IDecryptedTranscript): string;
export declare const unixTimestampSeconds: () => number;
/**
 * Find index of needle in haystack
 */
export declare function findIndexInUint8Array(haystack: Uint8Array, needle: Uint8Array): number;
/**
 * Fetch the ZK algorithm for the specified cipher suite
 */
export declare function getZkAlgorithmForCipherSuite(cipherSuite: CipherSuite): "aes-256-ctr" | "aes-128-ctr" | "chacha20";
/**
 * Get the pure ciphertext without any MAC,
 * or authentication tag,
 * @param content content w/o header
 * @param cipherSuite
 */
export declare function getPureCiphertext(content: Uint8Array, cipherSuite: CipherSuite): Uint8Array<ArrayBufferLike>;
/**
 * Get the 8 byte IV part that's stored in the record for some cipher suites
 * @param content content w/o header
 * @param cipherSuite
 */
export declare function getRecordIV(content: Uint8Array, cipherSuite: CipherSuite): Uint8Array<ArrayBuffer>;
export declare function getProviderValue<P, S, T>(params: P, fn: ProviderField<P, S, T>, secretParams?: S): T;
export declare function generateRpcMessageId(): number;
/**
 * Random session ID for a WebSocket client.
 */
export declare function generateSessionId(): number;
/**
 * Random ID for a tunnel.
 */
export declare function generateTunnelId(): number;
export declare function makeRpcEvent<T extends RPCEventType>(type: T, data: RPCEventMap[T]): RPCEvent<T>;
/**
 * Get the RPC type from the key.
 * For eg. "claimTunnelRequest" ->
 *    { type: 'claimTunnel', direction: 'request' }
 */
export declare function getRpcTypeFromKey(key: string): {
    type: RPCType;
    direction: "request";
} | {
    type: RPCType;
    direction: "response";
} | undefined;
/**
 * Get the RPC response type from the RPC type.
 * For eg. "claimTunnel" -> "claimTunnelResponse"
 */
export declare function getRpcResponseType<T extends RPCType>(type: T): `${T}Response`;
/**
 * Get the RPC request type from the RPC type.
 * For eg. "claimTunnel" -> "claimTunnelRequest"
 */
export declare function getRpcRequestType<T extends RPCType>(type: T): `${T}Request`;
export declare function isApplicationData(packet: CompleteTLSPacket, tlsVersion: string | undefined): boolean;
/**
 * Convert the received data from a WS to a Uint8Array
 */
export declare function extractArrayBufferFromWsData(data: unknown): Promise<Uint8Array>;
/**
 * Check if the RPC message is a request or a response.
 */
export declare function getRpcRequest(msg: RPCMessage): {
    type: RPCType;
    direction: "request";
} | {
    type: RPCType;
    direction: "response";
} | {
    direction: "response";
    type: "error";
} | undefined;
/**
 * Finds all application data messages in a transcript
 * and returns them. Removes the "contentType" suffix from the message.
 * in TLS 1.3
 */
export declare function extractApplicationDataFromTranscript({ transcript, tlsVersion }: IDecryptedTranscript): Transcript<Uint8Array<ArrayBufferLike>>;
export type HandshakeTranscript<T> = {
    sender: 'client' | 'server';
    index: number;
    message: T;
}[];
export declare function extractHandshakeFromTranscript({ transcript, tlsVersion }: {
    transcript: IDecryptedTranscriptMessage[];
    tlsVersion: TLSProtocolVersion;
}): HandshakeTranscript<Uint8Array<ArrayBufferLike>>;
export declare function decryptDirect(directReveal: any, cipherSuite: CipherSuite, recordHeader: Uint8Array, serverTlsVersion: TLSProtocolVersion, content: Uint8Array): Promise<{
    plaintext: Uint8Array<ArrayBufferLike>;
    iv: Uint8Array<ArrayBufferLike>;
}>;
export declare function packRpcMessages(...msgs: Partial<RPCMessage>[]): RPCMessages;
/**
 * Converts an Ethers struct (an array w named keys) to
 * a plain object. Recursively converts all structs inside.
 * Required to correctly JSON.stringify the struct.
 */
export declare function ethersStructToPlainObject<T>(struct: T): T;
export declare function isTls13Suite(suite: CipherSuite): suite is "TLS_CHACHA20_POLY1305_SHA256" | "TLS_AES_256_GCM_SHA384" | "TLS_AES_128_GCM_SHA256";
