Repository navigation
feat(cli): init apns --create-key creates the APNs key with the Apple ID - #1989
Closed
ArnabChatterjee20k wants to merge 3 commits into
Closed
ArnabChatterjee20k wants to merge 3 commits into
ArnabChatterjee20k wants to merge 3 commits into
Conversation
…loper portal Apple has no public API for APNs keys. The helper runs @expo/apple-utils 2.2.1 (MIT), the library eas-cli uses for the same job, from a small Node script embedded in the binary. It is installed into ~/.appwrite/apple with npm ci --ignore-scripts against a pinned lockfile, needs Node.js 18 or later, and keeps the Apple password out of the Keychain.
--create-key, or the new prompt option, signs in to the Apple Developer portal and creates a team-scoped APNs key. The .p8 is saved into the project folder right away, since Apple allows one download. When Node.js is missing or the sign-in fails, the browser and file options remain. When the team has no free key slot, the existing keys are listed and the command stops, asking for --key-path. Marked experimental.
🟢 Tier S · Ready to mergeAdds an experimental Latest changes: The latest commits let Apple sign-in choose a team when no team ID is known, then carry the selected team through key saving and APNs provider setup.
Note Not approving while a bug finding is open: Reject 📂 Walkthrough · 8
Reviewed the commits since |
A project without DEVELOPMENT_TEAM made init apns ask for the team ID before offering the Apple sign-in, which already knows the account's teams. The team question now waits until the key comes from a file or the browser; signing in picks the team, and apple-utils asks which one when the account has several.
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1963 (
init apns).What
appwrite init apns --create-keysigns in to the Apple Developer portal with the developer's Apple ID and creates a team-scoped APNs key, so the developer never visits the portal. The same option also appears in the "How would you like to provide the APNs auth key?" prompt. Marked experimental.How
Apple has no public API for APNs keys. The CLI runs a small Node script on top of
@expo/apple-utils2.2.1 (MIT), the library eas-cli uses for the same job (pushKey.ts).internal/appleembedshelper.js,package.jsonandpackage-lock.jsonwithgo:embed.~/.appwrite/apple/and runsnpm ci --ignore-scripts. The lockfile pins the exact package hash. It reinstalls only when the embedded files change.Auth.loginAsync({ teamId }), thenKeys.createKeyAsync(context, { name, isApns: true })andKeys.downloadKeyAsync.authState.contextis the request context, as in eas-cli'sgetRequestContext.EXPO_NO_KEYCHAIN=1keeps the Apple password out of the macOS Keychain. The password goes only to Apple. apple-utils caches the session cookie in~/.app-store/, shared with eas-cli, so a rerun skips two-factor.In
init apns:.p8is saved asAuthKey_<ID>.p8in the project folder (mode 0600, never overwriting) before anything else, because Apple allows one download. The git-ignore warning applies as usual.MaxKeysCreatedError), it lists the team's keys, links the portal's key list and stops, asking for--key-path. Revoking from the CLI is left for a later PR.--create-keyand--key-pathare mutually exclusive. When both providers already exist, a rerun reports "already set up" unless--force, so it never spends another key slot.Testing
internal/apple: Node version check, result decoding, and an end-to-end run with stand-innode/npm(installs once, passesEXPO_NO_KEYCHAIN=1, reads the result).internal/cmd: creates and saves the key and both providers, offers it from the prompt, falls back when the helper cannot run, and stops on a full team.npm ciof the embedded lockfile, and running the helper without a terminal reaches apple-utils' login and fails cleanly with a readable error.Later