Usage Examples
This directory contains example code demonstrating how to use the Audit Proof Circuit with the AffixIO SDK.
Prerequisites
Before running any examples, install the required dependencies:
npm install @affixio/sdk typescript @types/node ts-node
Examples
1. Basic Usage (basic-usage.ts)
Demonstrates basic usage with sandbox mode (no API key required for testing).
npx ts-node examples/basic-usage.ts
Note: Sandbox mode is for testing only. Production requires an API key.
2. Authenticated Usage (authenticated-usage.ts)
Demonstrates production usage with API key authentication.
⚠️ Requires API Key: Get your API key at https://dashboard.affix-io.com
# Set your API key as environment variable
export AFFIXIO_API_KEY=affix_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Run the example
npx ts-node examples/authenticated-usage.ts
Or set it inline:
AFFIXIO_API_KEY=affix_xxxxx npx ts-node examples/authenticated-usage.ts
3. Batch Audit (batch-audit.ts)
Demonstrates generating multiple audit proofs in batch for compliance reporting.
npx ts-node examples/batch-audit.ts
Getting an API Key
- Visit https://dashboard.affix-io.com
- Sign up or log in
- Navigate to "API Keys" section
- Create a new API key
- Copy and store securely
Security Best Practices
- ✅ Always use environment variables for API keys
- ✅ Never commit API keys to version control
- ✅ Use sandbox mode only for testing
- ✅ Use authenticated mode for production