How PQ Vault works
Plain-language design and threat model. No new cryptography is invented here.
Why post-quantum matters for backups ("harvest now, decrypt later")
Encrypted data copied today can be stored and attacked later. Public-key schemes based on elliptic curves or RSA (key exchange, signatures) would be broken by a large quantum computer; symmetric ciphers like AES-256 are only weakened (Grover's algorithm halves the effective key length, leaving ~128-bit security). So a backup that is encrypted to a public key — e.g. for an heir, a safe-deposit copy, or cloud storage you encrypt to a key without a shared passphrase — should use a post-quantum KEM. That's what the envelope does, in hybrid with X25519, so it stays secure if either assumption fails.
Honest note: when plain AES + passphrase is just as good
If you only ever encrypt with a strong passphrase on your own machine, AES-256-GCM with a high-cost KDF is already quantum-resistant, and the KEM adds nothing. The hybrid envelope is for the case where the encrypting party and the decrypting key holder differ, or you want to store the sealed secret in places that you can't protect with a passphrase.
Algorithms
| Purpose | Algorithm | Library |
|---|---|---|
| Key encapsulation | ML-KEM-768 (FIPS 203) + X25519 (RFC 7748), secrets concatenated and run through HKDF-SHA256 (salt binds both public keys, the ephemeral key and the KEM ciphertext) | @noble/post-quantum, @noble/curves |
| Encryption | AES-256-GCM, 96-bit random nonce, header authenticated as AAD, plaintext padded to 256-byte blocks | WebCrypto (browser built-in) |
| Signature (optional) | ML-DSA-65 (FIPS 204) over SHA-256 of the whole envelope | @noble/post-quantum |
| Passphrase wrapping | scrypt (N=217, r=8, p=1) → AES-256-GCM | @noble/hashes |
| Secret splitting | Shamir over GF(28), per-share checksum, protected reconstruction checksum | this repo (small, tested) |
Key hierarchy
One random 32-byte recovery key → HKDF with domain labels → X25519 key, ML-KEM-768 seed, ML-DSA-65 seed. Because everything derives from 32 bytes, the secret you must preserve is tiny (easy to split or print). The public key is derived deterministically and can be shared freely.
Formats
pqv-pub-1. public key (3.2 KB) · pqv-key-1. passphrase-wrapped recovery key · pqv-env-1. envelope · pqv-shr-1. Shamir share · PQV1:id:i/n:… QR chunk. Envelope layout: magic, flags, ephemeral X25519 key (32 B), ML-KEM ciphertext (1088 B), nonce (12 B), [signer fingerprint], length, AES-GCM ciphertext, [ML-DSA signature 3309 B].
What this does not protect against
- A compromised device, malicious browser extension or keylogger — the secret is typed into a web page. Use the offline file on a clean machine.
- Supply-chain attacks on the hosted page: that is why the offline build is hash-published and the core source is readable at /source/pqv.js. The hosted page loads one script from its own origin and no third-party code (strict CSP).
- Bugs. This is new software and has not been independently audited; the underlying libraries are widely reviewed, but the composition (the HKDF combiner, envelope format) is ours. Treat it as experimental and keep conventional backups.
- Losing your passphrase or recovery key. There is no recovery.
- Future cryptanalysis: ML-KEM and ML-DSA are young standards. The X25519 hybrid hedges against flaws in ML-KEM today, but not against a quantum computer if ML-KEM were also broken; the 256-bit symmetric layer remains.
Tests
The repository includes a Node test suite (51 checks: round trips, tamper detection on every envelope region, wrong-key rejection, signature verification, Shamir for all thresholds, QR chunk reassembly, Bitcoin address parsing and verdict logic, a live explorer lookup). Run node test/run.mjs.
Cost & business model
Free. Hosted as static files; we receive no data. The operator accepts voluntary tips and also operates ZEC Route (a swap interface that earns a disclosed routing fee). Neither affects how the vault works.