Treza SDK
TypeScript SDK for interacting with TREZA's privacy-preserving KYC system and secure enclave management platform.
Features
Enclave Platform Features
Secure Enclave Deployment - Deploy and manage AWS Nitro Enclaves with cryptographic attestation
Lifecycle Management - Full control over enclave state (deploy, pause, resume, terminate)
Attestation & Verification - Hardware-backed cryptographic proof of enclave integrity
Comprehensive Logging - Access logs from ECS, Step Functions, Lambda, and applications
Provider Management - Support for multiple cloud providers and regions
Task Scheduling - Schedule and manage automated tasks within enclaves
GitHub Integration - Connect enclaves directly to GitHub repositories
Docker Support - Search and deploy Docker Hub images
API Key Management - Fine-grained access control with permissions
Secure Key Management
Enclave Signing - Transaction signing inside hardware-isolated Nitro Enclaves (recommended)
Pluggable Signers - Swap between enclave, local, or browser wallet signing with one line
No Key Exposure - Private keys never leave the TEE in production
Attestation Verification - Cryptographic proof of enclave integrity before signing
KYC Features
Zero-Knowledge KYC - Verify identity without exposing personal data
Blockchain Integration - Direct integration with KYCVerifier smart contracts
Convenience Methods - Simple APIs for common KYC checks (age, country, document validity)
Dual Verification - API-based (fast) OR blockchain-based (trustless)
Multi-Chain Support - Ethereum, Sepolia, and compatible networks
Developer Experience
TypeScript Support - Full type safety and IntelliSense
Easy Integration - Works with any TypeScript/JavaScript project
Code Generation - Auto-generate integration snippets in multiple languages
No Authentication Required - Open API protected by rate limiting (KYC endpoints)
Secure by Design - No personal data storage, cryptographic proofs only
Quick Start
Installation
Environment Setup
Create a .env file:
See .env.example for all available configuration options.
Basic Usage - KYC with Enclave Signing (Recommended)
In production, private keys are managed inside Treza Nitro Enclaves and never leave the hardware-isolated TEE. The SDK provides pluggable signers so you can swap between enclave signing, local keys, or browser wallets with one line of code.
Local Development (Demo Only)
For local development and testing, you can use LocalSigner with a raw private key. Do not use this in production.
Read-Only Usage (No Signing)
Many KYC operations don't require signing at all:
Basic Usage - Enclave Platform
See Quick Reference for more examples and complete API documentation.
Core Features
KYC Features
Convenience Methods
The SDK provides simple methods for common KYC checks:
Dual Verification
Choose between API-based (fast) or blockchain-based (trustless) verification:
Blockchain Operations
Direct interaction with KYCVerifier smart contracts:
Architecture
KYC Platform
Enclave Platform
Key Management & Signing
The Treza SDK provides a pluggable signing architecture. Instead of storing private keys in .env files, you choose a SignerProvider that matches your environment:
EnclaveSigner
Production (recommended)
Keys are generated and stored inside a Treza Nitro Enclave. Signing requests go through the Platform API to the TEE. Keys never leave the enclave.
LocalSigner
Development/Testing
Wraps a raw private key string. Emits a warning if used in production.
BrowserWalletSigner
Client-side dApps
Delegates to MetaMask or any injected Web3 wallet. Prompts the user to sign.
Signing Flow (EnclaveSigner)
Using EnclaveSigner
Custom Signers
You can implement the SignerProvider interface to integrate any key management system (AWS KMS, HashiCorp Vault, hardware wallets, etc.):
API Reference
TrezaClient
Main client for enclave platform management.
Constructor
Config Options:
baseUrl: Base API URL (default:https://app.trezalabs.com)timeout: Request timeout in milliseconds (default:30000)
Enclave Methods
Core Operations:
getEnclaves(walletAddress)- Get all enclavesgetEnclave(enclaveId)- Get specific enclavecreateEnclave(request)- Create new enclaveupdateEnclave(request)- Update enclavedeleteEnclave(enclaveId, walletAddress)- Delete enclave
Lifecycle Management:
pauseEnclave(enclaveId, walletAddress)- Pause enclaveresumeEnclave(enclaveId, walletAddress)- Resume enclaveterminateEnclave(enclaveId, walletAddress)- Terminate enclaveperformEnclaveAction(request)- Generic lifecycle action
Logging:
getEnclaveLogs(enclaveId, logType?, limit?)- Get logsLog types:
'all','ecs','stepfunctions','lambda','application','errors'
Attestation & Verification:
getAttestation(enclaveId)- Get attestation document with PCR measurementsgetVerificationStatus(enclaveId)- Quick verification statusverifyAttestation(enclaveId, request?)- Comprehensive verification with compliance checksgenerateIntegrationSnippet(enclaveId, language?)- Generate code snippetsLanguages:
'javascript','python','curl','java'
Provider Methods
getProviders()- Get all available providersgetProvider(providerId)- Get specific provider
Task Methods
getTasks(walletAddress)- Get all taskscreateTask(request)- Create scheduled taskupdateTask(request)- Update taskdeleteTask(taskId, walletAddress)- Delete task
API Key Methods
getApiKeys(walletAddress)- Get all API keyscreateApiKey(request)- Create API key with permissionsupdateApiKey(request)- Update API keydeleteApiKey(apiKeyId, walletAddress)- Delete API key
GitHub Methods
getGitHubAuthUrl(state?)- Get OAuth authorization URLexchangeGitHubCode(request)- Exchange OAuth code for tokengetGitHubRepositories(accessToken)- Get user repositoriesgetRepositoryBranches(request)- Get repository branches
Docker Methods
searchDockerImages(query)- Search Docker HubgetDockerTags(repository)- Get available tags for image
TrezaKYCClient
Client for KYC verification operations.
Constructor
Config Options:
apiUrl: API endpoint URL (required)apiKey: API key for authenticated requests (optional)blockchain: Blockchain configuration (optional)rpcUrl: Ethereum RPC URLcontractAddress: KYCVerifier contract addresssignerProvider: ASignerProviderfor secure key management (recommended)privateKey: (deprecated) Raw private key for write operations — usesignerProviderinstead
Methods
Convenience Methods:
isAdult(proofId, useBlockchain?)- Check if user is 18+getCountry(proofId, useBlockchain?)- Get user's nationalityhasValidDocument(proofId, useBlockchain?)- Check document validitygetDocumentType(proofId, useBlockchain?)- Get document typegetClaims(proofId, useBlockchain?)- Get all public claimsmeetsRequirements(proofId, requirements, useBlockchain?)- Verify requirements
Core Methods:
submitProof(params)- Submit proof to APIverifyProof(proofId)- Verify proof via APIgetProof(proofId)- Get proof details
Blockchain Methods:
hasValidKYC(userAddress)- Check if user has valid KYC on-chaingetProofFromChain(proofId)- Get proof from blockchaingetUserProofId(userAddress)- Get user's latest proof IDsubmitProofOnChain(params)- Submit proof to blockchainverifyProofOnChain(params)- Verify proof on blockchain
Examples
Age-Gated Content
Country Restrictions
KYC-Gated Platform
Enclave Platform
The TREZA SDK provides comprehensive management of secure AWS Nitro Enclaves with cryptographic attestation for privacy-preserving computation.
Getting Started with Enclaves
Enclave Management
Create and Deploy an Enclave
List and Get Enclaves
Update an Enclave
Enclave Lifecycle Management
Control enclave state with pause, resume, and terminate operations:
Attestation & Cryptographic Verification
TREZA enclaves provide hardware-backed cryptographic proof of integrity:
Integration Code Generation
Generate ready-to-use code snippets for third-party integration:
Comprehensive Logging
Access logs from all enclave components:
Task Scheduling
Schedule automated tasks within enclaves:
GitHub Integration
Connect enclaves to GitHub repositories for automated deployments:
Docker Integration
Search and use Docker Hub images:
API Key Management
Create and manage API keys with fine-grained permissions:
Documentation
KYC Documentation
Quick Reference - Common use cases and examples
Environment Configuration - Complete configuration guide
Setup Guide - Interactive setup script
KYC Examples - Working code examples
Enclave Platform Documentation
Basic Usage Example - Complete SDK walkthrough
Compliance Integration - Enterprise compliance examples
Production Readiness - Production deployment guide
Development
Setup
Build
Run Examples
KYC Examples
Enclave Platform Examples
Support
Documentation: QUICK_REFERENCE.md
GitHub Issues: Report bugs
Website: trezalabs.com
License
MIT License - see LICENSE file for details.
Links
GitHub: github.com/treza-labs/treza-sdk
npm: @treza/sdk
Smart Contracts: treza-contracts
Mobile App: treza-mobile
Backend API: treza-app
Last updated