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

@boletix/bu-verify

v0.1.0

Published

Verify the signature and certificate chain of Brazilian boletins de urna (TSE) with WebCrypto.

Readme

@boletix/bu-verify

Verify that a Brazilian boletim de urna (BU) was signed by the voting machine that printed it, the same check TSE's official "Boletim na Mão" app does. Runs in browsers, Node, Deno and Cloudflare Workers: SHA-2 and ECDSA P-521 use WebCrypto, Ed521 uses @boletix/ed521.

Reading the QR codes is @boletix/bu-qr's job; this package takes its output.

Install

npm install @boletix/bu-verify @boletix/bu-qr

Usage

import { assembleBu, assembleCertificate } from "@boletix/bu-qr";
import { verifyBu } from "@boletix/bu-verify";
import { TSE_ROOTS } from "@boletix/bu-verify/roots";

const bu = await assembleBu(parts); // checks the HASH chain
const certificate = assembleCertificate(certs);

const { algorithm, root } = await verifyBu(bu, certificate, TSE_ROOTS);
// algorithm: "ed521" (MDUE 2020+) or "ecdsa-p521" (MDUE 2013/2015); root: e.g. "AC UE2020"

verifyBu checks, in order:

  1. the BU carries a signature (ASSI);
  2. the certificate is X.509 with an Ed521 or ECDSA key;
  3. its subject is this BU's urna (CN UEAO0<IDUE>);
  4. it was issued by one of roots;
  5. ASSI signs the BU's HASH under it.

Every failure throws a VerificationError with a stable code and a human-readable detail:

| Code | Meaning | | ----------------------- | ----------------------------------------------------------------- | | SIGNATURE_MISSING | The BU has no ASSI field. | | CERT_INVALID | Not an X.509 certificate, or not issued by any of roots. | | UNSUPPORTED_ALGORITHM | The certificate key is neither Ed521 nor ECDSA. | | CERT_URNA_MISMATCH | The certificate belongs to another urna. | | SIGNATURE_INVALID | ASSI does not sign HASH (tampered, malformed or from another BU). |

A pinned root whose DER does not match its sha256 throws a plain Error: that is a configuration bug, not a property of the BU.

Trust model

TSE_ROOTS (@boletix/bu-verify/roots) are the certification authorities embedded in the official app, pinned by SHA-256 and trusted directly: AC URNA (ECDSA P-521), AC UE2020 and AC UE2022 (Ed521). Like the official app, validity periods are not enforced: AC URNA expired on 2026-07-18 and still certifies the older urnas used in the 2026 elections.

Pass your own TrustedRoot[] to trust a different set.

API

| Export | Description | | ---------------------------------- | -------------------------------------------------------------------------------------- | | verifyBu(bu, certificate, roots) | Async. Resolves { algorithm, root } or throws VerificationError. | | VerificationError | code: VerificationErrorCode, detail: string. | | TSE_ROOTS (from /roots) | Frozen TrustedRoot[]: { name, sha256, derBase64, source }. | | Types | TrustedRoot, SignatureVerification, SignatureAlgorithm, VerificationErrorCode. |

License

BSD-3-Clause