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

@quantsafe/mcp

v0.1.1

Published

Post-quantum encryption for AI agents. MCP server with ML-KEM-768 + X25519 hybrid encryption and ML-DSA-65 signatures.

Readme

@quantsafe/mcp

Post-quantum encryption for AI agents. The same crypto core as quantsafe.tech, exposed as a Model Context Protocol server over stdio.

  • Hybrid KEM: ML-KEM-768 + X25519, combined with HKDF-SHA256
  • Signatures: ML-DSA-65, context-bound
  • Symmetric: AES-256-GCM, random nonces
  • Keyfiles wrapped with Argon2id

Everything runs locally. No network calls, no telemetry.

Install

Claude Desktop, Claude Code, Cursor or any MCP client:

{
  "mcpServers": {
    "qsafe": {
      "command": "npx",
      "args": ["-y", "@quantsafe/mcp"]
    }
  }
}

Requires Node.js 20 or later.

Tools

| Tool | What it does | | ----------------------- | --------------------------------------------------------------------------------------------------------------------------- | | qsafe_encrypt_file | Encrypt bytes under ML-KEM-768 + X25519, signed with ML-DSA-65 | | qsafe_decrypt_file | Decrypt a .qsafe blob with a keyfile or wallet signature | | qsafe_send_message | Wrap text in a shareable encrypted URL, optionally wallet-signed | | qsafe_decrypt_message | Read a message URL and return its text and the key that signed it | | qsafe_verify_seal | Read the fields a Quantum Seal PNG carries, unsigned and unchecked; given the envelope, compare its sha256 with file_hash | | qsafe_sign_x402 | Sign an x402 payload with ML-DSA-65 under context qsafe-v1-x402 |

Key sources

A tool that signs or decrypts takes one key source: a key file given as keyfile_path or keyfile_json, with its passphrase, or a wallet signature given as signature_hex + address, with an optional signature_hex_repeat. qsafe_encrypt_file and qsafe_send_message name them signer_keyfile_path, signer_keyfile_json, signer_passphrase, signer_signature_hex, signer_address and signer_signature_hex_repeat.

A key file without its passphrase, a passphrase without its key file, keyfile_path together with keyfile_json, a signature without its address (or the reverse), or a key file together with any wallet field returns an error. qsafe_encrypt_file and qsafe_send_message sign with a fresh ephemeral identity only when every signer field is omitted.

Key files

A key file is the .qsafekey file that quantsafe.tech/app saves: random post-quantum keys, wrapped with Argon2id and AES-256-GCM under your passphrase. It is the identity to give an agent.

Point the server at it with keyfile_path:

{ "keyfile_path": "~/.qsafe/agent.qsafekey", "passphrase": "..." }

The server reads the file from disk, so the key file never enters the conversation. The path is absolute or starts with ~/, and names a regular file of at most 64 KB. A path to anything else is refused with an error that never quotes the file.

keyfile_json takes the same key file inline, as the JSON object or as the file's text. Use it when the agent cannot reach the disk the server runs on.

The agent host and its model still see every tool argument, the passphrase included, and any plaintext a decrypt tool returns. With keyfile_path they hold the passphrase but not the key file; with keyfile_json they hold both.

Wallet signatures

signature_hex is a 65-byte EOA signature (0x + 130 hex characters) made with personal_sign (EIP-191) over this exact message: six lines joined by \n, no trailing newline.

QuantSafe keypair derivation v1

This signature derives your personal post-quantum encryption keypair.
It grants no permissions and costs no gas.

Domain: quantsafe.tech

It is the message the browser app at quantsafe.tech/app asks a wallet to sign, so the same wallet derives the same identity in both places. The tool descriptions quote it as a JSON string.

Before any key is derived, the server recovers the signer of that message from signature_hex and refuses the call unless it equals address. A signature over other text (CRLF line endings, a missing line), a signature paired with another address, a high-s copy of a valid signature or a smart-contract wallet signature is refused instead of silently deriving an identity no browser session can reproduce.

Keys are derived from all 65 bytes, the last one (v) included. viem, ethers and browser wallets such as MetaMask and Rabby return v as 27 or 28 (1b or 1c). Some signers return 0 or 1 instead (raw ECDSA libraries, KMS wrappers, some hardware paths). Pass the signature exactly as your signer returned it: the identity comes from those exact bytes, as in the browser app, so rewriting v from 0/1 to 27/28 (or back) gives a different identity.

MPC and threshold signers return a different valid signature every time, so the keys derived from them would change between sessions. Pass a second signature of the same message as signature_hex_repeat the first time you use a wallet: the call fails if the two differ.

import { privateKeyToAccount } from 'viem/accounts'

const QSAFE_DERIVATION_MESSAGE = [
  'QuantSafe keypair derivation v1',
  '',
  'This signature derives your personal post-quantum encryption keypair.',
  'It grants no permissions and costs no gas.',
  '',
  'Domain: quantsafe.tech',
].join('\n')

const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY)
const signature_hex = await account.signMessage({ message: QSAFE_DERIVATION_MESSAGE })
const signature_hex_repeat = await account.signMessage({ message: QSAFE_DERIVATION_MESSAGE })

// signer_signature_hex, signer_address and signer_signature_hex_repeat on the encrypting tools
await mcp.call('qsafe_decrypt_file', {
  blob_base64,
  signature_hex,
  address: account.address,
  signature_hex_repeat,
  expected_signer_pubkey_base64,
})

The signature is root key material. Pass it over the local stdio transport only.

A wallet-derived identity is only as strong as the wallet key behind it: it rests on that key's elliptic curve. For files that must survive a break of elliptic curves, use a freshly generated key file, whose keys are random.

Inputs and outputs

A trailing ? marks an optional field. "Key source" is one of the forms above.

| Tool | Inputs | Outputs | | ----------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------- | | qsafe_encrypt_file | bytes_base64, recipient_pubkey_base64, signer key source? | blob_base64, seal_png_base64, signer_pubkey_base64 | | qsafe_decrypt_file | blob_base64, key source, expected_signer_pubkey_base64? | plaintext_base64, signer_pubkey_base64, filename | | qsafe_send_message | text, recipient_pubkey_base64?, signer key source? | url, mode | | qsafe_decrypt_message | url, key source? (needed unless the URL carries its own key), expected_signer_pubkey_base64? | text, signer_pubkey_base64 | | qsafe_verify_seal | png_base64, blob_base64? | valid, metadata, file_hash_matches? | | qsafe_sign_x402 | payload_json (a JSON object), key source | signature_base64, signer_pubkey_base64 |

Every *_base64 input is standard base64: the alphabet A-Z a-z 0-9 + /, = padding, no whitespace or line breaks. Raw text, base64url or a string with stray characters is refused with an error that names the field; it is never decoded into other bytes. Encode the bytes first (base64 -w0 on Linux, base64 -i file on macOS, Buffer.from(bytes).toString('base64') in Node).

seal_png_base64 is a 1x1 PNG whose text chunks carry the Quantum Seal fields (file_hash is sha256 of the envelope). It has no rendered card; qsafe_verify_seal and /verify read its fields.

Your public key

recipient_pubkey_base64 and expected_signer_pubkey_base64 take the same kind of value: standard base64 of a 3168-byte hybrid public key, ML-KEM-768 (1184 bytes), then X25519 (32), then ML-DSA-65 (1952). It is the signer_pubkey_base64 a tool returns when it signs with your key source; no tool returns it on its own.

To get yours, call qsafe_sign_x402 with your keyfile or wallet signature and any payload, for example {}, and keep signer_pubkey_base64. Give it to anyone who should encrypt to you, or who needs it to check your signature. The same key source always returns the same value. An anonymous ephemeral signer returns a new key on every call, and nothing can be encrypted to it later.

Reading a Seal

No Seal field is signed: every one is a claim that anyone can write into a PNG. qsafe_verify_seal returns the fields it finds as metadata, and valid is true when at least one Seal field is present. valid checks nothing.

Pass the envelope the Seal is for as blob_base64 and the result adds file_hash_matches: true when sha256 of that envelope equals the Seal's file_hash. That is the only check the tool makes. It does not contact the chain, so anchor fields are returned as written. Who signed the envelope is checked when it is decrypted.

Decrypting a file from someone else

qsafe_decrypt_file always verifies the ML-DSA-65 signature before it decrypts, and a .qsafe file does not carry its signer's public key. Pass the sender's signer_pubkey_base64 (returned by qsafe_encrypt_file) as expected_signer_pubkey_base64. Leave it out only for a file you signed with the same key you decrypt with; any other file, including one encrypted with an anonymous ephemeral signer, fails with an error that names the field.

A verified signature shows which key signed the envelope, not who wrote what is inside it. The signature covers the envelope bytes only, so anyone who holds a .qsafe file can strip its signature and sign the same envelope with their own key.

Messages

qsafe_send_message returns the URL and its mode:

  • recipient: recipient_pubkey_base64 was given, and only that key opens the message.
  • anyone_with_link: recipient_pubkey_base64 was omitted. The URL carries its own decryption key, so anyone holding the URL can read the message.

An empty or malformed recipient_pubkey_base64 is refused, never treated as omitted.

A message URL names the key that signed it, so a valid signature proves only that whoever built the URL holds that key. qsafe_decrypt_message returns that key as signer_pubkey_base64. Pass a key you already trust as expected_signer_pubkey_base64 and a URL signed by any other key is refused.

That pin confirms which key signed the envelope, not who wrote the text. Anyone who sees a URL can strip its signature, sign the same envelope with their own key and rebuild the URL around it: a recipient who pins that key reads the original text under the new signer. Do not take a signature as proof that the signer wrote the message.

Signing x402 payloads

payload_json must be a JSON object. A JSON-encoded string, array or scalar is rejected, since a string would be signed as a quoted string literal rather than as the payload it encodes.

The signed message is the UTF-8 encoding of the payload's canonical form, signed with ML-DSA-65 under context qsafe-v1-x402:

  • object keys sorted in JavaScript default string order (UTF-16 code units), at every level
  • no whitespace
  • arrays kept in order
  • strings, numbers, booleans and null written as JSON.stringify writes them

For example, {"b":1,"a":{"d":[true,null],"c":2.5}} is signed as {"a":{"c":2.5,"d":[true,null]},"b":1}. A verifier rebuilds those bytes and checks the signature against the ML-DSA-65 part of signer_pubkey_base64 (bytes 1216 to 3168 of the decoded key, after the ML-KEM-768 and X25519 parts).

Errors

A failed call returns isError: true with a JSON body { "error": "..." }. Arguments that do not match a tool's input schema are rejected before the tool runs, with isError: true and a plain-text message.

A blob or message whose signature verifies but which is encrypted to another key returns "not encrypted to this key source". A message URL that does not decode returns "Malformed message URL" and names the broken segment.

Docs: quantsafe.tech/mcp