Treza SDK

TREZA SDK

npm version License: MIT TypeScript

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 enclaves

  • getEnclave(enclaveId) - Get specific enclave

  • createEnclave(request) - Create new enclave

  • updateEnclave(request) - Update enclave

  • deleteEnclave(enclaveId, walletAddress) - Delete enclave

Lifecycle Management:

  • pauseEnclave(enclaveId, walletAddress) - Pause enclave

  • resumeEnclave(enclaveId, walletAddress) - Resume enclave

  • terminateEnclave(enclaveId, walletAddress) - Terminate enclave

  • performEnclaveAction(request) - Generic lifecycle action

Logging:

  • getEnclaveLogs(enclaveId, logType?, limit?) - Get logs

    • Log types: 'all', 'ecs', 'stepfunctions', 'lambda', 'application', 'errors'

Attestation & Verification:

  • getAttestation(enclaveId) - Get attestation document with PCR measurements

  • getVerificationStatus(enclaveId) - Quick verification status

  • verifyAttestation(enclaveId, request?) - Comprehensive verification with compliance checks

  • generateIntegrationSnippet(enclaveId, language?) - Generate code snippets

    • Languages: 'javascript', 'python', 'curl', 'java'

Provider Methods

  • getProviders() - Get all available providers

  • getProvider(providerId) - Get specific provider

Task Methods

  • getTasks(walletAddress) - Get all tasks

  • createTask(request) - Create scheduled task

  • updateTask(request) - Update task

  • deleteTask(taskId, walletAddress) - Delete task

API Key Methods

  • getApiKeys(walletAddress) - Get all API keys

  • createApiKey(request) - Create API key with permissions

  • updateApiKey(request) - Update API key

  • deleteApiKey(apiKeyId, walletAddress) - Delete API key

GitHub Methods

  • getGitHubAuthUrl(state?) - Get OAuth authorization URL

  • exchangeGitHubCode(request) - Exchange OAuth code for token

  • getGitHubRepositories(accessToken) - Get user repositories

  • getRepositoryBranches(request) - Get repository branches

Docker Methods

  • searchDockerImages(query) - Search Docker Hub

  • getDockerTags(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 URL

    • contractAddress: KYCVerifier contract address

    • privateKey: Private key for write operations (optional)

Methods

Convenience Methods:

  • isAdult(proofId, useBlockchain?) - Check if user is 18+

  • getCountry(proofId, useBlockchain?) - Get user's nationality

  • hasValidDocument(proofId, useBlockchain?) - Check document validity

  • getDocumentType(proofId, useBlockchain?) - Get document type

  • getClaims(proofId, useBlockchain?) - Get all public claims

  • meetsRequirements(proofId, requirements, useBlockchain?) - Verify requirements

Core Methods:

  • submitProof(params) - Submit proof to API

  • verifyProof(proofId) - Verify proof via API

  • getProof(proofId) - Get proof details

Blockchain Methods:

  • hasValidKYC(userAddress) - Check if user has valid KYC on-chain

  • getProofFromChain(proofId) - Get proof from blockchain

  • getUserProofId(userAddress) - Get user's latest proof ID

  • submitProofOnChain(params) - Submit proof to blockchain

  • verifyProofOnChain(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

License

MIT License - see LICENSE file for details.


Last updated