feat(CodeSigningPlugin): auto-embed public key into native project files#1381
feat(CodeSigningPlugin): auto-embed public key into native project files#1381bartekkrok wants to merge 4 commits intocallstack:mainfrom
Conversation
Add publicKeyPath and nativeProjectPaths options to CodeSigningPlugin. When publicKeyPath is set, the plugin automatically embeds the public key into iOS Info.plist and Android strings.xml during compilation, removing the need for manual setup. Also exports embedPublicKey as a standalone utility.
|
@bartekkrok is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: be8801c The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
MikitasK
left a comment
There was a problem hiding this comment.
very solid work done 👍👍
I verified both Android & iOS platforms & auto-embeding works perfectly fine 🚀
iOS
Screen.Recording.2026-04-20.at.18.33.16.mp4
Android
Screen.Recording.2026-04-20.at.19.39.58.mp4
here are just a few things to consider before merge:
|
@bartekkrok please check the linting 🙏 |
|
@bartekkrok can you check the conflicts here? |
| const publicKeyPath = resolveProjectPath( | ||
| projectRoot, | ||
| this.config.publicKeyPath | ||
| )!; |
There was a problem hiding this comment.
this ! seems like it would be better to avoid, perhaps we can just handle the undefined case
| const privateKeyPath = resolveProjectPath( | ||
| compiler.context, | ||
| this.config.privateKeyPath | ||
| )!; |
There was a problem hiding this comment.
same thing about the ! here
| let content = fs.readFileSync(plistPath, 'utf-8'); | ||
|
|
||
| const existingKeyPattern = | ||
| /[ \t]*<key>RepackPublicKey<\/key>\s*<string>[\s\S]*?<\/string>/; |
There was a problem hiding this comment.
I wonder if regex is the right move here
fast-xml-parser and plist or @plist/parse / @plist/plist
could probably be used to be more accurate/robust.
what do you think?
There was a problem hiding this comment.
I guess the tradeoff would be plist parsing could be slower
| return; | ||
| } | ||
|
|
||
| const result = embedPublicKey({ |
There was a problem hiding this comment.
I wonder if we would want to think of a way to not always try to embed, like some kind of cache or something if we know it was already embedded? Maybe not worth the effort though, what do you think?
Linked to: #1323
Summary
Setting up code signing with
CodeSigningPluginrequired users to manually add the RSA public key to native projectfiles (
Info.pliston iOS andstrings.xmlon Android). This is error-prone, easy to forget, and creates amaintenance burden every time the key is rotated.
This PR adds two new optional config options —
publicKeyPathandnativeProjectPaths— that automate public keyembedding during the build:
When publicKeyPath is set the plugin:
The embedding logic lives in the new embedPublicKey.ts module, also exported publicly for standalone use.
Both platforms are idempotent — re-running the build updates the existing entry rather than duplicating it.
Test plan
Live demo iOS
Changes were tested on: https://github.com/callstack/super-app-showcase
Screen.Recording.2026-04-16.at.15.mp4