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

mochimo-wots

v1.2.7

Published

TypeScript implementation of Mochimo WOTS for v3

Downloads

9

Readme

Mochimo WOTS v2

A TypeScript implementation of Mochimo's Winternitz One-Time Signature (WOTS) scheme.

Overview

This library provides a TypeScript implementation of the WOTS signature scheme used in the Mochimo cryptocurrency. WOTS is a post-quantum secure one-time signature scheme that is resistant to attacks from quantum computers.

Installation

npm install mochimo-wots-v2

Features

  • TypeScript implementation of Mochimo's WOTS v2
  • Post-quantum secure signatures
  • Byte buffer utilities for efficient byte operations
  • Comprehensive test coverage
  • One external runtime dependency (@noble/hashes)

Usage

WOTS Operations

import { WOTS, ByteUtils } from 'mochimo-wots-v2';
//Generate a valid wots address
 const sourcePK = new Uint8Array(2144);
 const sourcePubSeed = new Uint8Array(32).fill(0x12); //use some deterministic seed in real scenarios
 const sourceRnd2 = new Uint8Array(32).fill(0x34);
 WOTS.wots_pkgen(sourcePK, sourceSecret, sourcePubSeed, 0, sourceRnd2);

const sourceAddress = new Uint8Array(2208);
sourceAddress.set(sourcePK, 0);
sourceAddress.set(sourcePubSeed, 2144);
sourceAddress.set(sourceRnd2, 2176);
//Note that this address is valid but is not tagged. To tag the address, use the Tag.tag function
const tagBytes = new Uint8Array(12).fill(0x12);
const taggedSourceAddr = Tag.tag(sourceAddress, tagBytes);

Advanced WOTS Usage

// Custom components generator for deterministic addresses
function myComponentsGenerator(seed: Uint8Array) {
    // Generate deterministic components from seed
    return {
        private_seed: generatePrivateSeed(seed),
        public_seed: generatePublicSeed(seed),
        addr_seed: generateAddressSeed(seed)
    };
}

const secret = new Uint8Array(32).fill(0x12);
const tag = new Uint8Array(12).fill(0x34);

// Generate deterministic address
const address = WOTS.generateAddress(tag, secret, myComponentsGenerator);

// Validate address
const privateSeed = myComponentsGenerator(secret);
const isValid = WOTS.isValid(privateSeed, address);
console.log('Address valid:', isValid);

Byte Buffer Operations

import { ByteBuffer, ByteOrder } from 'mochimo-wots-v2';

// Create a new buffer
const buffer = ByteBuffer.allocate(1024);

// Write data
buffer.order(ByteOrder.LITTLE_ENDIAN)
      .putInt(0x12345678)
      .put(new Uint8Array([1, 2, 3, 4]));

// Read data
const data = new Uint8Array(4);
buffer.rewind().get(data);

Creating a WOTS Wallet

import { WOTSWallet } from 'mochimo-wots-v2';

// Create a secret (32 bytes)
const secret = new Uint8Array(32).fill(0x56); //simple example secret
const tag = new Uint8Array(12).fill(0x34); //simple example tag
//create the wallet
const wallet = WOTSWallet.create("Test Wallet", secret, tag);


// Get the public key (2208 bytes)
const address = wallet.getAddress();
console.log('Address:', wallet.getAddressHex());

// Get the tag
console.log('Tag:', wallet.getTagHex());

Signing and Verifying Messages

// Message to sign
const message = new TextEncoder().encode("Hello, Mochimo!");

// Sign the message
const signature = wallet.sign(message);

// Verify the signature
const isValid = wallet.verify(message, signature);
console.log('Signature valid:', isValid);

// Verify with modified message (should fail)
const modifiedMessage = new TextEncoder().encode("Hello, Modified!");
const isValidModified = wallet.verify(modifiedMessage, signature);
console.log('Modified message valid:', isValidModified); // false

Important Notes

  1. WOTS is a one-time signature scheme - each private key should only be used to sign once
  2. The secret is used to deterministically generate the actual signing key
  3. The address contains the public key and verification components
  4. Tags are optional and can be used to categorize addresses

Development

Setup

# Install dependencies
pnpm install

Testing

# Run all tests
pnpm test

# Run tests with coverage
pnpm test:coverage

Building

# Build the project
pnpm build

Project Structure

src/
├── hasher/         # Hashing implementations
├── protocol/       # WOTS protocol implementation
├── types/          # TypeScript type definitions
└── utils/          # Utility functions

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

MIT License - see LICENSE file for details.

Related

  • Mochimo - The Mochimo Cryptocurrency