Skip to main content

@enclave-vm/stream

Streaming protocol implementation for the EnclaveJS runtime. Provides NDJSON parsing, end-to-end encryption, and automatic reconnection with event buffering.

Installation

NDJSON Protocol

EnclaveJS uses NDJSON (Newline-Delimited JSON) for streaming events. Each line is a complete JSON object representing a stream event.

Serialization

Parsing

Node.js Streams

End-to-End Encryption

EnclaveJS supports optional encryption using ECDH key exchange and AES-256-GCM.

Key Exchange (ECDH)

Key Derivation (HKDF)

Encryption/Decryption (AES-GCM)

Encryption Constants

Reconnection Handling

Built-in support for automatic reconnection with event buffering and sequence tracking.

Connection State Machine

Reconnection Configuration

Sequence Tracking

Event Buffering

Heartbeat Monitoring

Re-exported Types

This package re-exports all types from @enclave-vm/types for convenience: