ProvnZero SDK (TypeScript)#
The TypeScript/Node.js SDK for the ProvnZero proxy. It handles HPKE sealing, receipt verification, structured sync responses, and verified streaming against the proxy's attestation key.
Features#
- Standard HPKE: Implements HPKE Base mode via
@noble. - Async API: Clean Promise-based interface.
- Small Dependency Surface: Lightweight crypto-focused footprint.
- Client-Side Sealing: Manages ephemeral keypairs and session isolation automatically.
- Verified Receipts: Validates signed sync receipts before returning them to the caller.
- Structured Responses: Preserves assistant messages, finish reasons, and tool calls through the sealed sync path.
- Verified Streaming: Decrypts chunk envelopes and checks the signed terminal proof before accepting stream completion.
Installation#
Basic Usage#
client.send("What is the capital of France?") is also supported for the common case.
The object form also supports system, messages, tools, tool_choice, temperature, and max_tokens when you need to preserve multi-turn chat context or tool calls through the proxy.
Streaming#
Security#
The SDK performs client-side sealing before the prompt ever leaves your memory.
- It requests the server's public key.
- It generates a fresh ephemeral keypair.
- It performs HPKE
setup_senderto derive a secret key. - It seals the prompt using AES-256-GCM.
- Only the ciphertext and encapsulated key are sent to the proxy.
For sync responses, the SDK verifies the signed receipt against the proxy's attestation key before returning verifiedReceipt.
For streaming, the SDK:
- Seals the request as usual.
- Decrypts each returned chunk envelope client-side.
- Recomputes the rolling chunk hash-chain locally using the same
vex-core-aligned hashing rules as the proxy. - Verifies the signed terminal proof before treating the stream as complete.
If you already trust the proxy's attestation key out of band, pass it at construction time:
For planned key rotation windows, pass more than one trusted key:
If you do not pin a key, the SDK trusts the first X-Provn-Attestation-Key it sees for the lifetime of the client instance and rejects later key changes. That is safer than blindly following each response header, but explicit key pinning or a short allow-list is still the stronger production posture.
The receipt and final-proof payloads the SDK verifies are currently ProvnZero-local v1 contracts mirrored from the proxy. They are intentionally kept stable until VEX publishes canonical shared schemas.
Development#
License#
Apache 2.0