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

@serenity-kit/noble-sodium

v0.2.3

Published

TypeScript library offering a Libsodium-compatible API built on top of Noble packages

Readme

NobleSodium

A TypeScript library offering a Libsodium-compatible API built on top of Noble Packages.

Why this library?

Libsodium is a modern, easy-to-use software library implementing best practices in cryptography and used in many applications. It even offers a JavaScript compile target leveraging WebAssembly. However, the use of WebAssembly has a few drawbacks:

  • No code-splitting
  • It's not supported in all environments (ReactNative)

Even Libsodium's author Frank Denis mentioned:

libsodium.js was a nice contribution, but honestly, for crypto in JavaScript today, I'd rather use WebCrypto when possible, and Noble cryptography for everything else.

Source: https://github.com/jedisct1/libsodium.js/issues/327#issuecomment-1793419292

That said, switching to Noble Packages isn’t without its challenges. Noble is more low level and therefor doesn't offer high level constructions like Sealed Boxes. Hence this library. It offers functions compatible with Libsodium but leverages Noble for the actual cryptography.

Installation

npm install @serenity-kit/noble-sodium

How to use

import { cryptoBoxKeyPair } from "@serenity-kit/noble-sodium";

const keypair = cryptoBoxKeyPair();

For more examples see the tests.

API changes compared to libsodium-wrappers

  • Instead of accepting multiple parameters, objects are used. This is to avoid accidentally passing wrong parameters.
  • Instead of using underscores, camelCase is used.
  • TypeScript out of the box.

Function mapping

  • cryptoBoxKeyPair -> crypto_box_keypair

  • cryptoBoxEasy -> crypto_box_easy

  • cryptoBoxOpenEasy -> crypto_box_open_easy

  • cryptoSignKeyPair -> crypto_sign_keypair

  • cryptoSignDetached -> crypto_sign_detached

  • cryptoSignVerifyDetached -> crypto_sign_verify_detached

  • cryptoBoxSeal -> crypto_box_seal

  • cryptoBoxSealOpen -> crypto_box_seal_open

Drop-in replacement for libsodium-wrappers

As an alternative to the root export, the library exports a wrappers module that is a drop-in replacement for libsodium-wrappers. Keep in mind that not yet all functionality e.g. outputFormat as "hex" is available. Feel free to open a PR or an issue if you need certain functionality.

import * as sodium from "@serenity-kit/noble-sodium/wrappers";

const keypair = sodium.crypto_box_keypair();

Notable findings

  • crypto_box_easy does a hsalsa on the shared secret and then uses the result as key for the box
  • Libsodium signing private key is: [ private_key (32 bytes) ‖ public_key (32 bytes) ]

Performance compared to libsodium-wrappers

While libsodium-wrappers is faster, the performance difference is only a few x. See more on this blog post: https://www.nikgraf.com/blog/choosing-a-cryptography-library-in-javascript-noble-vs-libsodium-js

How is compatiblity with Libsodium verified?

In the tests functions from noble-sodium and libsodium-wrappers are used interchangeably to verify compatibility.

License

MIT