Skip to content

feat(CodeSigningPlugin): auto-embed public key into native project files#1381

Open
bartekkrok wants to merge 2 commits intocallstack:mainfrom
bartekkrok:feat/code-signing-plugin-pubkey-auto
Open

feat(CodeSigningPlugin): auto-embed public key into native project files#1381
bartekkrok wants to merge 2 commits intocallstack:mainfrom
bartekkrok:feat/code-signing-plugin-pubkey-auto

Conversation

@bartekkrok
Copy link
Copy Markdown

@bartekkrok bartekkrok commented Apr 17, 2026

Linked to: #1323

Summary

Setting up code signing with CodeSigningPlugin required users to manually add the RSA public key to native project
files (Info.plist on iOS and strings.xml on Android). This is error-prone, easy to forget, and creates a
maintenance burden every time the key is rotated.

This PR adds two new optional config options — publicKeyPath and nativeProjectPaths — that automate public key
embedding during the build:

new CodeSigningPlugin({
  privateKeyPath: './keys/private.pem',
  publicKeyPath: './keys/public.pem',      // new                                                                      
  nativeProjectPaths: {                    // new, optional overrides
    ios: './ios/MyApp/Info.plist',                                                                                     
    android: './android/app/src/main/res/values/strings.xml',
  },                                                                                                                   
});

When publicKeyPath is set the plugin:

  • Auto-detects ios//Info.plist and android/app/src/main/res/values/strings.xml (standard RN project layout)
  • Inserts or updates the RepackPublicKey entry in each file on every build
  • Creates strings.xml if it doesn't exist yet
  • Accepts nativeProjectPaths to override either path for non-standard layouts
  • Logs a warning and skips gracefully if the key file or target files are not found

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

  • Add publicKeyPath pointing to a valid public key in CodeSigningPlugin config
  • Run a build and verify RepackPublicKey entry is inserted into ios//Info.plist
  • Run a build and verify RepackPublicKey entry is inserted into android/app/src/main/res/values/strings.xml
  • Run the build again and confirm the entry is updated, not duplicated
  • Remove strings.xml, run a build, and confirm the file is created with the key
  • Set publicKeyPath to a non-existent file and confirm a warning is logged, build continues
  • Use nativeProjectPaths to override paths and confirm the plugin writes to the specified files

Live demo iOS

Changes were tested on: https://github.com/callstack/super-app-showcase

Screen.Recording.2026-04-16.at.15.mp4

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.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 17, 2026

@bartekkrok is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 17, 2026

🦋 Changeset detected

Latest commit: dda6146

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Major
@callstack/repack-plugin-expo-modules Major
@callstack/repack-plugin-nativewind Major
@callstack/repack-plugin-reanimated Major
@callstack/repack-dev-server Major
@callstack/repack-init Major

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant