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

@archonite/archonite-signed-payload

v0.1.0

Published

Secure payload encryption in compliance to Archonite Signed Payload protocol.

Readme

@archonite/archonite-signed-payload

A high-performance, security-hardened library for serializing, encrypting, and transmitting JSON data. It combines Google Protobuf for compact serialization, Argon2id for password-based key derivation, and AES-256-GCM for authenticated encryption.


🛡️ Security Architecture

The library follows a strict cryptographic pipeline to ensure data integrity and confidentiality:

  1. Serialization: JSON is converted to a binary Protobuf structure to reduce size and enforce schema consistency.
  2. Key Derivation: Uses Argon2id (the winner of the Password Hashing Competition) with a 64MB memory cost to derive a 256-bit key, making brute-force attacks extremely expensive.
  3. Encryption: Uses AES-256-GCM (Galois/Counter Mode). This provides Authenticated Encryption, ensuring that if even a single bit of the payload is tampered with, decryption will fail.
  4. Binding: The salt is bound to the ciphertext as AAD (Additional Authenticated Data), preventing salt-substitution attacks.

🚀 Features

  • Compact Binary Format: Leverages Protobuf for smaller over-the-wire payloads compared to raw JSON.
  • Time-Limited Access: Built-in expiration validation. Decryption fails automatically if the payload has expired.
  • Hardened KDF: Protects against GPU/ASIC cracking attempts using Argon2id.
  • Tamper Proof: Authenticated encryption ensures data has not been modified in transit.
  • TypeScript Ready: Full type safety and IDE autocompletion.

📦 Installation

npm install @archonite/archonite-signed-payload

Note: This package requires argon2 as a peer dependency. Ensure your environment supports building native C++ modules.


🛠️ Usage

1. Create and Encrypt a Payload

Use this on the client or the service generating the secure message.

import { createArchonitePayload } from '@archonite/archonite-signed-payload';

// 1 hour from now
const expiration = new Date(Date.now() + 1000 * 60 * 60);

const passphrase = "a-very-strong-secret-phrase";
const data = {
  userId: "user_01HRA",
  action: "SYSTEM_ACCESS",
  permissions: ["read", "write"]
};

const encryptedPayload = await createArchonitePayload(
  passphrase,
  expiration,
  data
);
console.log(encryptedPayload);

2. Decode and Verify a Payload

Use this on the receiving server to validate and read the data.

import { decodeArchonitePayload } from '@archonite/archonite-signed-payload';

try {
  const decryptedData = await decodeArchonitePayload(
    passphrase,
    encryptedPayload
  );

  // "user_01HRA"
  console.log(decryptedData.userId);
} catch (error) {
  // Fails if: wrong passphrase, tampered data, or payload expired
  console.error("Access Denied:", error.message);
}

3. Transmit to an API

A utility function to POST the payload with the correct headers.

import { sendArchonitePayload } from '@archonite/archonite-signed-payload';

const result = await sendArchonitePayload(
  'https://api.example.com/secure-endpoint',
  encryptedPayload
);

📊 Binary Structure

The generated string is a Base64 encoding of the following binary sequence:

| Offset (Bytes) | Length | Component | Description | | --- | --- | --- | --- | | 0 | 7 | Prefix | Magic bytes: ARCHON- | | 7 | 16 | Salt | Random salt for Argon2id | | 23 | 32 | IV | Initialization Vector for AES | | 55 | 16 | Tag | GCM Authentication Tag | | 71 | Variable | Ciphertext | AES-256-GCM Encrypted Protobuf |


⚙️ Configuration Constants

The library uses the following security parameters:

  • KDF: Argon2id
  • Memory Cost: 64 MB ( KB)
  • Time Cost: 3 iterations
  • Parallelism: 1
  • Cipher: AES-256-GCM
  • IV Length: 32 bytes (High entropy)

📄 License

MIT © Archonite Organization