import { DHKeyPair } from '../dh.js'; import { Algorithms } from './algorithms.js'; import { CipherState } from './cipherstate.js'; import { HandshakePattern, KeyMixToken, Token } from './patterns.js'; import { HKDF } from '../hkdf.js'; export type Role = 'initiator' | 'responder'; export type HandshakeOptions = { prologue?: Uint8Array; staticKeypair?: DHKeyPair; remoteStaticPublicKey?: Uint8Array; pregeneratedEphemeralKeypair?: DHKeyPair; remotePregeneratedEphemeralPublicKey?: Uint8Array; preSharedKeys?: Uint8Array[]; }; export type TransportState = { send: CipherState; recv: CipherState; }; export declare class Handshake { algorithms: Algorithms; role: Role; staticKeypair: DHKeyPair; remoteStaticPublicKey: Uint8Array | null; ephemeralKeypair: DHKeyPair; remoteEphemeralPublicKey: Uint8Array | null; preSharedKeys?: Uint8Array[]; stepIndex: number; cipherState: CipherState; chainingKey: Uint8Array; handshakeHash: Uint8Array; hkdf: HKDF; pattern: HandshakePattern; constructor(algorithms: Algorithms, pattern: HandshakePattern | string, role: Role, options?: HandshakeOptions); get isInitiator(): boolean; mixHash(data: Uint8Array): void; mixKey(input: Uint8Array): void; mixKeyAndHashNextPSK(): void; encryptAndHash(p: Uint8Array): Uint8Array; decryptAndHash(c: Uint8Array): Uint8Array; _split(): TransportState | null; _nextStep(): Token[]; _processKeyMixToken(t: KeyMixToken): void; writeMessage(payload: Uint8Array): { packet: Uint8Array; finished: TransportState | null; }; readMessage(packet: Uint8Array): { message: Uint8Array; finished: TransportState | null; }; completeHandshake(writePacket: (packet: Uint8Array) => Promise, readPacket: () => Promise, handleMessage?: (_m: Uint8Array) => Promise, produceMessage?: () => Promise): Promise; }