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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@proofage/node

v0.1.0

Published

Node.js client for ProofAge API with HMAC authentication and webhook verification

Readme

@proofage/node

Node.js client for the ProofAge API with HMAC request signing and webhook signature verification.

Requirements

  • Node.js 18+

Installation

npm install @proofage/node

Quick Start

Set your environment variables:

PROOFAGE_API_KEY=pk_live_...
PROOFAGE_SECRET_KEY=sk_live_...
# Optional:
# PROOFAGE_BASE_URL=https://api.proofage.xyz
# PROOFAGE_WEBHOOK_TOLERANCE=300

Create a client — keys resolve from env automatically:

import { ProofAgeClient } from '@proofage/node';

const client = new ProofAgeClient();

const workspace = await client.workspace().get();

const verification = await client.verifications().create({
  callback_url: 'https://your-app.com/verify/complete',  // optional
  metadata: { order_id: '123' },
});

Or pass config explicitly:

const client = new ProofAgeClient({
  apiKey: 'pk_live_...',
  secretKey: 'sk_live_...',
});

Configuration

All options fall back to environment variables, then to defaults.

| Option | Env var | Default | Description | |--------|---------|---------|-------------| | apiKey | PROOFAGE_API_KEY | — | Workspace API key | | secretKey | PROOFAGE_SECRET_KEY | — | Secret key for HMAC signing | | baseUrl | PROOFAGE_BASE_URL | https://api.proofage.xyz | API base URL | | version | PROOFAGE_VERSION | v1 | API version path segment | | timeout | PROOFAGE_TIMEOUT | 30000 | Request timeout (ms) | | retryAttempts | PROOFAGE_RETRY_ATTEMPTS | 3 | Retries for transient failures | | retryDelay | PROOFAGE_RETRY_DELAY | 1000 | Base delay between retries (ms) |

API Methods

  • client.workspace().get()GET /v1/workspace
  • client.workspace().getConsent()GET /v1/consent
  • client.verifications().create(body)POST /v1/verifications
  • client.verifications(id).get()GET /v1/verifications/{id}
  • client.verifications(id).acceptConsent(body)POST /v1/verifications/{id}/consent
  • client.verifications(id).uploadMedia({ type, file, filename })POST /v1/verifications/{id}/media (multipart)
  • client.verifications(id).submit()POST /v1/verifications/{id}/submit

Request bodies use snake_case keys to match the ProofAge API. callback_url is optional — if omitted, the verification result is available via polling or webhook.

Webhooks

ProofAge sends POST requests with HMAC headers:

| Header | Description | |--------|-------------| | X-Auth-Client | Your workspace API key | | X-HMAC-Signature | HMAC-SHA256 hex digest of {timestamp}.{rawJsonBody} | | X-Timestamp | Unix timestamp (seconds) |

Drop-in handler (recommended)

One-liner for Next.js App Router, Hono, Cloudflare Workers, or any framework with a standard Request:

import { webhookHandler } from '@proofage/node';

// Keys and tolerance resolve from env automatically
export const POST = webhookHandler(async (payload) => {
  console.log(payload.verification_id, payload.status);
  // your business logic: update DB, send email, etc.
});

Returns 200 on success, 401 on invalid signature, 400 on invalid JSON, 500 if your callback throws.

Manual verification

For full control or non-standard frameworks:

import { verifyWebhookSignature } from '@proofage/node';

const rawBody = await request.text();

verifyWebhookSignature({
  rawBody,
  signature: request.headers.get('x-hmac-signature'),
  timestamp: request.headers.get('x-timestamp'),
  authClient: request.headers.get('x-auth-client'),
  // apiKey and secretKey resolve from env if omitted
});

const payload = JSON.parse(rawBody);

Mid-level helper

handleWebhook() verifies + parses in one call, returns a result object:

import { handleWebhook } from '@proofage/node';

const { verified, payload, error } = await handleWebhook(request);
if (!verified) {
  return new Response(null, { status: 401 });
}
// payload is typed as WebhookPayload

CLI

Verify your setup from the terminal:

npx @proofage/node verify-setup

Reads PROOFAGE_API_KEY, PROOFAGE_SECRET_KEY, and PROOFAGE_BASE_URL from .env.local / .env automatically. Auto-skips TLS verification for local dev domains (.test, .local, localhost).

Errors

  • ProofAgeError — generic API error (includes statusCode and parsed error object when present)
  • AuthenticationError — HTTP 401
  • ValidationError — HTTP 422 (getErrors() returns field errors)
  • WebhookVerificationError — invalid or missing webhook signature / headers

License

MIT