cometchat-ios-production
Ship a CometChat iOS (Swift) integration safely — server-minted auth tokens instead of the Auth Key, keeping secrets out of the app binary, and a pre-launch checklist. Triggers: 'is my cometchat ios production ready', 'auth token instead of auth key swift', 'secure cometchat ios', 'going live checklist ios', 'harden cometchat swift before launch'.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- cometchat-ios-production
- license
- MIT
- metadata
- { "tags": "cometchat ios swift production security auth-token hardening appstore", "author": "CometChat", "version": "1.0.0" }
- description
- Ship a CometChat iOS (Swift) integration safely — server-minted auth tokens instead of the Auth Key, keeping secrets out of the app binary, and a pre-launch checklist. Triggers: 'is my cometchat ios production ready', 'auth token instead of auth key swift', 'secure cometchat ios', 'going live checklist ios', 'harden cometchat swift before launch'.
- compatibility
- CometChatUIKitSwift 5.2.3+ (Up to Next Major; resolves CometChatSDK 4.1.10+); Xcode 16+; iOS 15.1+; SPM only
03 SKILL.md 正文
Ground truth:
CometChatUIKitSwift5.2.3 +CometChatSDK4.1.10 (symbols verified vscatalogs/ios-v5.json). The login/auth-token API is FETCHED viacometchat-ios-core/references/docs-map.md; the REST auth-token endpoint is{DOCS_BASE}/rest-api/auth-tokens. The iOS UI Kit docs have no single production-hardening page — this checklist is the pack's own guidance fromRULES.md§4 +cometchat-ios-core/references/setup-credentials.md, labelled as such. Tracked DOCS GAP.
Companion skills (read first)
cometchat-ios-core—references/setup-credentials.md(theSecrets.xcconfig→ Info.plist →Bundle.mainflow) andreferences/swiftui.md(the init→login launch hook) this hardens.cometchat-security— the enterprise auth model this client-side hardening plugs into: wiring your IdP / SSO into the token flow (your IdP → your server → mint the CometChat auth token; CometChat is not an IdP), token expiry/refresh + re-login, RBAC roles + group (SBAC) scopes, and Auth Key vs auth token vs REST API Key. Load it for a security review or any SSO question.
Use this skill when
Moving off the development setup: TestFlight/App Store submission, a security review, or "is this safe to ship."
The one thing that matters
Never embed the Auth Key in the app binary.
The Auth Key can mint a session for any user in your app. Anything baked into the app — an xcconfig value promoted into Info.plist, a string constant — is recoverable from the shipped .ipa (strings, class-dump). Treat it as public.
| Development | Production | |
|---|---|---|
| Login | CometChatUIKit.login(uid:...) |
CometChatUIKit.login(authToken:...) |
| Auth Key | in Secrets.xcconfig |
not in the build |
| Token source | n/a | your backend, per authenticated user |
| REST API Key | never in the app | server only |
The production login flow
- Your app authenticates the user (your own auth / sign-in with Apple / your backend).
- Your server mints a CometChat auth token for that user's UID via the REST API using the REST API Key (
{DOCS_BASE}/rest-api/auth-tokens). - The server returns the token to the app over an authenticated HTTPS request.
- The app calls
login(authToken:).
// UID comes from the SERVER session, never from the client
let authToken = try await fetchCometChatToken() // your authenticated endpoint
CometChatUIKit.login(authToken: authToken) { result in /* handle success/failure */ }
init must resolve first (initFromSettings), then login — calling login before init resolves fails silently (cometchat-ios-core).
Keep secrets out of the build
Development reads the Auth Key from a gitignored Secrets.xcconfig promoted into Info.plist. For production, ship App ID + Region only (not secrets — they identify the app) and log in with a token; leave the Auth-Key value empty in the release configuration.
# after an archive/build, confirm the key is not in the app binary
strings "$APP_BUNDLE/YourApp" | grep -q "<your-auth-key>" && echo "LEAK" || echo "clean"
Also verify Secrets.xcconfig is in .gitignore (only a committed placeholder), and that it is not bundled as a resource.
Also before launch
- Users are created server-side as part of signup — not from the app with the Auth Key.
- Log out properly:
CometChatUIKit.logout(), then clear derived state and unregister VoIP/APNs push tokens (cometchat-ios-push). - Pin exact versions — the kit is a prebuilt binary compiled against one Chat SDK version; a drifting
CometChatSDKbreaks it (cometchat-ios-coreInstall). - App Transport Security: keep HTTPS; do not add broad
NSAllowsArbitraryLoadsexceptions. - Calls need permissions:
NSCameraUsageDescription+NSMicrophoneUsageDescriptionwith real strings, or App Review rejects; VoIP push needs the entitlement. - Region must match the dashboard app.
- Enable dashboard extensions/AI on the PRODUCTION app, not just dev.
Pre-launch checklist
- [ ] Auth Key not in the app binary (
strings-verified) - [ ]
login(authToken:)in production; UID from the server session - [ ] REST API Key server-side only
- [ ]
Secrets.xcconfiggitignored; only a placeholder committed - [ ] Exact kit/SDK/Calls versions pinned
- [ ] Camera/mic usage strings + VoIP entitlement present (if calling)
- [ ] Logout clears session, state and push tokens
- [ ] Dashboard extensions/AI enabled for the production app
- [ ] Tested against the production app's credentials
Common pitfalls
- Auth Key recoverable from the
.ipa— the critical one. - Token endpoint trusting a client-supplied UID — impersonation.
- Login before init resolves — silent no-render (order invariant).
- Missing usage-description strings — App Review rejection for calling apps.
- Dashboard configured on the dev app only — features silently missing in production.
Verify it works
Archived build's binary contains no Auth Key (strings) · login works via token · a tampered UID is rejected by the server · logout fully clears · calls request permission and connect · features enabled on the production app.
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.