Use the passkey extensions
For: an app developer who must derive a key in the browser from a passkey, or keep a small blob on the authenticator.
What it does: core asks for the WebAuthn extensions PRF, largeBlob, and credProps at the registration. The sign-in takes PRF salts and a largeBlob read. The PRF output and the large blob stay in the browser.
Before you start
Section titled “Before you start”- A working passkey sign-in from Sign in with a passkey.
- A browser and an authenticator that support the extension. Many do not, so plan for a passkey with no PRF and no large blob. Passkeys lists the three keys.
- Set
passkey.extensionsin the config. Each key is off by default.
import { createAuth, type MailPort, type StorageAdapter } from "@authtempo/core";
export function createExtensionsAuth(deps: { storage: StorageAdapter; mail: MailPort; secret: string;}) { return createAuth({ baseURL: "https://api.example.com", appURL: "https://app.example.com", trustedOrigins: ["https://app.example.com"], secret: deps.secret, storage: deps.storage, mail: deps.mail, passkey: { rpID: "example.com", rpName: "Example", origins: ["https://app.example.com"], // Each flag is advice for the app's client. No check of core reads it. extensions: { prf: true, largeBlob: "preferred", credProps: true }, }, });}- Read the flags
prf,largeBlob, anddiscoverablefromclient.passkeys.list(). Use them to show what each passkey can do. - Choose a PRF salt: 32 bytes, as base64url. Keep it in the app’s code.
- Call
client.passkey.signIn({ extensions: { prf: { first } }, onExtensionResults }). AddlargeBlob: { read: true }to read the blob. - Read the PRF output and the blob in
onExtensionResults. It runs only after a sign-in that succeeded. - To write a blob, wrap the browser seam and add
largeBlob.writeto the sign-in options. Core never sends a blob to write. - In the same wrap, set
allowCredentialsto exactly one credential. Use the id of a passkey that the app kept from an earlier sign-in. A browser refuses a write with no credential or with two or more. Core’s verify does not readallowCredentials, so the sign-in still verifies. - Do not ask for a read and a write in one sign-in. A browser refuses that request. The wrap above replaces a read with the write.
import { type BrowserWebAuthn, browserWebAuthn, type Client } from "@authtempo/client";
/** * The PRF salt of the app: the base64url of 32 bytes. One fixed salt is * safe for every user, because each passkey gives its own output. */export const VAULT_SALT = "dmF1bHQta2V5LXYxLXZhdWx0LWtleS12MS12YXVsdC0";
/** Signs in with a passkey and gives the PRF output to the app. The server never sees it. */export async function signInAndUnlock( client: Client, unlock: (prfOutput: string) => void,): Promise<string> { const r = await client.passkey.signIn({ extensions: { prf: { first: VAULT_SALT } }, onExtensionResults: (results) => { if (results.prf) unlock(results.prf.first); }, }); return r.ok ? "Signed in." : r.code;}
/** * A browser seam that writes a large blob at a sign-in. Core never sends one. * A write needs exactly one allowed credential: the id of a passkey that the * app kept from an earlier sign-in. A request cannot both read and write. */export function writingBlob( blob: string, credentialId: string, browser: BrowserWebAuthn = browserWebAuthn(),): BrowserWebAuthn { return { create: (options) => browser.create(options), get: (options, ceremony) => browser.get( { ...options, allowCredentials: [{ type: "public-key", id: credentialId }], extensions: { ...options.extensions, largeBlob: { write: blob } } as never, }, ceremony, ), };}import { type BrowserWebAuthn, createClient } from "@authtempo/client";import type { PublicKeyCredentialRequestOptionsJSON } from "@authtempo/core";import { SoftAuthenticator } from "@authtempo/core/testing";import { describe, expect, it } from "vitest";import { API, APP, call, harness, signIn } from "../support/harness.ts";import { createExtensionsAuth } from "./passkey-extensions.ts";import { VAULT_SALT, writingBlob } from "./passkey-extensions-client.ts";
describe("use the passkey extensions", () => { it("passes the PRF salt and a large blob read to the sign-in options", async () => { const auth = createExtensionsAuth(harness()); const res = await call(auth, "POST", "/auth/passkey/authenticate/options", { extensions: { prf: { first: VAULT_SALT }, largeBlob: { read: true } }, }); expect(res.status).toBe(200); const options = (await res.json()) as { extensions: unknown }; expect(options.extensions).toEqual({ prf: { eval: { first: VAULT_SALT } }, largeBlob: { read: true }, }); });
it("refuses a PRF salt that is not 32 bytes", async () => { const auth = createExtensionsAuth(harness()); const res = await call(auth, "POST", "/auth/passkey/authenticate/options", { extensions: { prf: { first: VAULT_SALT.slice(0, 42) } }, }); expect(res.status).toBe(400); expect(await res.json()).toEqual({ error: "invalid_body" }); });
it("writes a blob through exactly one allowed credential, and the sign-in still verifies", async () => { const h = harness(); const auth = createExtensionsAuth(h); const cookie = await signIn(auth, h, "ada@example.com"); const soft = await SoftAuthenticator.create({ rpID: "example.com", origin: APP }); const reg = await call(auth, "POST", "/auth/passkey/register/options", {}, { cookie }); const { challenge } = (await reg.json()) as { challenge: string }; const response = await soft.register(challenge); const added = await call( auth, "POST", "/auth/passkey/register/verify", { response }, { cookie }, ); expect(added.status).toBe(200); // The soft seam records the options that the browser would get. const seen: PublicKeyCredentialRequestOptionsJSON[] = []; const recorder: BrowserWebAuthn = { create: () => Promise.reject(new Error("no create")), get: async (options) => { seen.push(options); return soft.authenticate(options.challenge); }, }; const client = createClient({ baseURL: API, credentials: "omit", broadcast: false, fetch: ((input: RequestInfo | URL, init?: RequestInit) => auth.handle(new Request(input, init))) as typeof fetch, webauthn: writingBlob("YmxvYg", soft.credentialId, recorder), }); const r = await client.passkey.signIn({ extensions: { prf: { first: VAULT_SALT }, largeBlob: { read: true } }, }); expect(r.ok).toBe(true); expect(seen).toHaveLength(1); // WebAuthn Level 3, 10.1.5: a write needs exactly one credential, and no read. expect(seen[0]?.allowCredentials).toEqual([{ type: "public-key", id: soft.credentialId }]); expect(seen[0]?.extensions).toEqual({ prf: { eval: { first: VAULT_SALT } }, largeBlob: { write: "YmxvYg" }, }); });});How it behaves
Section titled “How it behaves”- The client extension outputs are not signed by the authenticator. So the three flags are advice for your client, and no check of core reads them. A client that claims an extension changes no security decision.
- Core stores a flag only for an extension that the config asks for. An output of the wrong shape stores no flag.
discoverableis null when the browser does not answercredProps, or whencredPropsis off.- Each verify keeps only the boolean outputs of
clientExtensionResults. Soprf.resultsandlargeBlob.blobnever reach a read, a store, or a log of core. - The client takes both outputs out of the response before it sends the verify. A client of your own must do the same: call
splitExtensionResultsfrom@authtempo/client. - One salt for every user is safe. The browser hashes the salt with a fixed context, and the output also depends on a secret of each passkey. So two passkeys give two different outputs for one salt.
- The PRF output is a key of the browser, not of the server. If the person loses the passkey, the key is gone. Keep a recovery path for the data that it protects.
- The second factor and the re-authentication take no extension in their options.
- The write rules come from WebAuthn Level 3, section 10.1.5 (read 2026-10-25).
If it fails
Section titled “If it fails”invalid_body: a PRF salt is not the base64url of 32 bytes, or the body asks for an extension thatpasskey.extensionsdoes not turn on. The limit counts no try.passkey_failed: the assertion failed. The outputs of the extensions play no part in it.