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

bip322-verifier

v0.1.2

Published

BIP-322 Bitcoin message signature verification using WebAssembly

Readme

bip322-verifier

A JavaScript/TypeScript library for verifying BIP-322 Bitcoin signed messages. The cryptographic verification runs in a Go-compiled WebAssembly module and works in both Node.js and browsers.

Supports P2WPKH, P2SH-P2WPKH, P2TR (Taproot), and multisig address types.

Prerequisites

Building

Install npm dependencies, then build the WASM module and JS wrapper:

npm install
npm run build

This runs two steps under the hood:

  1. npm run build:wasm - Compiles main.go to bip322.wasm using GOOS=js GOARCH=wasm.
  2. npm run build:js - Inlines the Go WASM runtime, bundles the TypeScript source with tsup, and copies bip322.wasm into dist/.

Usage

Node.js / TypeScript

npm install bip322-verifier
import { verifyMessage } from 'bip322-verifier';

const result = await verifyMessage(
  'Hello World',                                    // message
  'bc1q9vza2e8x573nczrlzms0wvx3gsqjx7vavgkx0l',   // address
  'AkcwRAIgZRfIY3p7/DoVTty6YZbWS71bc5Vct9p9Fia83eRmw2QCICK' +
  '/ENGfwLtptFluMGs2KsqoNSk89pO7F29zJLUx9a/sASECx/EgAxlkQp' +
  'Q9hYjgGu6EBCPMVPwVIVJqO4XCsMvViHI=',            // signature (base64)
  'mainnet',                                         // network (optional)
);

console.log(result.valid); // true
console.log(result.error); // undefined when valid

Browser

Serve example.html, wasm_exec.js, and bip322.wasm from the same directory with any HTTP server:

npm run build:wasm
python3 -m http.server 8080
# open http://localhost:8080/example.html

Custom WASM loading

You can pre-initialize the WASM module with a custom source by calling init before verifyMessage:

import { init, verifyMessage } from 'bip322-verifier';

// From a URL
await init('/assets/bip322.wasm');

// From an ArrayBuffer
const buf = await fetch('/assets/bip322.wasm').then(r => r.arrayBuffer());
await init(buf);

// From a fetch Response (uses streaming compilation)
await init(fetch('/assets/bip322.wasm'));

API

verifyMessage(message, address, signature, network?)

Verify a BIP-322 signed message.

| Parameter | Type | Description | |-------------|----------|---------------------------------------------------------------------------------------------------| | message | string | The message that was signed. | | address | string | The Bitcoin address to verify against. | | signature | string | The base64-encoded BIP-322 signature. | | network | string | Optional. "mainnet" (default), "testnet3", "testnet4", "signet", "regtest", or "simnet". |

Returns Promise<{ valid: boolean; error?: string }>.

init(wasmSource?)

Explicitly initialize the WASM module. Called automatically on the first verifyMessage() call. Accepts an optional ArrayBuffer, Response, or URL string.

Testing

Tests run against the BIP-322 test vectors:

npm run build
npm test

License

MIT