import { Duplex as NodeDuplex } from 'stream' import { Duplex, DuplexEvents } from 'streamx' interface KeyPair { publicKey: Buffer secretKey: Buffer } interface Opts { autostart?: boolean // TODO: Use https://github.com/chm-diederichs/noise-handshake/blob/main/noise.js for specific patterns pattern?: string remotePublicKey?: Buffer keyPair?: KeyPair handshake?: { tx: Buffer rx: Buffer hash: Buffer publicKey: Buffer remotePublicKey: Buffer } } type NoiseStreamEvents = { connect: () => void handshake: () => void } declare class NoiseSecretStream< RawStream extends NodeDuplex | Duplex = Duplex > extends Duplex< any, any, any, any, true, true, DuplexEvents & NoiseStreamEvents > { readonly isInitiator: boolean readonly noiseStream: this publicKey: Buffer | null remotePublicKey: Buffer | null handshakeHash: Buffer | null rawStream: RawStream opened: Promise userData: any constructor(isInitiator: boolean, rawStream?: RawStream, opts?: Opts) static keyPair(seed?: Buffer): KeyPair start(rawStream?: NodeDuplex, opts?: Opts): void setTimeout(ms?: number): void setKeepAlive(ms?: number): void } export = NoiseSecretStream