Private Store
Detailed explanation of the Private Store (Private Database sync) in TheCompanyApp.
Purpose
The Private Store syncs with CloudKit's Private Database, making data:
Accessible only by the user across their devices
Encrypted end-to-end by Apple
Never shared unless explicitly via CKShare
What Lives in Private Store
Entities
Companies (owned by this user)
UserPass (all credentials, never shared)
AccessControl (for all companies)
All company-scoped data for owned companies:
InventoryItem, Orders, Dispatch, Tasks, ContactsData, etc.
When Created
Company Creation:
CloudKit Representation
Private Database Zones:
com.apple.coredata.cloudkit.zone(default zone)Custom zones for each company (if using advanced features)
Record Types:
CD_CompaniesCD_UserPassCD_InventoryItemCD_Orders... (all entities)
Multi-Device Sync
Scenario: User owns Company A
Create company on iPhone → Saves to Private Store
CloudKit syncs to Private Database in iCloud
iPad (same Apple ID) polls Private Database
iPad downloads changes → Saves to Private Store on iPad
Company appears in app on iPad
Sync Time: Usually 1-30 seconds
UserPass Privacy
Critical: UserPass stays in Private Store only:
Effect: UserPass syncs to Private Database but never to Shared Database.
Access Control
Only accessible by:
The user on all their devices (same Apple ID)
No one else, even if company is shared
Related: Shared Store, Sync Architecture, Credential Storage
Last updated