Skip to main content
AI agents, MCP, and App Store Connect Level: Intermediate 14 min read

Keychain Storage and Token Signing: Protecting App Store Connect Credentials

How FlightDeck protects App Store Connect .p8 private keys using the macOS Keychain, in-memory ES256 JWT signing, and ephemeral local Bearer tokens without exposing secrets to AI models.

Published: 2026-11-01 • Last Updated: 2026-11-01 • Author: Kip Lawrence
Key MCP Tools: apps_list

Overview: The Credential Exposure Hazard

Connecting an AI coding assistant to Apple App Store Connect introduces a major security question: how do you grant an assistant the ability to automate metadata, builds, and releases without exposing your Apple Developer private key to an AI model?

An App Store Connect API Key (.p8 file) is an Elliptic Curve private key. If this key is pasted into an AI chat window or committed to a repository, anyone who obtains it can generate administrative JSON Web Tokens (JWTs) and access your Apple Developer account directly.

FlightDeck solves this by decoupling AI intent from cryptographic authorization:

  1. AI models never see your private key: Your AI assistant only issues abstract semantic tool calls across a local MCP socket (e.g., "List recent builds for app 12345"). It never receives, handles, or signs with your .p8 key.
  2. Encrypted Storage: Private keys are stored in the encrypted macOS Keychain (quest.kip.flightdeck.keys) using native Apple Security framework APIs.
  3. In-Memory Local Signing: When an authorized operation runs, FlightDeck retrieves the key into application memory, signs a short-lived ES256 JWT, dispatches the request directly to Apple over HTTPS, and discards the token upon expiration.

Anatomy of App Store Connect Credentials

To configure FlightDeck, you supply three primary identifiers generated in Apple's developer portal (Users and Access > Integrations > App Store Connect API):

TEXT
┌────────────────────────────────────────────────────────┐
│ App Store Connect API Key Components                  │
├───────────────────┬────────────────────────────────────┤
│ Key ID (kid)      │ 10-character string (e.g. 2X9R427) │
│ Issuer ID (iss)   │ UUID string (Team API keys only)   │
│ Private Key (.p8) │ PKCS#8 PEM Elliptic Curve Key      │
└───────────────────┴────────────────────────────────────┘

Team API Keys vs. Individual API Keys

FlightDeck supports both key types, adhering strictly to Apple's JWT specification:

  • Team API Keys: Owned by the organization. The JWT claims include iss (Issuer ID UUID) and the header includes kid (Key ID). Team keys provide access to all organizational apps, builds, and metadata.
  • Individual API Keys: Bound to an individual Apple account. The JWT claims omit iss and instead set 'sub': 'user'. Under Apple security policy, Individual keys cannot access financial, sales, or provisioning endpoints.

macOS Keychain Storage Architecture

FlightDeck stores .p8 private keys in the macOS Keychain using a dedicated service identifier:

  • Canonical Service Identifier: quest.kip.flightdeck.keys
  • Item Class: kSecClassGenericPassword
  • Account Identifier: Encoded connection profile reference (e.g., profile_<uuid>)

The Native Keychain Bridge

FlightDeck interfaces with Apple's Security.framework (SecItemAdd, SecItemCopyMatching, SecItemDelete) via an embedded native helper binary (keychain_bridge).

Important

Process Snooping Defense: Secret key material is streamed strictly through standard input (stdin) and received through standard output (stdout). Private keys are never passed as process command-line arguments (argv), preventing exposure to ps aux, process audit logs, or other unprivileged system inspection tools.

When you delete an account profile in FlightDeck Desktop, FlightDeck calls SecItemDelete, purging the private key from the macOS Keychain immediately.


Cryptographic Token Signing: ES256 JWT Generation

When FlightDeck needs to query or mutate state on Apple's servers, it constructs and signs an ephemeral JSON Web Token (JWT) in application memory.

1. Header Construction

Apple requires an Elliptic Curve Digital Signature Algorithm (ECDSA) with P-256 curve and SHA-256:

JSON
{
  "alg": "ES256",
  "kid": "2X9R427ADR",
  "typ": "JWT"
}

2. Claims Payload Construction

The payload strictly conforms to Apple's REST API requirements:

JSON
{
  "iss": "57246542-96fe-1a63-e053-0824d011072a",
  "iat": 1730505600,
  "exp": 1730506500,
  "aud": "appstoreconnect-v1"
}
  • iat (Issued At): The current UTC Unix timestamp in seconds.
  • exp (Expiration): The timestamp when the token expires. Apple enforces a hard maximum lifetime of 20 minutes (1,200 seconds). FlightDeck defaults to 15 minutes (900 seconds) to absorb any minor system clock skew without risking premature expiration.
  • aud (Audience): Strictly set to 'appstoreconnect-v1'.

3. Signature Execution

FlightDeck parses the PKCS#8 PEM private key into an ECPrivateKey object in memory and computes the ES256 digital signature. The signed JWT is placed into the Authorization: Bearer <jwt> HTTP header of requests sent directly to https://api.appstoreconnect.apple.com.


Understanding the Two Different Tokens

Developers frequently confuse the two distinct authentication tokens used in FlightDeck workflows:

Token Characteristic FlightDeck Local MCP Password / Bearer Token Apple App Store Connect API JWT
Purpose Protects the local loopback port (51122) when enabled Authorizes requests to Apple's REST API
Enforcement Policy Optional; disabled by default on local loopback Mandatory on every Apple REST API call
Created By Developer in Desktop Settings (or auto-generated) FlightDeck in-memory crypto engine
Used By AI Assistant (Cursor, Claude Code, Antigravity, etc.) FlightDeck internal HTTP client
Audience http://127.0.0.1:51122/mcp api.appstoreconnect.apple.com
Format Cryptographic random hex string (mcp_sec_...) ES256 (ECDSA P-256 with SHA-256 JWT)
Lifetime Persistent in Keychain until changed or cleared 15 minutes (short-lived, max 20 minutes)
Storage Location macOS Keychain (asc:mcp:http_password) & IDE Config Application RAM only (never written to disk)

Secret Compromise & Rotation Playbooks

If a credential is accidentally exposed, follow these immediate recovery playbooks:

Playbook 1: Local MCP Bearer Token Leaked

Scenario: You accidentally committed ~/.cursor/mcp.json containing your FlightDeck Bearer token to a public Git repository.

  1. Open FlightDeck Desktop.
  2. Navigate to Settings > MCP Server.
  3. Under Persistent MCP Password, click Generate (or enter a new strong password). FlightDeck instantly saves the new secret to the macOS Keychain (asc:mcp:http_password) and updates the active server; all subsequent requests using the old token receive HTTP 401 Unauthorized.
  4. Click Copy Setup Prompt to retrieve the updated configuration snippet.
  5. Update your client IDE settings file with the new token.
  6. Scrub the Git repository commit history or rotate repository visibility.

Playbook 2: Apple .p8 Private Key Compromised

Scenario: An engineer accidentally pasted a .p8 private key into a public forum, shared chat, or untrusted file upload.

  1. Log into the Apple App Store Connect Portal as an Account Holder or Admin.
  2. Navigate to Users and Access > Integrations > App Store Connect API.
  3. Locate the compromised Key ID in the list.
  4. Click Revoke. Apple immediately invalidates the key. FlightDeck can no longer sign new valid JWTs. (Note: Any previously signed in-flight JWTs will expire within at most 15 to 20 minutes).
  5. Click Generate API Key (+) to create a fresh key pair. Download the new .p8 file (Apple permits downloading this exactly once).
  6. In FlightDeck Desktop, open Settings > Connection Profiles, select your profile, click Edit, and import the replacement .p8 key.

Verifying Credential Health via Safe AI Prompt

You can confirm that your credentials and Keychain storage are working correctly without displaying sensitive secret material:

TEXT
Using FlightDeck, check the status of our active App Store Connect API key profile. Confirm whether the key is recognized as a Team or Individual key, verify tool access, and report how many apps are accessible. Do not display private key content or secret hashes.

What You Will Observe

  1. The assistant queries FlightDeck over MCP.
  2. FlightDeck checks the active profile in the macOS Keychain, generates a valid ES256 token, and executes an apps_list query.
  3. The assistant reports the profile name, key type, and visible application count. At no point is the private key transmitted across the MCP bridge.

Security Hygiene Checklist for Developers

To maintain strong security boundaries:

  • [ ] Add MCP Configs to .gitignore: Ensure .cursor/mcp.json, .gemini/config/mcp_config.json, and cline_mcp_settings.json are included in your global ~/.gitignore file.
  • [ ] Never Paste Private Keys in AI Chats: Your AI assistant never requires .p8 content to operate FlightDeck. If an assistant asks for a private key, refuse and check your MCP configuration.
  • [ ] Enforce Password Protection: In FlightDeck Desktop, keep Require Password enabled in MCP Server settings so external unprivileged local processes cannot access the socket without the session Bearer token.
  • [ ] Store Backups Securely: Keep your original downloaded .p8 backup files in an encrypted password manager or offline vault—never in your project root or unencrypted downloads folder.

Connect Your AI Agent to App Store Connect

FlightDeck runs locally on your Mac, keeping private keys secure in your macOS Keychain and executing mutations only after your explicit approval.

Download FlightDeck on Mac App Store