Skip to content

feat(ios): add auth services — KeychainService, AuthManager, APIClient#72

Merged
ZingerLittleBee merged 1 commit intodhakafrom
unit2-ios-auth-services
Mar 28, 2026
Merged

feat(ios): add auth services — KeychainService, AuthManager, APIClient#72
ZingerLittleBee merged 1 commit intodhakafrom
unit2-ios-auth-services

Conversation

@ZingerLittleBee
Copy link
Copy Markdown
Owner

Summary

  • KeychainService: Generic Security.framework wrapper (SecItemAdd/SecItemCopyMatching/SecItemDelete) for persisting tokens, user data, server URL, and installation ID under the com.serverbee.mobile service namespace.
  • InstallationID: Stable UUID v4 persisted in Keychain, surviving app reinstalls.
  • AuthManager: @Observable auth state manager that restores Keychain state on launch, validates sessions via token refresh, and exposes reactive isAuthenticated/user/isLoading for SwiftUI. @MainActor isolation on all UI-mutating methods.
  • APIClient: actor-based HTTP client with automatic Bearer token attachment, 401 auto-refresh with a single retry, and coalesced concurrent refresh requests via CheckedContinuation.
  • Model types: MobileUser, MobileTokenResponse, ApiResponse<T>, auth request DTOs with explicit CodingKeys for snake_case mapping.
  • App shell: Minimal ServerBeeApp, project.yml (XcodeGen), and Info.plist for build verification.

All files target iOS 17+, Swift 6.0 strict concurrency (@unchecked Sendable, actor, @MainActor). Builds with zero Swift warnings.

Test plan

  • xcodegen generate succeeds
  • xcodebuild build succeeds with zero Swift warnings on iPhone 17 Pro simulator
  • Manual verification: token persistence survives app restart
  • Manual verification: 401 response triggers single refresh + retry

Implement Unit 2 of the iOS companion app: networking and authentication
infrastructure.

- KeychainService: generic Security.framework wrapper for token/user persistence
- InstallationID: stable UUID persisted in Keychain across reinstalls
- AuthManager: @observable auth state with Keychain restore and token refresh
- APIClient: actor-based HTTP client with automatic 401 retry and coalesced
  token refresh
- Model types: MobileUser, MobileTokenResponse, ApiResponse, auth request DTOs
- Minimal app shell (ServerBeeApp, project.yml, Info.plist) for build verification

Targets iOS 17+, Swift 6.0 strict concurrency. Builds with zero warnings.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
server-bee-docs Ready Ready Preview, Comment Mar 28, 2026 3:47pm

@ZingerLittleBee ZingerLittleBee merged commit 9527c5b into dhaka Mar 28, 2026
2 checks passed
@ZingerLittleBee ZingerLittleBee deleted the unit2-ios-auth-services branch March 28, 2026 16:59
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