Skip to content

docs(legal): say what passkeys keep on app.fctl.sh - #23

Merged
kalaspuff merged 1 commit into
fctl/49-add-optional-2fa-totp-enforcement-of-allfrom
fctl/49-add-passkey-sign-in
Oct 19, 2026
Merged

kalaspuff merged 1 commit into
fctl/49-add-optional-2fa-totp-enforcement-of-allfrom
fctl/49-add-passkey-sign-in

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

The privacy policy says what app.fctl.sh keeps for passkeys, which hyperstructure/fctl#104 adds:

  • What we collect: for each passkey, its public key and credential ID (the private key stays on the person's device or with their password manager), its name, the authenticator model (AAGUID, which names the provider), whether it syncs, how the browser reaches it, its signature counter, and when it was added and last used. Also the challenges passkeys sign, for ten minutes.
  • Email: the notice when a passkey is added to an account.
  • Retention: passkeys stay until removed in Settings, the account is deleted, or an admin's reset removes them where the instance requires two-factor; challenges are deleted within an hour of expiring.
  • Rights and security: the export lists passkeys, Settings corrects them, and the security summary says only public keys are kept.

Stacked on #22 (two-factor sign-in): merge that first, and this one together with hyperstructure/fctl#104.

Session: https://app.fctl.sh/s/ses_01M58KEJWPFJKBCENF5HKRV5HV

@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 19, 2026 00:49
kalaspuff pushed a commit to hyperstructure/fctl that referenced this pull request Oct 19, 2026
Adds passkeys. People sign in with their fingerprint, face or screen
lock: no password, no code, and nothing a fake site could catch. Where
admins require two-factor sign-in, a passkey also counts as the second
factor, so meeting the requirement takes a tap.

**Stacked on #103** (two-factor sign-in): review that one first. This
pull request's own changes are the commits after it. Once #103 merges,
`main` gets merged in here.

## What people get

- **Settings → Passkeys.** "Add a passkey" opens the browser's passkey
sheet at once (the options are fetched ahead, so Safari's click rule
holds). The new passkey appears highlighted, named after its provider
when the authenticator says ("1Password", "Apple Passwords", "Windows
Hello"), else the device ("Chrome on macOS"). Each shows whether it
syncs, when it was added and last used, renames inline, and removes with
a confirmation that says to remove it from the provider too. With one
passkey, Settings suggests a second on another device.
- **Signing in.** The browser offers passkeys right in the email field's
suggestions (conditional mediation), and **Sign in with a passkey**
opens its sheet. No second factor follows: the device already verified
the person. A passkey fctl no longer knows gets a plain message, and the
browser is told to stop offering it.
- **After a password sign-in**, on a device that can keep passkeys, a
small card offers one: "Sign in faster next time". "Not now" keeps it
away for 30 days in that browser.
- **Where two-factor is required**, the setup-only page offers a choice:
"Add a passkey" (marked "Quickest", one tap) or "Use an authenticator
app". After a password, the second step then asks for the passkey ("One
more step. Confirm it's you with your passkey."). For someone with an
authenticator app as well, the code step offers "Use a passkey instead".
Without a requirement, adding a passkey changes nothing about password
sign-ins, so nobody turns two-factor on by accident.
- **Keeping providers in step.** Where browsers support WebAuthn's
signals, Settings tells the passkey provider which passkeys the account
still has and what it is called, and a removed passkey stops being
offered.
- **Admin → Users** shows who signs in with passkeys. **Reset
two-factor** also removes passkeys where they are the second factor the
instance requires, but never someone's only way in.
- **CLI.** `fctl account passkeys list|rename|remove` (adding takes a
browser), `fctl whoami` lists passkeys, `fctl admin users` counts them,
`fctl account two-factor` says when passkeys are the second factor. The
client also gets methods for the options, add and sign-in endpoints,
which take an authenticator's answer. Like #103's second step, the
passkey second step is cookie-based and browser-only.

## How it works

- WebAuthn Level 3 with discoverable credentials and `userVerification:
"required"`, and no attestation (`"none"`). Keys: ES256, EdDSA, RS256.
The relying party id is the host name of `FCTL_PUBLIC_URL`; in
development, any `localhost` port.
- `fctl_domain::webauthn` checks what browsers send (client data,
origin, relying party hash, user presence and verification, backup
flags, COSE keys, DER signatures). It uses a strict, bounded CBOR
decoder in `fctl_domain::cbor`. WebCrypto in the Worker checks the
signatures (`crypto::verify_passkey`), so the Worker gains no crypto
code.
- **Challenges** work once, for ten minutes, and are found by what the
browser signs (`clientDataJSON`), so nothing else travels with them.
Registration and second-factor challenges are stored by their SHA-256
(`passkey_challenges`). Sign-in challenges are signed with the master
key instead: the sign-in page asks for one on every load, so page loads
write nothing and cost no rate limit. A sign-in challenge is recorded
once used, so it works once.
- **Adding a passkey takes proof**, since a passkey skips both password
and code: a browser sign-in from the last 15 minutes, else the password,
else (no password) a code from the authenticator app. The dialog asks
for whichever is needed, then hands the click to the browser. Adding one
emails the person.
- The signature counter must move on unless it stays 0, as synced
passkeys' does. One that goes back refuses the sign-in and goes in the
audit log.
- Adding counts against the limit (20) and refuses duplicates in its own
insert. Removing re-checks "last way in" and "the required second
factor" in its own delete, so racing requests can't get around them.
- Migration `0012_passkeys.sql` adds two tables. The policy in
`fctl_domain::two_factor` now takes `Factors { authenticator, passkeys
}`, and `TwoFactor.on` says when password sign-ins ask for a second
factor. Housekeeping, account deletion and the export cover passkeys.

The reasoning is in [ADR
0023](docs/adr/0023-passkeys-sign-in-on-their-own.md).
docs/architecture.md (Passkeys), docs/security.md, docs/cli.md,
docs/self-hosting.md (passkeys belong to the host name) and
docs/getting-started.md describe the behavior.

## How I verified it

- `cargo xtask check` passes. New tests: RFC 8949's CBOR examples, plus
refusals of truncated, indefinite, oversized and deeply nested input;
WebAuthn registration and assertion checks (wrong type, origin, relying
party, presence, verification, backup flags, trailing bytes, unsupported
keys); DER signatures; counters; provider names; the passkey policy;
base64url and option conversion in the web app.
- In Chromium with a virtual platform authenticator (DevTools WebAuthn)
against `cargo xtask dev`:
  - adding a passkey in Settings;
  - signing in from the email field's suggestions and from the button;
- the after-sign-in card, which stays hidden for someone who already has
a passkey;
  - the setup-only page with "Add a passkey";
- a password sign-in finished with the passkey, and the code step's "Use
a passkey instead";
  - a credential restored with an old counter, refused as a copy.
- A software authenticator in Node registered **RS256** and **Ed25519**
passkeys (which Chrome's virtual authenticator doesn't make) through the
API and signed in with them. It also checked that a reused challenge, a
wrong signature, another origin, missing user verification and a counter
going back are all refused, and that the rate limit holds.
- CLI: list, rename by name, `whoami`, `admin users`, and an admin reset
that removes a required passkey (and keeps passkeys elsewhere).
- A code review pass found nine issues, fixed here (signed sign-in
challenges, atomic limits and removal, the reset's scope,
`TwoFactor.on`, options outliving their challenge, retries in the proof
dialog, a refetch racing a successful verify, a duplicated helper,
client methods). One more, the cookie-based second-step endpoints, stays
browser-only by design.

## Screenshots

At 27bc8bc, from `cargo xtask dev`'s accounts.

Signing in: the passkey button, which the email field's suggestions join
where the browser has them:

| Light | Dark, 390 px |
|---|---|
| ![The sign-in page with "Sign in with a
passkey"](https://app.fctl.sh/api/v1/published/sAyE1zMwwkOuUJRqyQCLxYfjGAKKipKY2wQ2HuIPxL2/login-passkey-light.png)
| ![The same page on a phone,
dark](https://app.fctl.sh/api/v1/published/qXp7snm5pIUaCXsBjqCvAVM6QodxiZfAA8O3pr96bkd/login-passkey-dark-phone.png)
|

Settings → Passkeys, just after adding one (highlighted), and the page
in the dark theme beside two-factor sign-in:

![Settings, Passkeys: a new passkey, "Add another
passkey"](https://app.fctl.sh/api/v1/published/2ayx8hOP6cGop4cotG5UJZP4SFi8UmQEh4WiZlzOkZY/passkeys-one-light.png)

![Settings in the dark theme: Passkeys and Two-factor
sign-in](https://app.fctl.sh/api/v1/published/wWOiuAn2UIdiJ31C9pHNGyBqgAlCsespvbZslHu9E2s/settings-passkeys-dark.png)

After a password sign-in on a device that can keep passkeys:

![The card "Sign in faster next
time"](https://app.fctl.sh/api/v1/published/uUeERkTWVG2VA67GJWsVdudsWKxzDPZgqxTYnqWNfIU/passkey-offer-light.png)

Where two-factor is required, the setup-only page offers a passkey
first:

| Light | Dark, 390 px |
|---|---|
| ![Add a passkey (quickest) or use an authenticator
app](https://app.fctl.sh/api/v1/published/WEg8KTFO3lDXwbS0CdTaueot2tj1913HjbVgigpZq5L/gate-choose-light.png)
| ![The same choice on a phone,
dark](https://app.fctl.sh/api/v1/published/QmbM6xx8cotuiG51LQXFpXy16Jjko4uYT1uGg3dSJXL/gate-choose-dark-phone.png)
|

The second step with a passkey, alone and next to an authenticator app:

| Passkey only | App and passkey |
|---|---|
| ![One more step: Use your
passkey](https://app.fctl.sh/api/v1/published/6yfu8rZAHEmUALzcuwShGWXRmC5zWrRAsUjB0LAtm2V/second-factor-passkey-light.png)
| ![Enter your code, or "Use a passkey
instead"](https://app.fctl.sh/api/v1/published/qpQFqz5wVZg9YdDqRdPN4DZyigJN0cfp5ww1C2sJhak/code-or-passkey-light.png)
|

Admin → Users with passkeys (fingerprint) next to authenticator apps
(shield):

![Users with two-factor and passkey
badges](https://app.fctl.sh/api/v1/published/mU9SRw0wgSfRBxbqvQj3B8SNPKGrtk3YvvXea64kG8v/admin-users-passkeys-light.png)

```
$ fctl account passkeys list
Studio laptop                this device · added 5m ago · used just now · pky_01M58S0JQZAYKWHFPREFPNYWFN
Add passkeys in your browser, with your fingerprint, face or screen lock: https://app.fctl.sh/settings
```

## Related

- #103: two-factor sign-in, which this builds on.
- hyperstructure/fctl-site#23: the privacy policy says what passkeys
keep, stacked on hyperstructure/fctl-site#22. Merge it with this one.

Session: https://app.fctl.sh/s/ses_01M58KEJWPFJKBCENF5HKRV5HV

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
@kalaspuff
kalaspuff added this pull request to stack #24 October 19, 2026 14:33
@kalaspuff
kalaspuff merged commit 58d3ab1 into main Oct 19, 2026
3 checks passed
@kalaspuff
kalaspuff deleted the fctl/49-add-passkey-sign-in branch October 19, 2026 14:34
kalaspuff pushed a commit that referenced this pull request Oct 19, 2026
The privacy policy says what app.fctl.sh keeps for two-factor sign-in,
which hyperstructure/fctl#103 adds:

- **What we collect**: for people who turn it on, or whose admins
require it, the secret their authenticator app makes codes from
(encrypted), a hash of each recovery code and when it was used, when the
app was set up and last used, the count of wrong codes in a row, and
whether Google sign-ins ask for a code. While a sign-in waits for its
code, who it is for and why it waits, and for a password reset a hash of
the new password until the code checks out.
- **Cookies**: the third cookie, `__Host-fctl-2fa`, which holds a
sign-in waiting for its code for 10 minutes.
- **Email**: the notices about two-factor changes, sign-ins with a
recovery code and wrong codes after a password, with the purpose and
legal basis (legitimate interests: account security) and Resend's row.
- **Retention**: two-factor data until it's turned off, reset or the
account deleted; new recovery codes replace the old; waiting sign-ins
expire after 10 minutes.
- **Rights and security**: the export includes two-factor sign-in
without its secrets, Settings corrects it, and the security summary
names the encrypted secrets and hashed recovery codes.

Merge it together with hyperstructure/fctl#103, when that deploys.
#23 adds passkeys, with hyperstructure/fctl#104.

Session: https://app.fctl.sh/s/ses_01M58KEJWPFJKBCENF5HKRV5HV

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant