Cometchat ios production

From cometchat/cometchat-skills · View interactive version

Cometchat ios production is an AI agent skill from the GitHub repository cometchat/cometchat-skills. 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 checkl

How to use this skill

Skill file

Ground truth: CometChatUIKitSwift 5.2.3 + CometChatSDK 4.1.10 (symbols verified vs catalogs/ios-v5.json). The login/auth-token API is FETCHED via cometchat-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 from RULES.md §4 + cometchat-ios-core/references/setup-credentials.md, labelled as such. Tracked DOCS GAP.

Companion skills (read first)

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

  1. Your app authenticates the user (your own auth / sign-in with Apple / your backend).
  2. 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).
  3. The server returns the token to the app over an authenticated HTTPS request.
  4. 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

Pre-launch checklist

Common pitfalls

  1. Auth Key recoverable from the .ipa — the critical one.
  2. Token endpoint trusting a client-supplied UID — impersonation.
  3. Login before init resolves — silent no-render (order invariant).
  4. Missing usage-description strings — App Review rejection for calling apps.
  5. 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.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.