npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@affixio/sdk

v1.0.2

Published

Official AffixIO SDK for Node.js - Zero-knowledge proof verification, QR code generation, and identity verification

Readme

AffixIO SDK

Official Node.js SDK for AffixIO - Zero-knowledge proof verification, QR code generation, and identity verification.

Installation

npm install @affixio/sdk

Quick Start

Using Email/Password Login

const AffixIO = require('@affixio/sdk');

// Initialize SDK
const affixio = new AffixIO({
  // apiBaseUrl now defaults to https://www.affix-io.com, override only if needed
  email: '[email protected]',
  password: 'your-password',
});

// Login
await affixio.login();

// Generate QR Code
const qrCode = await affixio.generateQRCode({
  verdict: 'YES',
  verification_mode: 'static',
  time_limit_seconds: 86400, // 24 hours
  metadata: {
    name: 'Age Verification',
    description: 'Customer age verification',
  },
});

console.log('QR Code Image:', qrCode.qr_code_image);
console.log('Verification URL:', qrCode.verification_url);

Using API Key

const AffixIO = require('@affixio/sdk');

// Initialize with API key
const affixio = new AffixIO({
  // apiBaseUrl now defaults to https://www.affix-io.com, override only if needed
  apiKey: 'your-api-key',
});

// Generate QR Code (no login needed)
const qrCode = await affixio.generateQRCode({
  verdict: 'YES',
  verification_mode: 'static',
  time_limit_seconds: 86400,
});

Features

  • Authentication - Login with email/password or use API keys
  • QR Code Generation - Create QR codes with zero-knowledge proofs
  • Verification - Verify QR codes offline or online
  • Analytics - Track QR code usage and statistics
  • Error Handling - Comprehensive error handling with typed errors
  • Tracking - Built-in usage tracking (optional)
  • TypeScript Support - Full TypeScript definitions included

API Reference

Authentication

Login

await affixio.login({
  email: '[email protected]',
  password: 'your-password',
});

Logout

await affixio.logout();

Check Authentication

const isAuth = affixio.isAuthenticated();

QR Code Generation

Generate QR Code

const qrCode = await affixio.generateQRCode({
  verdict: 'YES' | 'NO',              // Required for static mode
  verification_mode: 'static' | 'hermes',
  time_limit_seconds: 86400,          // Optional, default: 86400 (24 hours)
  max_scans: 10,                      // Optional, null = unlimited
  qr_code_type: 'verification',       // Optional
  metadata: {                         // Optional
    name: 'QR Code Name',
    description: 'Description',
  },
  hermes_route_id: 'route-slug',      // Required for hermes mode
  store_image: true,                   // Optional, default: true
});

List QR Codes

const qrCodes = await affixio.getQRCodes();

Get QR Code by ID

const qrCode = await affixio.getQRCode(123);

Revoke QR Code

await affixio.revokeQRCode(123);

Verification

Verify QR Code

const result = await affixio.verifyQRCode('token-hash', zkProof);
// or
const result = await affixio.verification.verifyByURL('https://www.affix-io.com/verify/qr/token-hash');

Analytics

Get Statistics

const stats = await affixio.getAnalytics();
console.log('Total QR Codes:', stats.total_qr_codes);
console.log('Total Scans:', stats.total_scans);

Error Handling

The SDK provides typed error classes:

const { AffixIOError, AffixIOAuthError, AffixIOAPIError } = require('@affixio/sdk');

try {
  await affixio.generateQRCode({ verdict: 'YES' });
} catch (error) {
  if (error instanceof AffixIOAuthError) {
    console.error('Authentication failed:', error.message);
  } else if (error instanceof AffixIOAPIError) {
    console.error('API error:', error.message, error.statusCode);
  } else {
    console.error('Unknown error:', error.message);
  }
}

Configuration

Options

const affixio = new AffixIO({
  apiBaseUrl: 'https://www.affix-io.com',  // Optional, default: https://www.affix-io.com
  apiKey: 'your-api-key',                   // Optional, for API key auth
  email: '[email protected]',                   // Optional, for login
  password: 'your-password',                 // Optional, for login
  enableTracking: true,                      // Optional, default: true
  trackingId: 'custom-id',                   // Optional, auto-generated if not provided
});

Examples

Complete Example

const AffixIO = require('@affixio/sdk');

async function main() {
  // Initialize
  const affixio = new AffixIO({
    email: '[email protected]',
    password: 'your-password',
  });

  // Login
  await affixio.login();
  console.log('Logged in successfully');

  // Generate QR Code
  const qrCode = await affixio.generateQRCode({
    verdict: 'YES',
    verification_mode: 'static',
    time_limit_seconds: 3600, // 1 hour
    metadata: {
      name: 'Event Ticket',
      description: 'VIP Access',
    },
  });

  console.log('QR Code generated:', qrCode.qr_code.id);
  console.log('Token Hash:', qrCode.token_hash);
  console.log('Expires At:', qrCode.qr_code.expires_at);

  // Verify QR Code
  const verification = await affixio.verifyQRCode(qrCode.token_hash);
  console.log('Verified:', verification.verified);
  console.log('Verdict:', verification.verdict);

  // Get Analytics
  const stats = await affixio.getAnalytics();
  console.log('Total QR Codes:', stats.total_qr_codes);
  console.log('Total Scans:', stats.total_scans);

  // Logout
  await affixio.logout();
  console.log('Logged out');
}

main().catch(console.error);

License

MIT

Support

For support, visit https://www.affix-io.com or email [email protected]