SPB Git

Repository Public

APPLE-AUTH-PASSKEY.md 4.8 KB 78 lines markdown

1# Authentication and passkeys in the native apps23The native apps use the **existing account and the existing passkey** of each site. Nothing is enrolled4separately for Apple devices and no second credential database exists.56| App | Site / WebAuthn RP ID | Bundle id | Associated domain |7|---|---|---|---|8| Claude Remote (macOS, iOS, iPadOS) | `claude.spboucher.ai` | `ai.spboucher.clauderemote` | `webcredentials:claude.spboucher.ai` |9| Codex Remote (macOS, iOS, iPadOS) | `codex.spboucher.ai` | `ai.spboucher.codexremote` | `webcredentials:codex.spboucher.ai` |1011The two sites are independent instances: each has its own account and its own passkey, on the web and in12the apps alike.1314## How the same passkey is used15161. The app declares the site in its Associated Domains entitlement; the site publishes17   `/.well-known/apple-app-site-association` listing `3YM54G49SN.<bundle id>` (and the `.dev` variant) under18   `webcredentials`. This is what lets the system offer the site's passkeys to the app.192. The app asks the server for WebAuthn request options and hands them to20   `ASAuthorizationPlatformPublicKeyCredentialProvider(relyingPartyIdentifier: <site>)`.213. The system sheet shows the passkey saved for the site and confirms with **Touch ID** (Mac) or **Face ID**22   (iPhone, iPad). The private key never leaves the platform authenticator.234. The signed assertion goes to the server, which verifies it exactly as for a browser: same RP ID, same24   expected origin (`https://<site>`), user verification required, signature counter checked, single-use25   server-side challenge valid 5 minutes.2627Condition outside the apps' control: the passkey must live in a store the device can reach — iCloud Keychain28(Passwords) or a credential-provider app. A passkey created in a browser profile that does not sync, or on a29hardware key, will not appear on another device. In that case sign in with the password and register an30additional passkey from the app (Settings → Security), which uses the server's normal registration route.3132## Sign-in paths (identical to the website)3334| Path | Steps | Server routes |35|---|---|---|36| Passkey | Touch ID / Face ID | `POST /native/auth/passkey/options` → `…/verify` (with the single-use `challengeToken` and the device description) |37| Password + passkey | password, then Touch ID / Face ID | `POST /native/auth/login` → `passkey/options` → `passkey/verify` |38| Password + TOTP (when enrolled) | password, then 6-digit code | `POST /native/auth/login` → `POST /native/auth/totp` |3940The second factor stays mandatory after a password. Throttling, lockout and audit are those of the web41routes. The website already accepts a passkey with user verification on its own; the apps do the same and42add nothing beyond it.4344## What the app holds after sign-in4546- A **native session** (`client_kind = 'native'`) with a bearer token valid one hour. Only its SHA-256 is47  stored by the server. Cookie sessions and bearer sessions are not interchangeable.48- A **device key**: P-256, generated on the device, in the Secure Enclave when the hardware has one,49  non-exportable. Its public key is recorded with the session. Renewing the token requires signing a fresh50  server challenge with it, so a copied token alone stops working within the hour.51- Session id, token and expiry are kept in the Keychain (`AfterFirstUnlockThisDeviceOnly`), never in52  preferences, never logged.5354Lifetimes: token 1 h; session idle 14 days; absolute 30 days, then a full sign-in is required again.5556## Local lock is not sign-in5758The optional app lock (Touch ID on Mac, Face ID on iPhone/iPad, device passcode as fallback, auto-lock after59inactivity) only hides the app's content on the device. It does not talk to the server and does not replace60the passkey. Destructive actions (terminating a session, deleting files, revoking a device) ask for it again.6162## Revocation6364Website → Settings → Devices and sessions lists every native device (name, model, app version, last use)65with "Sign out". Revoking closes the device's WebSockets at once (4401), drops its push token and makes its66token and device key useless. The same list is available inside the apps. Changing the password revokes all67other sessions.6869## Verified and not verified7071| Item | Status |72|---|---|73| Server: bearer/cookie separation, expiry, refresh signature, replay, revocation | automated tests (53 new) + 35 live checks on the dev stack |74| Swift client: all sign-in branches, refresh, revocation | unit tests + 8 live integration tests, with a software authenticator standing in for the platform |75| AASA files served in production for both sites | checked by HTTP from outside |76| System passkey sheet with the owner's real passkey, Touch ID / Face ID | **not verified** — needs the owner on a signed build |77| Secure Enclave key under real entitlements | **not verified** on hardware |78
Files main
Menu

Theme