Treza SDK
TREZA SDK
TypeScript SDK for interacting with TREZA's privacy-preserving KYC system and secure enclave management platform.
Features
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
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
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
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
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 addressprivateKey: Private key for write operations (optional)
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