@treza/sdk
Advanced tools
+1
-1
| { | ||
| "name": "@treza/sdk", | ||
| "version": "1.1.2", | ||
| "version": "1.2.0", | ||
| "description": "Core TREZA SDK for privacy-first DeFi development", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+50
-4
@@ -31,7 +31,15 @@ # @treza/sdk | ||
| ### KYC Verification | ||
| ### KYC Verification with Enclave Signing (Recommended) | ||
| In production, use `EnclaveSigner` so private keys never leave the Nitro Enclave: | ||
| ```typescript | ||
| import { TrezaKYCClient } from '@treza/sdk/kyc'; | ||
| import { TrezaClient, TrezaKYCClient, EnclaveSigner } from '@treza/sdk'; | ||
| const platform = new TrezaClient(); | ||
| const signer = new EnclaveSigner(platform, { | ||
| enclaveId: process.env.TREZA_ENCLAVE_ID!, | ||
| verifyAttestation: true, | ||
| }); | ||
| const client = new TrezaKYCClient({ | ||
@@ -42,5 +50,23 @@ apiUrl: 'https://api.trezalabs.com/api', | ||
| contractAddress: '0xB1D98F688Fac29471D91234d9f8EbB37238Df6FA', | ||
| signerProvider: signer, | ||
| }, | ||
| }); | ||
| // Submit proof on-chain (signed inside the enclave) | ||
| const txHash = await client.submitProofOnChain({ commitment, proof, publicInputs }); | ||
| ``` | ||
| ### Read-Only KYC Checks (No Signing Required) | ||
| ```typescript | ||
| import { TrezaKYCClient } from '@treza/sdk'; | ||
| const client = new TrezaKYCClient({ | ||
| apiUrl: 'https://api.trezalabs.com/api', | ||
| blockchain: { | ||
| rpcUrl: 'https://rpc.sepolia.org', | ||
| contractAddress: '0xB1D98F688Fac29471D91234d9f8EbB37238Df6FA', | ||
| }, | ||
| }); | ||
| // Check if user is an adult | ||
@@ -64,2 +90,19 @@ const isAdult = await client.isAdult(proofId); | ||
| ### Local Development (Demo Only) | ||
| For local dev and testing, use `LocalSigner`. **Do not use in production.** | ||
| ```typescript | ||
| import { TrezaKYCClient, LocalSigner } from '@treza/sdk'; | ||
| const client = new TrezaKYCClient({ | ||
| apiUrl: 'http://localhost:3000/api', | ||
| blockchain: { | ||
| rpcUrl: 'http://localhost:8545', | ||
| contractAddress: '0x...', | ||
| signerProvider: new LocalSigner(process.env.PRIVATE_KEY!), | ||
| }, | ||
| }); | ||
| ``` | ||
| ### Enclave Management | ||
@@ -140,4 +183,7 @@ | ||
| # For write operations | ||
| PRIVATE_KEY=0x... | ||
| # Enclave signing (production - recommended) | ||
| TREZA_ENCLAVE_ID=enc_...your-enclave-id | ||
| # Local dev only (do NOT use in production): | ||
| # PRIVATE_KEY=0x... | ||
| ``` | ||
@@ -144,0 +190,0 @@ |
9405
16.31%201
29.68%