New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@vex-chat/crypto

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vex-chat/crypto

Crypto primitives for the Vex encrypted chat platform

latest
Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
731
-22.81%
Maintainers
2
Weekly downloads
 
Created
Source

@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

FAQs

Package last updated on 15 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts