Documentation Index
Fetch the complete documentation index at: https://docs.story.foundation/llms.txt
Use this file to discover all available pages before exploring further.
This reference tracks the Aeneid release of
@piplabs/cdr-sdk (v0.2.1),
available on npm.@piplabs/cdr-sdk) provides a TypeScript client for interacting with Story’s Confidential Data Rails system. It handles threshold encryption, vault management, and on-chain access control.
Step-by-Step Guide
Learn CDR through a series of tutorials with the CDR SDK Integration Guide.
CDRClient
The main entry point. Provides access to three sub-clients:Current Surface Area
observer: vaults, fees, DKG state, validator registrations, and validator attestationsuploader:uploadCDR,uploadFile,allocate,write, andencryptDataKeyconsumer:accessCDR,downloadFile,read,collectPartials, anddecryptDataKeycrypto: low-level TDH2, ECIES, and SGX attestation verification helpers
createVaultas an alias foruploadCDRreadVaultas an alias foraccessCDRcreateFileVaultas an alias foruploadFilereadFileVaultas an alias fordownloadFile
State Backends
The client reads from two backends:| Backend | Configured by | Purpose |
|---|---|---|
| EVM | publicClient | CDR contract state — vaults, fees, maxEncryptedDataSize, operational threshold |
| Story-API REST | apiUrl | DKG state — active round, global public key, threshold, validators, attestations |
apiUrl is a required parameter. See
Runtime Configuration
for operational guidance and the optional minThresholdRatio override.
Attestation Utilities
The SDK also exposes SGX helper functions in the crypto module:parseSgxQuote()to readMRENCLAVE,MRSIGNER, andsecurityVersionfrom a quoteverifyAttestation()to validate those fields against your expected values
observer.getValidatorAttestations() when your
application wants an explicit validator enclave allowlist check.
Sub-Clients
Observer
Read-only queries for vault data, fees, and DKG state.
Uploader
Encrypt data, upload encrypted files, and write to CDR vaults.
Consumer
Request decryption, download encrypted files, and recover plaintext.
Crypto Utilities
Crypto
Low-level TDH2 and ECIES cryptographic primitives.

