AffixIO's picture
Upload folder using huggingface_hub
44f0c63 verified
/**
* Basic Usage Example - Audit Proof Circuit
*
* This example demonstrates how to use the Audit Proof circuit
* with the AffixIO SDK in sandbox mode (no API key required for testing).
*
* ⚠️ Note: Sandbox mode is for testing only. Production requires an API key.
*
* Prerequisites:
* - npm install @affixio/sdk
* - npm install typescript @types/node ts-node
*
* Run with: npx ts-node examples/basic-usage.ts
*/
import { AffixIO } from '@affixio/sdk';
async function main() {
// Initialize SDK in sandbox mode (no API key needed for testing)
const sdk = new AffixIO({
sandbox: true
});
console.log('🔐 Generating audit proof in sandbox mode...\n');
console.log('⚠️ Note: Sandbox mode is for testing only. Production requires an API key.\n');
// Generate audit proof
const result = await sdk.circuits.auditProof({
decisionValue: 1, // Decision: approved
pseudonymisedId: '0x1234567890abcdef1234567890abcdef',
rulesHash: '0xabcdef1234567890abcdef1234567890',
timestamp: new Date().toISOString()
}, true); // Use sandbox mode
console.log('✅ Audit Proof Generated:');
console.log(' Decision:', result.decision ? 'Verified' : 'Failed');
console.log(' Verified:', result.verified);
console.log(' Proof ID:', result.proofId);
console.log(' Proof:', result.proof.substring(0, 50) + '...');
console.log(' Public Inputs:', result.publicInputs);
console.log('\n✨ Audit proof generated successfully!');
console.log('\n📝 For production use, get your API key at: https://dashboard.affix-io.com');
}
// Run the example
main().catch(console.error);