Login tokens
A Node service issues post-quantum tokens. A Python API verifies them.
tokens.issue · tokens.checkTwo locks guard every key.
An attacker has to break both to read the data.
One API in TypeScript, Python and Go.
Envelope overhead1,195 bytes AlgorithmsML-KEM-768 + X25519ML-KEM-768 and X25519 combined into one 32-byte secret (X-Wing).
Any tampered byte gives one error and zero plaintext.
OpenSSL 3.5, pyca/cryptography and the Go standard library do the math.
RSA and elliptic-curve keys protect almost every login, database field, backup and software update. A large enough quantum computer breaks them. Traffic recorded now can be decrypted then, so anything that must stay secret for ten years needs post-quantum protection today.
seal(publicKeys, data) runs a hybrid key exchange, derives a fresh key bound to the envelope header, encrypts with AES-256-GCM and adds a key commitment. Developers never pick an algorithm unless they want to.
Opening checks the envelope in a fixed order before a single byte of plaintext is released. A wrong key, a truncated envelope, a flipped bit or a rewritten suite id all raise the same error, with no partial output and no hint about which check failed.
A PQL1 envelope describes itself: suite, recipient key and KEM ciphertext travel with the data. That is what makes rotation and algorithm changes possible without re-architecting. The same bytes come out of all three SDKs.
sign(keys, message) produces a composite signature: ML-DSA-65 and Ed25519 over the same prepared message. Verification passes only if both halves verify, so a forger has to break a lattice scheme and an elliptic curve at the same time.
.pqlsig files, checked by installers.| Suite | Seal | Sign | Use it for |
|---|---|---|---|
| PQL-DEFAULT | X-Wing: ML-KEM-768 + X25519 | ML-DSA-65 + Ed25519 | Most applications. Hybrid, compact, fast. |
| PQL-HIGH | ML-KEM-1024 + P-384 | ML-DSA-87 + P-384 | Long-lived secrets and higher security margins. |
| PQL-CNSA | ML-KEM-1024 | ML-DSA-87, SHA-384 | CNSA 2.0 alignment for national-security workloads. |
| PQL-LEGACY | Imports RSA and ECC keys read-only. Never seals or signs. | Migration: read old data, write new data. | |
Every default key pairs a post-quantum algorithm with a classical one. Security holds if either survives.
TypeScript, Python and Go agree byte for byte: 148 spec vectors and 54 of 54 cross-language pairs pass.
One primary key, older keys kept for opening. Rotate without re-encrypting everything at once.
Change suites in pql.policy.yaml, not in application code. New algorithms slot into the same envelope.
Secrets never print in logs, open never returns partial data, and empty or oversized inputs are refused.
pqlock only composes primitives from OpenSSL 3.5, pyca/cryptography and the Go standard library.
Finds RSA, ECDSA and ECDH across code, configs and certificates, and writes a CycloneDX 1.7 inventory.
One spec sets a maximum for every untrusted input, enforced the same way in every SDK and the CLI.
A strict switch that requires the engine's FIPS 140-3 mode and refuses anything outside the validated module.
Each use case is a working app in the repository. Every change is deployed and run against all eight, including real PostgreSQL and S3-compatible storage.
A Node service issues post-quantum tokens. A Python API verifies them.
tokens.issue · tokens.checkA Go service seals card numbers and PII into Postgres columns, bound to table, column and row.
seal_batchA Python worker streams large backups into object storage, sealed in chunks.
streamCI signs artifacts. A Node installer refuses anything without a valid .pqlsig.
pql sign · sign.verifyA Go sender signs webhooks. A Python receiver verifies them and rejects replays.
webhooksA Node server and a Go client agree on X25519MLKEM768, and the connection proves it.
tlsA Python agent signs every tool call. Node tools verify it and append to a tamper-evident audit log.
sign · auditScan a legacy Node app, inventory its RSA and ECDSA, and swap to pqlock step by step.
pql scan · legacy · rotatepql scan --fail-on-vulnerable . exits 3 while quantum-vulnerable crypto remains, so CI tracks the migration.// npm install pqlock (Node 26+, OpenSSL 3.5+) import { keyset, seal, sign } from 'pqlock'; const keys = keyset.create('seal'); // PQL-DEFAULT const pub = keyset.toPublic(keys); const text = seal.toText(seal.seal(pub, Buffer.from('card 4242…'))); // "pql1.…" store it in any TEXT column const data = seal.open(keys, text); // or PQLOpenError const signer = keyset.create('sign'); const sig = sign.sign(signer, Buffer.from('release v0.1.0')); sign.verify(keyset.toPublic(signer), Buffer.from('release v0.1.0'), sig);
# pip install pqlock (Python 3.12+, cryptography 47+) from pqlock import keyset, seal, sign keys = keyset.create("seal") # PQL-DEFAULT pub = keyset.public(keys) text = seal.to_text(seal.seal(b"card 4242…", pub)) # data first, keys last data = seal.open(text, keys) # or OpenError signer = keyset.create("sign") sig = sign.sign(b"release v0.1.0", signer) sign.verify(b"release v0.1.0", sig, keyset.public(signer))
// go get github.com/Motiontic/pqs/packages/go (Go 1.27+) keys, _ := keyset.Create(keyset.Seal) // PQL-DEFAULT pub := keyset.Public(keys) env, _ := seal.Seal(pub, []byte("card 4242…")) text := seal.Encode(env) // "pql1.…" data, err := seal.OpenText(keys, text) // err on any tamper // stronger suite, one option keyset.Create(keyset.Seal, keyset.WithSuite(keyset.SuiteHigh))
# inventory every RSA / ECC use in a repo pql scan --format json -o scan.json . pql cbom -o cbom.json . # CycloneDX 1.7 pql scan --fail-on-vulnerable . # CI gate: exit 3 # set the suite for the whole app echo "suite: PQL-HIGH" > pql.policy.yaml
pqlock v0.1.0 is a preview. Every change is fuzzed, checked against NIST ACVP vectors, timing-tested on its own compare and parse paths and reviewed independently, but an external cryptographic audit has not happened yet. An audit is required before v1.0.
Security issues go to [email protected], not to public issues. The license is Apache-2.0.
Motiontic builds pqlock and helps enterprise teams plan and ship post-quantum migrations.