File size: 1,755 Bytes
44f0c63 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# 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)
|