Overview
TheAttestedStream class provides direct access to the raw attested TLS stream without any HTTP protocol handling. This is the lowest-level API, useful for custom protocols or debugging.
For HTTP requests, use createAtlsFetch or AtlsHttp instead.
Class methods
connect
Connect to a TEE server via WebSocket proxy and perform the aTLS protocol.WebSocket proxy URL with optional target query parameter.Examples:
"ws://127.0.0.1:9000?target=vllm.example.com:443""ws://proxy.example.com:9000"
TLS server name for SNI and certificate validation.Example:
"vllm.example.com"Attestation verification policy object.See Policy configuration for details.
An
AttestedStream instance with:readable: Native ReadableStream for receiving datasend(data): Method to send dataattestation(): Attestation verification result
readable
Get the native ReadableStream for receiving data from the TEE.A native Web ReadableStream that yields raw bytes from the attested TLS connection.This stream can be passed directly to
new Response(readable) or used with a reader.attestation
Get the attestation verification result from the connection handshake.send
Send raw bytes to the TEE over the attested TLS connection.Raw bytes to send over the attested TLS connection
Resolves when the data has been written and flushed
closeWrite
Close the write side of the stream.Resolves when the write side has been closed
Stream design
TheAttestedStream provides:
- Zero-copy reads: Response data streams directly through the native ReadableStream
- Simple writes: Send data via the async
send()method - Bidirectional: Read and write sides can operate independently
Examples
Raw HTTP request
Custom protocol
Streaming with backpressure
Closing the write side
Use cases
- Custom protocols: Implement non-HTTP protocols over attested TLS
- Debugging: Inspect raw TLS traffic for debugging
- Low-level control: Full control over when and how data is sent/received
- Protocol development: Build higher-level protocol implementations
createAtlsFetch or AtlsHttp.