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

@ar-agents/identity-attest

v0.4.2

Published

Identity attestation pattern for AI agents — orchestrate verification flows (WhatsApp OTP, email magic link, Auth0, MercadoPago Identity, SID gov) and get back a signed attestation with a trust level. The RENAPER workaround that lets agents do KYC without

Readme

@ar-agents/identity-attest

The "RENAPER workaround" pattern. Orchestrate identity verification (WhatsApp OTP, email magic-link, Auth0, MercadoPago Identity, SID gov) and get back a signed attestation with a trust level. Designed for AI agents that need to do KYC without institutional API access.

npm License: MIT

The problem

RENAPER (the Argentine national identity registry) is closed to indie devs: $60/transaction, requires formal institutional agreement. There is no public API for "is this person who they say they are" in Argentina.

The pattern

The agent doesn't verify directly. It orchestrates the user proving themselves via a third-party provider (WhatsApp OTP, email magic-link, Auth0, etc.) and receives a cryptographically-signed Attestation with a trustLevel (0..1). The agent then decides if the trust is sufficient for the action requested.

Think of it as: agent acts as the verifier of verifiers, not the verifier itself.

Install

pnpm add @ar-agents/identity-attest ai zod

Quick start

import { Experimental_Agent as Agent, stepCountIs } from "ai";
import {
  AttestationClient,
  identityAttestTools,
  WhatsAppOtpAdapter,
  EmailMagicLinkAdapter,
} from "@ar-agents/identity-attest";
import { WhatsAppClient } from "@ar-agents/whatsapp";

const wa = new WhatsAppClient({
  accessToken: process.env.WA_ACCESS_TOKEN!,
  phoneNumberId: process.env.WA_PHONE_NUMBER_ID!,
});

const attestation = new AttestationClient({
  signingSecret: process.env.ATTEST_SIGNING_SECRET!, // openssl rand -hex 32
  adapters: {
    whatsapp_otp: new WhatsAppOtpAdapter({
      whatsappClient: wa,
      businessName: "LautaroSaaS",
    }),
    email_magic_link: new EmailMagicLinkAdapter({
      sender: async ({ to, subject, html }) => {
        // Your email provider here (Resend / SES / SMTP)
        await resend.emails.send({ from: "[email protected]", to, subject, html });
      },
      callbackBaseUrl: "https://yourapp.com/api/identity-attest/callback",
      businessName: "LautaroSaaS",
    }),
  },
});

const agent = new Agent({
  model: "anthropic/claude-sonnet-4-6",
  instructions: `Sos el asistente de billing. Para cobros > $20.000 requerís
trust >= 0.5 (email verificado). Para > $100.000 requerís 0.85+.
Si el usuario no tiene attestation suficiente, kickeá un verification flow.`,
  tools: identityAttestTools(attestation),
  stopWhen: stepCountIs(8),
});

The two flow shapes

OTP (WhatsApp / SMS / Email OTP)

agent → request_identity_verification(method="whatsapp_otp", subject=phone)
          → adapter sends 6-digit code via WhatsApp
agent → "Te mandé un código por WhatsApp, decime cuando lo recibas"
user → "el código es 482917"
agent → submit_otp_code(request_id, "482917") → returns Attestation

Magic-link (Email)

agent → request_identity_verification(method="email_magic_link", subject=email)
          → adapter sends magic-link email
agent → "Te mandé un mail con un link, hacé click ahí"
user clicks link → handleAttestationCallback() validates token, signs attestation
agent (polling) → check_verification_status(request_id) → status="verified"

Wire the magic-link callback

// app/api/identity-attest/callback/route.ts (Next.js app router)
import { NextRequest, NextResponse } from "next/server";
import { handleAttestationCallback } from "@ar-agents/identity-attest";
import { attestation } from "@/lib/attestation";

export async function GET(req: NextRequest) {
  const result = await handleAttestationCallback({
    query: Object.fromEntries(new URL(req.url).searchParams),
    client: attestation,
  });
  if (result.kind === "verified") {
    return new NextResponse(
      "<h1>Verificado ✓</h1><p>Volvé al chat.</p>",
      { headers: { "Content-Type": "text/html" } },
    );
  }
  return new NextResponse(`<h1>Error: ${result.reason}</h1>`, {
    status: 400,
    headers: { "Content-Type": "text/html" },
  });
}

Trust levels

| Trust | Adapter | Proves | |---|---|---| | 0.3 | WhatsAppOtpAdapter | Controls a phone number right now | | 0.5 | EmailMagicLinkAdapter | Controls an email right now | | 0.7 | Auth0 / Cognito (planned for v0.2) | Has account at federated IdP | | 0.85 | MercadoPago Identity (planned for v0.3) | Passed MP KYC | | 0.95 | SID gov (planned, blocked on rollout) | Official identity |

Tools provided

| Tool | Purpose | |---|---| | list_verification_methods | Returns registered adapters with trust levels | | request_identity_verification | Start a verification flow | | submit_otp_code | Submit OTP the user dictated back | | check_verification_status | Poll status (for magic-link flows) | | get_attestation | Fetch signed attestation for a completed verification |

See AGENTS.md for when to use each.

Persistence

Default InMemoryAttestationStore is fine for dev / single-process. For production / serverless, implement AttestationStore:

import type { AttestationStore } from "@ar-agents/identity-attest";

class RedisAttestationStore implements AttestationStore {
  async saveRequest(request, internal) { /* ... */ }
  async updateRequest(requestId, patch) { /* ... */ }
  async getRequest(requestId) { /* ... */ }
  async saveAttestation(attestation) { /* ... */ }
  async getAttestation(requestId) { /* ... */ }
  async listAttestationsForSubject(type, value) { /* ... */ }
}

const attestation = new AttestationClient({
  signingSecret: process.env.ATTEST_SIGNING_SECRET!,
  adapters: { ... },
  store: new RedisAttestationStore({ ... }),
});

Adapters provided

  • WhatsAppOtpAdapter: OTP via WhatsApp Cloud API (uses @ar-agents/whatsapp)
  • EmailMagicLinkAdapter: magic link via your email provider (Resend / SES / SMTP: pluggable sender)

Building your own adapter is ~50 lines: implement the AttestAdapter interface (3 methods).

Roadmap

  • v0.2: Auth0Adapter, CognitoAdapter, MagicLinkSdkAdapter
  • v0.3: MercadoPagoIdentityAdapter (uses MP's KYC level data)
  • v0.x: SidGovAdapter when AR's SID API opens to private dev access

License

MIT: © Nazareno Clemente

Stability

This package is pre-1.0. Per npm convention, 0.x minor versions may include breaking changes. We document every breaking change in CHANGELOG.md under the corresponding minor bump and flag it explicitly. To avoid surprises:

# Pin to exact version (recommended for production):
pnpm add @ar-agents/<package>@<exact-version>

We commit to no breaking changes within a patch version, and we publish 1.0.0 once the public API has stabilized across at least two consecutive minor releases.