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

@vex-chat/crypto

v2.0.1

Published

Crypto primitives for the Vex encrypted chat platform

Downloads

1,619

Readme

@vex-chat/crypto

npm CI Released License Types Type Coverage Node OpenSSF Scorecard Socket

Crypto primitives for the Vex encrypted chat platform. Sign, encrypt, hash, derive keys, and encode bytes — everything the client and server need to speak the protocol.

What's in the box

  • Key generationxBoxKeyPair() / xSignKeyPair() / xSignKeyPairFromSecret() / xBoxKeyPairFromSecret() for X25519 (box) and Ed25519 (sign) keypairs (tweetnacl).
  • SigningxSign() / xSignOpen() over arbitrary bytes (Ed25519, tweetnacl).
  • Authenticated encryptionxSecretbox() / xSecretboxOpen() (XSalsa20-Poly1305 secretbox) and xDH() (X25519 scalar mult) via tweetnacl.
  • Hashing & KDFxHash() (SHA-512 hex via @noble/hashes), xKDF() (HKDF-SHA-512 via @noble/hashes), xHMAC() (HMAC-SHA-256 via @noble/hashes), and XUtils.encryptKeyData / decryptKeyData (PBKDF2-SHA-512 + tweetnacl secretbox).
  • Curve key encodingxEncode() prefixes a 32-byte X25519 public key for the wire format (not msgpack).
  • Msgpack framingXUtils.packMessage() / unpackMessage() wrap a 32-byte header + msgpack body (msgpackr); unpackMessage validates base fields with Zod.
  • Text & byte encodingXUtils hex/base64/UTF-8 helpers (@stablelib/base64, @stablelib/utf8).
  • MnemonicsxMnemonic() (BIP39 via bip39).
  • UtilitiesxConcat(), xMakeNonce(), xRandomBytes(), XUtils.bytesEqual (constant-time when lengths match), and XKeyConvert (Ed25519 ↔ X25519 via ed2curve).

HKDF, PBKDF2, HMAC, and SHA-512 / SHA-256 all run through @noble/hashes. tweetnacl supplies CSPRNG, box, sign, and secretbox.

Install

npm install @vex-chat/crypto

@vex-chat/types is a peer dependency — install it alongside if you don't already have it:

npm install @vex-chat/types @vex-chat/crypto

Usage

import {
    xBoxKeyPair,
    xSignKeyPair,
    xSign,
    xSignOpen,
    xSecretbox,
    xSecretboxOpen,
    xDH,
    xMakeNonce,
    XUtils,
} from "@vex-chat/crypto";

// Generate identity keys
const signKeys = xSignKeyPair();
const boxKeys = xBoxKeyPair();

// Sign a message (returns 64-byte signature prefix + message)
const message = XUtils.encodeUTF8("hello vex");
const signed = xSign(message, signKeys.secretKey);
const opened = xSignOpen(signed, signKeys.publicKey);

// Derive a shared secret and encrypt
const shared = xDH(boxKeys.secretKey, otherPartyPublicKey);
const nonce = xMakeNonce();
const ciphertext = xSecretbox(message, nonce, shared);

// Decrypt
const plaintext = xSecretboxOpen(ciphertext, nonce, shared);

// Msgpack wire body (32-byte header + msgpack); see XUtils.packMessage / unpackMessage
const wire = XUtils.packMessage({
    type: "success",
    transmissionID: "abc",
    data: null,
});
const [, body] = XUtils.unpackMessage(wire);

API documentation

HTML and JSON API reference is generated from TSDoc on src/index.ts:

npm run docs

Output is written to ./docs/ (gitignored). CI runs the same generator with --treatWarningsAsErrors.

License

AGPL-3.0-or-later