UNPKG

node-noise

Version:
47 lines (46 loc) 982 B
import type { bytes, bytes32, uint64 } from './basic'; import type { KeyPair } from './keypair'; import type { Nonce } from '../nonce'; export type Hkdf = [bytes, bytes, bytes]; export interface MessageBuffer { ne: bytes32; ns: bytes; ciphertext: bytes; } export interface CipherState { k: bytes32; n: Nonce; } export interface SymmetricState { cs: CipherState; ck: bytes32; h: bytes32; } export interface HandshakeState { ss: SymmetricState; s: KeyPair; e: KeyPair | null; rs: bytes32 | null; re: bytes32 | null; psk: bytes32 | null; } export declare enum Action { READ_MESSAGE = 0, WRITE_MESSAGE = 1, SPLIT = 2 } export interface NoiseSession { hs: HandshakeState; h?: bytes32; cs1?: CipherState; cs2?: CipherState; mc: uint64; i: boolean; action: Action; patternIndex: number; } export interface INoisePayload { identityKey: bytes; identitySig: bytes; data: bytes; }