| # 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: | |
| ```bash | |
| 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). | |
| ```bash | |
| 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 | |
| ```bash | |
| # 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: | |
| ```bash | |
| 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. | |
| ```bash | |
| npx ts-node examples/batch-audit.ts | |
| ``` | |
| ## Getting an API Key | |
| 1. Visit https://dashboard.affix-io.com | |
| 2. Sign up or log in | |
| 3. Navigate to "API Keys" section | |
| 4. Create a new API key | |
| 5. 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 | |
| ## More Information | |
| - [AffixIO SDK Documentation](https://www.affix-io.com/docs) | |
| - [NPM Package](https://www.npmjs.com/package/@affixio/sdk) | |
| - [Dashboard](https://dashboard.affix-io.com) | |