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

@avetrust/node

v0.1.1

Published

SDK Node.js officiel d'AveTrust — vérification d'identité (eKYC) : sessions, résultats, webhooks signés, sandbox.

Readme

@avetrust/node

SDK Node.js officiel d'AveTrust — vérification d'identité de niveau forensique (eKYC). Sessions de vérification, résultats, webhooks signés, et sandbox intégré.

Installation

npm i @avetrust/node

Node ≥ 18 (utilise fetch et crypto natifs, zéro dépendance runtime).

Démarrage rapide

import { AveTrust } from "@avetrust/node";

const av = new AveTrust("sk_test_…"); // clé test → sandbox (gratuit, déterministe)

// 1. Créer une vérification et envoyer le lien hébergé au client
const v = await av.verifications.create({
  checks: ["DOCUMENT", "LIVENESS", "FACE_MATCH"],
  callbackUrl: "https://mon-app/kyc/webhook",
  simulate: "approved", // ignoré hors sandbox
});

await av.verifications.sendLink(v.id, {
  channel: "EMAIL",
  to: "[email protected]",
  link: `https://verify-test.avetrust.net/s/${v.token}`,
});

Recevoir le résultat (webhook)

Vérifiez toujours la signature avant de faire confiance à un événement :

import express from "express";
const app = express();

// Corps BRUT indispensable pour la signature
app.post("/kyc/webhook", express.raw({ type: "application/json" }), (req, res) => {
  let event;
  try {
    event = av.webhooks.constructEvent(
      req.body, // Buffer brut
      req.header("X-AveTrust-Signature"),
      process.env.AVETRUST_WEBHOOK_SECRET!
    );
  } catch {
    return res.status(400).send("signature invalide");
  }

  if (!event.livemode) return res.sendStatus(200); // événement sandbox → ignoré en prod

  if (event.data.decision?.outcome === "APPROVED") {
    activateAccount(event.data.externalUserId);
  }
  res.sendStatus(200);
});

Suivi en temps réel (SSE, sans polling)

const { token } = await av.verifications.create({ checks: ["DOCUMENT", "LIVENESS"] });

const result = await av.verifications.stream(token, {
  onProgress: (e) => console.log("étape :", e.step),
  onStatus:   (e) => console.log("statut :", e.status),
});
console.log("verdict :", result.status); // APPROVED | REVIEW | REJECTED

Le serveur pousse les mises à jour ; la promesse se résout au verdict final. Passez un signal (AbortSignal) pour interrompre.

Sandbox

Une clé sk_test_… place tout en mode bac à sable : aucun appel réel, gratuit, non facturé, et le verdict est déterministe via simulate (approved | review | rejected). Les webhooks partent avec livemode: false.

const av = new AveTrust("sk_test_…");
console.log(av.isTestMode); // true
const v = await av.verifications.create({ checks: ["DOCUMENT"], simulate: "rejected" });

Erreurs typées

import { AuthenticationError, RateLimitError, AveTrustError } from "@avetrust/node";

try {
  await av.verifications.create();
} catch (err) {
  if (err instanceof AuthenticationError) { /* clé invalide */ }
  else if (err instanceof RateLimitError) { /* quota */ }
  else if (err instanceof AveTrustError) { console.error(err.code, err.status, err.requestId); }
}

API

| Méthode | Description | |---|---| | verifications.create(params) | Crée une session (renvoie id + token) | | verifications.retrieve(id) | Résumé d'une session | | verifications.result(id) | Résultat complet (checks + décision) | | verifications.list(params) | Liste paginée (filtre status, test) | | verifications.stream(token, handlers) | Suivi temps réel (SSE), résout au verdict final | | verifications.sendLink(id, {channel, to, link}) | Envoie le lien hébergé | | verifications.decide(id, outcome, note?) | Décision manuelle (revue) | | apiKeys.list() / create(name, env) / revoke(id) | Gestion des clés | | webhooks.constructEvent(payload, sig, secret) | Vérifie + parse un webhook |

Options

new AveTrust("sk_live_…", {
  baseUrl: "https://api-test.avetrust.net/api/v1", // défaut
  timeout: 30_000,
  maxRetries: 2, // reprises sur 429 / 5xx
});

Licence

© AveTrust — usage réservé.