UNPKG

node-noise

Version:
29 lines (28 loc) 1.33 kB
import type { HandshakeHandler, IHandshake } from './@types/handshake-interface'; import type { bytes, bytes32 } from './@types/basic'; import { NoiseSession } from './@types/handshake'; import { PbStream } from './pb-stream'; import { KeyPair } from './@types/keypair'; import { ICryptoInterface } from './crypto'; import { PatternHandshake } from './handshakes/pattern'; import { Metrics } from './@types/metrics'; export declare class Handshake implements IHandshake { isInitiator: boolean; session: NoiseSession; handshakeHandler: HandshakeHandler | null; private remotePublicKey; protected connection: PbStream; protected handshake: PatternHandshake; protected staticKeypair: KeyPair; private readonly prologue; private readonly metrics; constructor(isInitiator: boolean, prologue: bytes32, crypto: ICryptoInterface, staticKeypair: KeyPair, connection: PbStream, handshake: PatternHandshake, handshakeHandler?: HandshakeHandler | null, remotePublicKey?: bytes | null, metrics?: Metrics | null); doHandshake(): Promise<void>; decrypt(ciphertext: bytes, session: NoiseSession, dst?: Uint8Array | undefined): { plaintext: bytes; valid: boolean; }; encrypt(plaintext: bytes, session: NoiseSession): bytes; getRemoteStaticKey(): bytes; private getCS; }