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 🙏

© 2025 – Pkg Stats / Ryan Hefner

monocypher-wasm

v3.1.3-0

Published

WASM port of Monocypher (https://monocypher.org/)

Downloads

51

Readme

Monocypher WebAssembly Port

This is a Typescript+WASM port of Monocypher, a new cryptography library similar to libsodium. It consists of a WASM-compiled Monocypher library and a Typescript wrapper for functions exported by this library.

Most of Monocypher's functions are available, with the exception of the "incremental" functions that require counters or context pointers. The APIs of these functions have been changed to remove most length arguments, and to create and return output buffers directly rather than taking them as arguments.

Usage

Monocypher can be used from Node, Deno, and the browser:

// Node
const { crypto_blake2b } = require('monocypher-wasm');

// Deno
import { crypto_blake2b } from 'https://deno.land/x/[email protected]/mod.ts';

// Browser (only 24KB gzipped!)
import { crypto_blake2b } from 'https://raw.githubusercontent.com/ar-nelson/monocypher-wasm/v3.1.2-4/monocypher.min.js';

Unlike previous versions of this package, the API is synchronous, and no ready promise is needed. ready is still included for backward compatibility.

API

Note: An InputBuffer is either a Uint8Array, an array of numbers, or null.

crypto_blake2b(message: InputBuffer): Uint8Array
crypto_blake2b_general(hash_size: number, key: InputBuffer, message: InputBuffer): Uint8Array

crypto_chacha20(plain_text: InputBuffer, key: InputBuffer, nonce: InputBuffer): Uint8Array
crypto_xchacha20(plain_text: InputBuffer, key: InputBuffer, nonce: InputBuffer): Uint8Array

// crypto_curve_to_hidden returns null on failure
crypto_curve_to_hidden(curve: InputBuffer, tweak: number): Uint8Array | null
crypto_hidden_to_curve(hidden: InputBuffer): Uint8Array
crypto_hidden_key_pair(seed: InputBuffer): { hidden: Uint8Array, secret_key: Uint8Array }

crypto_from_eddsa_private(eddsa: InputBuffer): Uint8Array
crypto_from_eddsa_public(eddsa: InputBuffer): Uint8Array

crypto_hchacha20(key: InputBuffer, in_: InputBuffer): Uint8Array

crypto_ietf_chacha20(plain_text: InputBuffer, key: InputBuffer, nonce: InputBuffer): Uint8Array

crypto_key_exchange(your_secret_key: InputBuffer, their_public_key: InputBuffer): Uint8Array
crypto_key_exchange_public_key(your_secret_key: InputBuffer): Uint8Array

// crypto_unlock functions return null on failure
crypto_lock(key: InputBuffer, nonce: InputBuffer, plain_text: InputBuffer): Uint8Array
crypto_unlock(key: InputBuffer, nonce: InputBuffer, cipher_text: InputBuffer): Uint8Array | null
crypto_lock_aead(key: InputBuffer, nonce: InputBuffer, ad: InputBuffer, plain_text: InputBuffer): Uint8Array
crypto_unlock_aead(key: InputBuffer, nonce: InputBuffer, ad: InputBuffer, cipher_text: InputBuffer): Uint8Array | null

crypto_poly1305(message: InputBuffer, key: InputBuffer): Uint8Array

crypto_sign_public_key(secret_key: InputBuffer): Uint8Array
crypto_sign(secret_key: InputBuffer, public_key: InputBuffer, message: InputBuffer): Uint8Array
crypto_check(signature: InputBuffer, public_key: InputBuffer, message: InputBuffer): boolean

crypto_verify16(a: InputBuffer, b: InputBuffer): boolean
crypto_verify32(a: InputBuffer, b: InputBuffer): boolean
crypto_verify64(a: InputBuffer, b: InputBuffer): boolean

crypto_x25519(your_secret_key: InputBuffer, their_public_key: InputBuffer): Uint8Array
crypto_x25519_public_key(your_secret_key: InputBuffer): Uint8Array

crypto_x25519_dirty_fast(sk: InputBuffer): Uint8Array
crypto_x25519_dirty_small(sk: InputBuffer): Uint8Array

crypto_x25519_inverse(private_key: InputBuffer, curve_point: InputBuffer): Uint8Array

HASH_BYTES: 64
KEY_BYTES: 32
NONCE_BYTES: 24
MAC_BYTES: 16
CHACHA20_NONCE_BYTES: 8

Compilation and Testing

The repo contains the Deno (mod.ts) and browser (monocypher.min.js) modules. The Node module must be built with dnt.

The build process is defined in a GNU Makefile.

make will rebuild everything, including the Node module, and run tests in both Deno and Node. It will even redownload the Monocypher sources from monocypher.org.

make requires clang, lld, deno, npm, esbuild, curl, and a Unix environment.

License

Like Monocypher itself, this project is public domain, via the CC0 license.

This project contains code from wingo/walloc, which is available under a permissive MIT-style license.