AINPM.in / Work / webauthn-prf-zktv
Case study · Library · Research preprint

Passkey-derived encryption for the webwebauthn-prf-zktv: zero-knowledge vault key wrapping

webauthn-prf-zktv is an open-source TypeScript library that wraps a vault key under a secret derived from a passkey (the WebAuthn PRF extension) or under a scrypt-stretched master password, so that a dump of everything stored can never reconstruct the key. It was extracted from TrustVault and is the reference implementation for a published research preprint.

Library at a glancenpm v0.2.0, 5 Jul 2026 · compatibility per README
  • Platforms with WebAuthn PRF5 / 6
Version on npm
v0.2.0
Runtime dependency
1
Wrap schemes
2

Source: README ↗

01 · The problem

Why do web vaults need PRF key wrapping?

Passkeys don't encrypt

Passkeys prove who you are with signatures. To encrypt data you need a symmetric secret, which only the PRF extension provides.

Easy to get wrong

Probe credentials, skipped origin checks or a passkey-only design that loses data when the passkey is deleted are common mistakes.

No reusable reference

Teams re-implement the ceremony, key derivation and storage each time. A small, tested library and a written design make it reviewable.

02 · How it works

How is the vault key wrapped?

Two independent paths derive a wrap key. Either one can unwrap the same 32-byte vault key; neither input is ever stored.

Vault key wrapping with webauthn-prf-zktvPath one: a passkey authenticator, after biometric or PIN verification, returns a PRF output, which HKDF-SHA256 turns into a wrap key. Path two: the master password is stretched with scrypt into a wrap key. Each wrap key encrypts the vault key with AES-256-GCM into a record of type prf-v1 or pw-v1, stored in IndexedDB. Unwrapping yields a non-extractable AES-256-GCM CryptoKey.Passkey + biometricPRF output (hardware)Master passwordtyped by the userHKDF-SHA256→ wrap keyscryptN=2¹⁷, r=8, p=1AES-256-GCMwraps vault keyprf-v1 recordIndexedDBpw-v1 recordIndexedDBUnwrap returns a non-extractable CryptoKey · stored records hold only ciphertext, salts and nonces
Highlighted: the two secrets that never touch storage.
ModuleWhat it gives you
webauthn-prf-zktvwrapSecret / unwrapSecret for prf-v1 and pw-v1, HKDF and scrypt derivation, versioned JSON records, TrustVault migration, typed errors, zeroize
/webauthnTri-state PRF detection without probe credentials, adaptive one- or two-ceremony enrollment, assertion with challenge, origin and counter checks, enrollVault / unlockVault
/indexeddbVault, credential and meta stores; PRF and password wraps of one vault side by side; targeted and full wipes
03 · Threat model

What does it protect against?

Full storage dump

An attacker with every stored byte holds only ciphertext, salts, nonces and credential metadata. Recovering the key needs the PRF output or the password.

Script injection (XSS)

Keys are non-extractable, so injected script can misuse an unlocked key while the page is open but cannot copy it or unlock later sessions.

Cloned or synced passkeys

Synced passkeys often report a counter of 0. The library exposes backup flags so apps can apply their own risk policy.

04 · Compatibility

Which platforms support WebAuthn PRF in 2026?

PlatformPRFNotes
Chrome / EdgeYesPRF evaluated during registration from Chrome 147, so enrollment is a single ceremony
SafariYesmacOS 15+ and iOS 18+ via iCloud Keychain
FirefoxYes147/148 and later
Android (Credential Manager)YesRobust
Windows HelloYesWindows 11 25H2+ (WebAuthn API v8)
Android WebView / CapacitorNoPRF does not pass through to Credential Manager; use the password scheme

Source: library README, 2026.

05 · Research

What does the preprint contribute?

Published on figshare on 6 July 2026 under CC BY 4.0.

Contributions

  • A formal description of PRF-based vault key wrapping for PWAs
  • An IndexedDB schema and migration strategy that reinforce zero-knowledge properties
  • A reusable open-source implementation, this library
  • Post-quantum considerations and migration paths

Cite

Pinto, Ian (2026). WebAuthn PRF-Based Vault Key Wrapping and Zero-Knowledge PWA Storage Architecture. figshare. Preprint. https://doi.org/10.6084/m9.figshare.32915411.v1

06 · Decisions

Which design choices were deliberate?

DecisionReason
No SimpleWebAuthn dependencyNative navigator.credentials calls with strict PRF validation keep the attack surface and bundle small.
No probe credentialsCapability detection uses getClientCapabilities(); enrollment hard-verifies PRF only when support is unknown.
Password wrap is mandatory in the docsA deleted passkey must never mean data loss.
Known-answer interop vectorsLets other languages implement the same format and check their output byte for byte.
Symmetric-only wrap pathNo asymmetric secrecy dependency, so the design keeps a post-quantum margin.
Proof of skill

What does this project prove, and how can you check it?

Employers trust skills they can verify. Each claim below links to its place in the skills matrix, and every piece of evidence is public.

Skills demonstrated

Evidence you can open

See the product artifacts: brief, eval spec, metrics tree, decisions

Last public activity 7 July 2026 · checked 5 November 2026

07 · FAQ

Frequently asked questions

What is webauthn-prf-zktv?

webauthn-prf-zktv is an MIT-licensed TypeScript library by Ian Pinto that wraps a vault key under a WebAuthn PRF output (a secret derived from a passkey after biometric or PIN verification) or under a master password stretched with scrypt. A stored record dump alone can never reconstruct the vault key. Version 0.2.0 is published on npm.

What is the WebAuthn PRF extension?

The WebAuthn pseudo-random function (PRF) extension lets a web app ask a passkey authenticator for a high-entropy secret, computed in hardware with the CTAP2 hmac-secret feature after user verification. Because it is never stored, it can safely act as the root of a client-side encryption key.

Why does the library keep a password wrap as well as the passkey wrap?

Because tying encryption to a passkey alone is dangerous: deleting the passkey would destroy the data. The password wrap (pw-v1) is the safety net that makes PRF unlock (prf-v1) safe to deploy.

Which browsers support WebAuthn PRF in 2026?

According to the library documentation: Chrome and Edge (with PRF evaluated during registration from Chrome 147), Safari on macOS 15+ and iOS 18+ via iCloud Keychain, Firefox 147 or 148 and later, Android Credential Manager, and Windows Hello on Windows 11 25H2+. PRF does not pass through Android WebView or Capacitor, where the password scheme is used.

Is there a paper describing the design?

Yes. "WebAuthn PRF-Based Vault Key Wrapping and Zero-Knowledge PWA Storage Architecture" by Ian Pinto was published as a preprint on figshare on 6 July 2026 under CC BY 4.0, DOI 10.6084/m9.figshare.32915411.v1.

Is it quantum-safe?

The wrap path uses only symmetric primitives: AES-256-GCM, HKDF-SHA256 and scrypt. Grover's algorithm halves effective symmetric strength, which leaves about a 128-bit post-quantum margin for AES-256. WebAuthn signatures authenticate but never protect secrecy in this design.

More work

Other case studies