SPB Git

Repository Public

APPLE-AUTH-PASSKEY.md 4.8 KB

# Authentication and passkeys in the native apps

The native apps use the existing account and the existing passkey of each site. Nothing is enrolled separately for Apple devices and no second credential database exists.

App Site / WebAuthn RP ID Bundle id Associated domain
Claude Remote (macOS, iOS, iPadOS) claude.spboucher.ai ai.spboucher.clauderemote webcredentials:claude.spboucher.ai
Codex Remote (macOS, iOS, iPadOS) codex.spboucher.ai ai.spboucher.codexremote webcredentials:codex.spboucher.ai

The two sites are independent instances: each has its own account and its own passkey, on the web and in the apps alike.

# How the same passkey is used

  1. The app declares the site in its Associated Domains entitlement; the site publishes /.well-known/apple-app-site-association listing 3YM54G49SN.<bundle id> (and the .dev variant) under webcredentials. This is what lets the system offer the site's passkeys to the app.
  2. The app asks the server for WebAuthn request options and hands them to ASAuthorizationPlatformPublicKeyCredentialProvider(relyingPartyIdentifier: <site>).
  3. The system sheet shows the passkey saved for the site and confirms with Touch ID (Mac) or Face ID (iPhone, iPad). The private key never leaves the platform authenticator.
  4. The signed assertion goes to the server, which verifies it exactly as for a browser: same RP ID, same expected origin (https://<site>), user verification required, signature counter checked, single-use server-side challenge valid 5 minutes.

Condition outside the apps' control: the passkey must live in a store the device can reach — iCloud Keychain (Passwords) or a credential-provider app. A passkey created in a browser profile that does not sync, or on a hardware key, will not appear on another device. In that case sign in with the password and register an additional passkey from the app (Settings → Security), which uses the server's normal registration route.

# Sign-in paths (identical to the website)

Path Steps Server routes
Passkey Touch ID / Face ID POST /native/auth/passkey/options → …/verify (with the single-use challengeToken and the device description)
Password + passkey password, then Touch ID / Face ID POST /native/auth/login → passkey/options → passkey/verify
Password + TOTP (when enrolled) password, then 6-digit code POST /native/auth/login → POST /native/auth/totp

The second factor stays mandatory after a password. Throttling, lockout and audit are those of the web routes. The website already accepts a passkey with user verification on its own; the apps do the same and add nothing beyond it.

# What the app holds after sign-in

  • A native session (client_kind = 'native') with a bearer token valid one hour. Only its SHA-256 is stored by the server. Cookie sessions and bearer sessions are not interchangeable.
  • A device key: P-256, generated on the device, in the Secure Enclave when the hardware has one, non-exportable. Its public key is recorded with the session. Renewing the token requires signing a fresh server challenge with it, so a copied token alone stops working within the hour.
  • Session id, token and expiry are kept in the Keychain (AfterFirstUnlockThisDeviceOnly), never in preferences, never logged.

Lifetimes: token 1 h; session idle 14 days; absolute 30 days, then a full sign-in is required again.

# Local lock is not sign-in

The optional app lock (Touch ID on Mac, Face ID on iPhone/iPad, device passcode as fallback, auto-lock after inactivity) only hides the app's content on the device. It does not talk to the server and does not replace the passkey. Destructive actions (terminating a session, deleting files, revoking a device) ask for it again.

# Revocation

Website → Settings → Devices and sessions lists every native device (name, model, app version, last use) with "Sign out". Revoking closes the device's WebSockets at once (4401), drops its push token and makes its token and device key useless. The same list is available inside the apps. Changing the password revokes all other sessions.

# Verified and not verified

Item Status
Server: bearer/cookie separation, expiry, refresh signature, replay, revocation automated tests (53 new) + 35 live checks on the dev stack
Swift client: all sign-in branches, refresh, revocation unit tests + 8 live integration tests, with a software authenticator standing in for the platform
AASA files served in production for both sites checked by HTTP from outside
System passkey sheet with the owner's real passkey, Touch ID / Face ID not verified — needs the owner on a signed build
Secure Enclave key under real entitlements not verified on hardware
Files main
Menu

Theme