Testing phase 6 (iOS) on an iPhone
This guide covers what couldn't be tested in the simulator:
- real Face ID with the Secure Enclave key, also from the extension;
- AutoFill on an iPhone and its memory in release;
- real APNs notifications, in sandbox and in production;
- TestFlight.
First, what is needed has to be created in the Apple account (§1).
- Time: an hour the first time (the Apple account and the first build take the longest).
- Isolated: use a test Klav account on a test server. The
iPhone doesn't touch your
~/.klav. Step 9 deletes everything. - The steps marked [Face ID] ask for your face.
0. Requirements
- A Mac with Xcode 26 or newer, XcodeGen (
brew install xcodegen) and Rust (rustup). - An iPhone with Face ID and iOS 18 or newer, in developer mode (Settings › Privacy & Security › Developer Mode).
- The Apple Developer account of team
SZ3F58F8LX, signed in in Xcode (Settings › Accounts). - A Klav server with HTTPS that the iPhone can reach. Klav only
accepts
http://to127.0.0.1, sohttp://<IP del Mac>won't do. Options: your deployed server, or a local one behind an HTTPS tunnel (Tailscaleserve,cloudflared). See self-hosting.md.
1. What you have to create in your Apple account
None of this was done in phase 6: your account wasn't touched.
Identifiers (developer.apple.com › Certificates, IDs & Profiles › Identifiers). If you use another prefix, change it in
Local.xcconfigand in the server'stopic.- App ID
dev.klav.ioswith the App Groups, AutoFill Credential Provider, Push Notifications and Data Protection (Complete Protection) capabilities. - App ID
dev.klav.ios.credentialswith App Groups, AutoFill Credential Provider and Data Protection. - App Group
group.dev.klav.ios, assigned to both App IDs.
With automatic signing, Xcode can create them on its own the first time you build for the iPhone (step 2). Check afterwards that the capabilities ended up as above.
- App ID
APNs key (Keys › +, "Apple Push Notifications service"):
- download the
.p8, which can only be downloaded once; - note the Key ID;
- keep the file outside the repository, with
0600permissions.
The same key works for sandbox and production.
- download the
Certificates and profiles: there is no need to create them by hand. Xcode and
scripts/ios/archive.shuse automatic signing (-allowProvisioningUpdates).App Store Connect › Apps › +: iOS platform, name "Klav", primary language Spanish, bundle ID
dev.klav.iosand an SKU (for exampleklav-ios).For external TestFlight (internal doesn't need review):
- test information: a contact email and notes for testers;
- a privacy policy URL;
- the app's privacy answers (Klav doesn't collect data for the developer; the server is each person's own).
Encryption (export compliance): the
Info.plistdeclaresITSAppUsesNonExemptEncryption = false. That is what Apple saved when Omar answered the questionnaire for build 2 (standard algorithms, not France), so the following builds don't ask for it again. If Klav adds encryption that isn't standard, change the key and answer the questionnaire in App Store Connect.
2. Installing on the iPhone from Xcode
cd ~/dev/klav
cp apps/ios/Config/Local.xcconfig.example apps/ios/Config/Local.xcconfig
# DEVELOPMENT_TEAM = SZ3F58F8LX (ya viene así)
scripts/ios/build-xcframework.sh
cd apps/ios && xcodegen generate && open Klav.xcodeprojIn Xcode:
- Choose your iPhone as the destination and press ▶ (Klav scheme, Debug configuration).
- The first time, on the iPhone go to Settings › General › VPN & Device Management and trust your development certificate.
3. Real Face ID
- Open Klav and sign in to the test server with a new account
(create it first with
klav signupon the Mac, in a throwawayKLAV_HOME). - Expected:
- Face ID isn't asked for on signing in: the first unlock with the password enrolls it;
- Settings › Face ID is on and the text below it does not mention the simulator.
- Press "Lock" and then "Use Face ID" [Face ID]. The vault opens.
- Lock, cancel the Face ID dialog and type the password. It also opens the vault.
- Change the enrolled faces (the iPhone's Settings › Face ID & Passcode › set up an alternate appearance). Expected: on returning, Klav asks for the master password. Afterwards Face ID works again.
- Restart the iPhone. Expected: Klav asks for the password, because Face ID requires it after a restart.
4. AutoFill in Safari
- After signing in, the app shows how to turn on Klav. Press "Open AutoFill & Passwords" and turn on Klav. Expected: that Settings page opens and, on returning to Klav, the screen's checkbox fills and closes on its own. If it was already on, turn it on in the iPhone's Settings › General › AutoFill & Passwords.
- In the app, create a login for a test site that has a
form (or use
examples/login-siteexposed with the same HTTPS tunnel). - Open the site in Safari and tap the username field. Expected: the keyboard suggests Klav's username.
- Tap the suggestion [Face ID]. Expected: the username and password are filled. This is the key test: the extension opens the Secure Enclave key the app saved.
- Tap the keyboard's key › Klav [Face ID]. Expected: the "Choose how to sign in" list appears, and "Fill" fills.
- In a one-time code field (with an item that has TOTP) [Face ID]. Expected: the 6 digits are filled.
- Open a site with another host and ask for Klav from the key. Expected: the list comes up empty, because Klav doesn't offer that item.
5. Real APNs notifications
Configure the test server with the key from step 1.2 (self-hosting.md §2.4):
KLAV_APNS_KEY_PATH=/ruta/AuthKey_XXXXXXXXXX.p8 KLAV_APNS_KEY_ID=XXXXXXXXXX KLAV_APNS_TEAM_ID=SZ3F58F8LX KLAV_APNS_TOPIC=dev.klav.iosRestart the server. If the key isn't valid, the server doesn't start.
On the iPhone, open Klav and unlock. Accept notifications. Expected:
- Settings › Agent notifications says "On for this iPhone";
- in the server's database,
push_tokenshas a row withsandbox(an Xcode build uses the sandbox).
Close Klav (swipe it out of the app switcher). On the Mac, register a throwaway agent:
KLAV_HOME=~/klav-prueba-f6/agente klav agent register --name prueba \ --server https://<tu servidor> --email <correo de prueba> --key-store fileExpected: "An agent wants to join" arrives. The notification doesn't say which agent it is.
Tap the notification [Face ID]. Expected: the "New agent" sheet opens with the same six words as the terminal, numbered in the same order. Check a project (its chip shows ✓) and press "They match: approve" [Face ID].
klav agent statussaysactive.With the app closed:
KLAV_HOME=~/klav-prueba-f6/agente klav agent totp "klav://<Bóveda>/<Proyecto>/<Elemento>" \ --agent prueba --reason "probar avisos" --wait 3mExpected: "An agent is asking for permission" arrives. On tapping it, the card shows highlighted with a cobalt border. "Approve once" [Face ID] and the terminal receives the code.
Sign out on the iPhone. Expected:
push_tokensis left empty and no more notifications arrive.
6. The extension's memory in release
- In Xcode, Product › Scheme › Edit Scheme › Run › Build Configuration: Release. Install again.
- Mac › Console › your iPhone. Filter by
subsystem:dev.klav.ios category:autofill. - Fill a password as in §4. Expected: the
footprint …lines stay close to or below what was measured in the simulator with Debug (≈ 29–32 MiB, see ios.md §3), and the fill isn't interrupted. If the extension closes on its own halfway through the fill, iOS killed it for using too much memory. Note the values in ios.md §3.
7. TestFlight
scripts/ios/archive.sh check # comprueba que compila para el dispositivo
scripts/ios/archive.sh upload # firma, archiva y sube a App Store Connect- In App Store Connect › TestFlight, wait for the build to finish processing. Add yourself as an internal tester.
- Install from the TestFlight app. This build uses production
APNs: repeat §5 and check that
push_tokenssaysproduction. - For the next upload, bump
CFBundleVersioninKlav/Info.plistandCredentials/Info.plist.
8. What was already tested in the simulator
- Signing in, unlocking and locking, with simulated Face ID.
- Viewing, searching, creating, editing and moving to the trash.
- AutoFill of passwords and codes, the list, "Open Klav first" and the QuickType suggestions.
- The APNs token registered and deleted on signing out.
- Notifications with
simctl push, in Spanish, that lead to their request. - Approving an agent by comparing the words.
- Approve once, approve 15 min and deny.
- The new interface (diseno-visual) in light and dark, the vault with large accessibility text, and "Show" and the light that floods the lock on unlock, recorded on video.
9. Cleaning up
- Delete the app from the iPhone (long-press the icon › Delete App). That also deletes the App Group container.
- Turn off Klav in AutoFill & Passwords, if it is still in the list.
- Delete
~/klav-prueba-f6and the test account from the server. - Remove the
.p8key from the test server if you won't use it any more.