Skip to content

Phase 1 sync: Accounts UI + Sign in with Apple + Keychain#196

Closed
Shpigford wants to merge 1 commit intomainfrom
sync
Closed

Phase 1 sync: Accounts UI + Sign in with Apple + Keychain#196
Shpigford wants to merge 1 commit intomainfrom
sync

Conversation

@Shpigford
Copy link
Copy Markdown
Owner

Summary

  • New Settings → Account tab with Sign in with Apple + email/password toggle.
  • AccountManager (@Observable) tracks currentUser + pendingAppleNonce; bootstrap() reads Keychain and calls /api/v1/me on launch.
  • SyncAPI is a thin URLSession client against the Rails backend (/auth/apple, /auth/users, /auth/sessions, /auth/sessions/current, /api/v1/me). Bearer = Authorization: Bearer <Session.token>.
  • KeychainStore wraps Security.framework for the session token.
  • Entitlement com.apple.developer.applesignin added to Clearly.entitlements and Clearly-AppStore.entitlements; AuthenticationServices.framework added to the Clearly target in project.yml.
  • ClearlyApp injects AccountManager.shared into the Settings scene and kicks off bootstrap() from init.

Pairs with the Rails server work in clearlymd/clearly#10.

Test plan

  • xcodegen generate && xcodebuild -scheme Clearly -configuration Debug build — green
  • Phase-0 regression: open an existing local vault, edit/save/search — still works
  • Settings → Account → Sign in with Apple → system sheet → signed-in state shows "Signed in as …"
  • Settings → Account → toggle "Create Account" → enter email + password → signed-in
  • Settings → Account → Sign Out → form reappears; token gone from Keychain Access.app
  • Quit (⌘Q), reopen, Settings → Account → persists as signed-in without prompting (this is the most important check — bootstrap() is doing its job)
  • Rails logs show POST /auth/apple 200 (no AppleIdentityToken::Unverified)

Blockers (Josh-side)

  • Enable Sign in with Apple capability on App IDs com.sabotage.clearly + com.sabotage.clearly.dev in the Apple Developer portal; regenerate provisioning profiles. Without this, the Debug build fails to code-sign; code itself is green (verified with CODE_SIGNING_ALLOWED=NO).

- AccountsSettingsView (Settings → Account tab) with SIWA button +
  email/password toggle (Create Account / Sign In).
- AccountManager: @observable, tracks currentUser + pendingAppleNonce;
  bootstrap() reads Keychain, calls /api/v1/me, clears on 401.
- SyncAPI: URLSession client for /auth/apple, /auth/users, /auth/sessions,
  /auth/sessions/current, /api/v1/me. Bearer: "Authorization: Bearer <token>".
- KeychainStore: thin Security.framework wrapper (save/read/delete).
- Entitlement: com.apple.developer.applesignin on both .entitlements files.
- project.yml: AuthenticationServices.framework dep on Clearly target.
- ClearlyApp: AccountManager.shared injected into Settings scene; bootstrap()
  fires from init.

Pairs with the server commit on sync-phase1 in the mumbai-v6 workspace
(server/ Rails app + docs). Phase 1 goals verified locally: curl smoke
passes against bin/rails server; Debug build green; no Phase-0 regressions.
Real SIWA smoke test requires the Apple Developer portal SIWA capability
enabled on com.sabotage.clearly + .dev App IDs (still Josh-side).

Ref: docs/sync/PROGRESS.md Phase 1 in the workspace repo.
@Shpigford Shpigford closed this Apr 17, 2026
@Shpigford Shpigford deleted the sync branch April 17, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant