Your passkey is the key.
End-to-end encryption usually means asking people to look after a secret key, and they lose it. prfect borrows the one secret they already keep safe and synced, their passkey, and derives the encryption key from it. The server stores only ciphertext and keys it can't open.
The big picture
Three kinds of material move around, and the colors in every diagram below follow them.
1A passkey that can make secrets
Normally a passkey only signs. The WebAuthn PRF extension lets it also act as a keyed hash: give it a salt and it returns 32 bytes that only that passkey can produce, the same every time.
Try it: a simulated authenticator
This runs the same calculation as a real authenticator, using two random secrets generated in this tab to stand in for two passkeys. Change the salt or switch passkeys and watch which outputs repeat.
2Key slots: many ways in, one master key
Data is never encrypted directly with a passkey's output. A random account master key (AMK) sits in the middle, and each way of unlocking stores its own wrapped copy of it, the way LUKS disk encryption uses key slots.
3Sealing a file with HPKE
Files are encrypted to the account public key with HPKE (RFC 9180). Anyone holding the public key can seal a file, and only the private key can open it. That's how an ingest machine can upload files it can't read back.
ECDH(skR, enc), which gives the same shared secret and therefore the same key. The ciphersuite is DHKEM(P-256, HKDF-SHA-256), HKDF-SHA-256, AES-256-GCM. Go's standard crypto/hpke and the browser's hpke-js both reproduce the official RFC 9180 test vector for it. P-256 was chosen over X25519 because it's the curve Apple's Secure Enclave supports.4Unlocking: signing in and decrypting are one Touch ID
The same navigator.credentials.get() call proves who you are to the server and asks the passkey for its PRF output. The browser sends the server the signature and keeps the PRF output.
What the server sees
Stores
- your username and each passkey's public key
- the account public key
- slots: the AMK wrapped under each KEK
- the account private key, encrypted under the AMK
SHA-256of the recovery auth secret- sealed boxes, their sizes and upload times
- hashes of ingest tokens and their labels
Never receives
- PRF outputs or the KEKs derived from them
- the account master key
- the account private key in usable form
- your recovery code
- file names, types or contents
The blob store needs even less trust. Object names are random, so listing a bucket shows nothing about who owns what. A leaked bucket exposes ciphertext, sizes and timestamps. Signed in, the app's The server's view panel shows exactly what is stored for you.
Standards used
No new cryptography: every primitive is a published standard, and the code combining them is small enough to read.
| Standard | Role in prfect |
|---|---|
| WebAuthn Level 3 (W3C) | Passkey registration and sign-in. The server verifies signatures with go-webauthn. |
| PRF extension (WebAuthn §10.1.4) | Gets a stable, per-passkey 32-byte secret for a given salt. |
| CTAP 2.1 hmac-secret (FIDO Alliance) | The authenticator-side HMAC that PRF is built on. Security keys support it too. |
| HKDF (RFC 5869) | Turns PRF output and recovery codes into KEKs, with versioned info labels. |
| AES Key Wrap (RFC 3394) | Key slots: the AMK wrapped under each KEK. |
| AES-GCM (NIST SP 800-38D) | Encrypts the private key under the AMK, and is the AEAD inside HPKE. |
| HPKE (RFC 9180) | Sealed boxes, via Go crypto/hpke and hpke-js. |
| ECDH on P-256 (NIST SP 800-56A, FIPS 186-5) | The account key pair, on the same curve as the Secure Enclave. |
| Web Crypto API (W3C) | All browser crypto, including keys marked non-extractable. |
| Crockford Base32 | Recovery codes that survive being read aloud or mistyped (O→0, I/L→1). |
| S3 API | Blob storage on AWS S3, Cloudflare R2, MinIO, … |
Limits worth knowing
- The server serves the code. Every web app has this problem: the page that receives the PRF output comes from the server, so a compromised server could serve code that leaks it. A signed native app, or code-transparency efforts like WEBCAT, close that gap.
- Metadata isn't hidden. The server sees sizes, times, which ingest token uploaded what, and when you sign in.
- Losing every way to unlock means losing the data. That's the point of end-to-end encryption: nobody can reset it for you. That's why sign-up insists on a recovery code, and why more than one passkey is a good idea.
- Passkey providers matter. PRF works with iCloud Keychain, Google Password Manager, 1Password and most recent security keys. A passkey without PRF can sign in but can't unlock.
What's next
Key rotation
Every layer is versioned, so each one can rotate on its own schedule. The cost depends on how far down the stack you go:
| What rotates | Cost | Status |
|---|---|---|
| A passkey (add / remove) | One ceremony, one 40-byte slot | built |
| Recovery code | Re-wrap one slot | built |
| PRF salt | Evaluate old and new salts in one ceremony (first/second) and re-wrap. Each passkey upgrades the next time it's used. | planned |
| Account key pair | New key pair. Old private keys stay in a keyring under the AMK, and boxes gain a key id. Ingest machines follow a rotation statement signed by the old key. | planned |
| Re-encrypting old data | With per-file keys (below), re-wrap each small key instead of re-encrypting gigabytes | planned |
Sharing with another prfect user
Every account already has a public key, so sharing comes down to encrypting each file under its own random key and sealing that small key once per reader:
Post-quantum
A future quantum computer threatens only the public-key layer. Data sealed today could be stored and decrypted later ("harvest now, decrypt later"). Everything symmetric in prfect is already fine:
| Layer | Algorithm | Against a quantum attacker |
|---|---|---|
| Passkey PRF | HMAC-SHA-256 | safe symmetric |
| KEKs, slots, private key at rest | HKDF-SHA-256, AES-256-KW, AES-256-GCM | safe 256-bit keys keep 128-bit security against Grover's algorithm |
| Passkey signatures | ECDSA P-256 | sign-in only forgeable someday, but that can't decrypt data recorded earlier |
| Transport | TLS | browser's job current browsers already negotiate hybrid ML-KEM key exchange |
| Sealed boxes | HPKE DHKEM(P-256) | exposed this is the one piece to upgrade |
The upgrade is a hybrid KEM that combines ML-KEM-768 (FIPS 203) with an elliptic curve, so a box stays safe unless both are broken. Go already ships these hybrids (hpke.MLKEM768X25519 and hpke.MLKEM768P256). The costs:
- No ML-KEM in WebCrypto yet, so the browser would run a JavaScript implementation, and the ML-KEM half of the private key couldn't be a non-extractable
CryptoKey. The hybrid limits the damage: a stolen ML-KEM key alone opens nothing without the elliptic-curve half, which stays non-extractable. - Bigger boxes: the encapsulation grows from 65 bytes to about 1.1 KB per box and per sharing envelope, and the public key from 65 bytes to about 1.2 KB. That doesn't matter for files, but it adds up for thousands of small envelopes.
- The curve changes. The only hybrid that both Go and hpke-js support today is X-Wing (ML-KEM-768 + X25519), not P-256, so the account key would no longer match the Secure Enclave's curve.
- Hybrid HPKE codepoints are still IETF drafts. The box's version byte is what makes a later change survivable.
Status: deferred, but upgradable. Today the cost isn't worth it, so the groundwork is in place instead:
- The box's first byte is a suite id. Readers dispatch on it and keep old suites readable.
- Each account records its suite. Writers seal with that suite.
- The server and the upload command refuse suites they don't know, so nothing falls back to the weaker format without anyone noticing.
- A test keeps the Go and browser suite tables identical.
Adding X-Wing would be "suite 3" plus a key migration. The checklist is in POST-QUANTUM.md.