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

@teko13/certiscan

v1.0.11

Published

JavaScript library for decoding and verifying French 2D-Doc QR codes (ANTS specification)

Downloads

577

Readme

CertiScan - Décodage de QR codes 2D-Doc

npm version License: MIT

Bibliothèque JavaScript pour le décodage et la vérification de QR codes 2D-Doc conformes aux spécifications ANTS françaises.

Installation

Via npm (recommandé)

npm install @teko13/certiscan

Installation locale (développement)

git clone https://github.com/teko13/certiscan.git
cd certiscan
npm install

Utilisation

CertiScan peut être utilisé de plusieurs façons :

1. Utilisation en ligne de commande

Avec npx (recommandé)

npx @teko13/certiscan "VOTRE_CHAINE_2D_DOC_ICI"

Installation globale

npm install -g @teko13/certiscan
certiscan "VOTRE_CHAINE_2D_DOC_ICI"

Installation locale

node src/scan.js "VOTRE_CHAINE_2D_DOC_ICI"

Cette commande affichera un JSON structuré contenant :

  • success : booléen indiquant si le décodage a réussi
  • error : message d'erreur si le décodage a échoué
  • header : objet avec les informations d'en-tête (version, ca_id, cert_id, etc.)
  • message : objet avec les données extraites (dataset)
  • signature : objet avec les informations de validation de la signature

2. Utilisation comme dépendance dans un projet

Import ES6

import { decoderQrCode } from "@teko13/certiscan";

// Décoder un QR code 2D-Doc
const result = decoderQrCode("VOTRE_CHAINE_2D_DOC_ICI");

if (result.success) {
  console.log("Décodage réussi !");
  console.log("En-tête :", result.header);
  console.log("Données :", result.message);
  console.log("Signature valide :", result.signature.valid);
} else {
  console.error("Erreur de décodage :", result.error);
}

Import CommonJS

const { decoderQrCode } = require("@teko13/certiscan");

const result = decoderQrCode("VOTRE_CHAINE_2D_DOC_ICI");
console.log(result);

3. API avancée

Pour un contrôle plus fin, vous pouvez utiliser directement les classes internes :

import { TwoDDoc, internal } from "@teko13/certiscan";

const doc = TwoDDoc.fromCode("VOTRE_CHAINE_2D_DOC_ICI");

console.log(doc.header.docType().userType);
console.log(doc.header.docType().emitterType);
console.log(doc.message.dataset);
console.log(doc.message.dataset[0].definition.name);
console.log(doc.message.dataset[0].value);

const chain = internal();
console.log(doc.header.caId);
console.log(doc.header.certId);
console.log(doc.signatureIsValid(chain));

Exemples d'utilisation

Exemple complet avec gestion d'erreurs

import { decoderQrCode } from "@teko13/certiscan";

async function processQRCode(qrCodeString) {
  try {
    const result = decoderQrCode(qrCodeString);

    if (result.success) {
      console.log("✅ Décodage réussi");
      console.log("📄 Type de document:", result.header.doc_type_id);
      console.log("📅 Date d'émission:", result.header.emit_date);
      console.log("🔐 Signature valide:", result.signature.valid);
      console.log("📊 Données:", result.message.dataset);

      return result;
    } else {
      console.error("❌ Erreur de décodage:", result.error);
      return null;
    }
  } catch (error) {
    console.error("💥 Erreur inattendue:", error);
    return null;
  }
}

// Utilisation
const qrCode = "VOTRE_CHAINE_2D_DOC_ICI";
processQRCode(qrCode);

Outils de développement

Outil de dump

Pour analyser les fichiers de test :

node src/dump.js src/samples/spec/3.1.3/15.2.2/17.txt

Tests

npm test

Liens utiles

  • Package npm : https://www.npmjs.com/package/@teko13/certiscan
  • Repository GitHub : https://github.com/teko13/certiscan
  • Documentation ANTS : https://ants.gouv.fr/

Limitations

Cette bibliothèque est une traduction fidèle de la bibliothèque Python originale. Certaines fonctionnalités peuvent être simplifiées ou pas entièrement implémentées dans la version JavaScript :

  • Le parsing des certificats est simplifié (nécessiterait un parsing ASN.1 approprié pour un usage en production)
  • La vérification de signature est une implémentation de base
  • Le support de certains formats binaires peut être limité

Licence

MIT