From ecec7f324e839b96f1f85181eddbdef95c9d017a Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Wed, 11 Jun 2025 04:48:54 -0700 Subject: [PATCH] Implement signing for React Native core (#51919) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51919 Implement signing for the React Native core XCFramework The implementation follows the same approach we used for the ReactNativedependencies archive ## Changelog [Internal] - Reviewed By: cortinico Differential Revision: D76337972 fbshipit-source-id: 74f61c087b31e4087752cd60bea59db15f00321b --- packages/react-native/scripts/ios-prebuild.js | 8 +++++++- .../scripts/ios-prebuild/xcframework.js | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/react-native/scripts/ios-prebuild.js b/packages/react-native/scripts/ios-prebuild.js index 0e71fea00d8..1c7319ba7ed 100644 --- a/packages/react-native/scripts/ios-prebuild.js +++ b/packages/react-native/scripts/ios-prebuild.js @@ -71,7 +71,13 @@ async function main() { if (cli.tasks.compose) { const productsFolder = computeProductsFolder(outputFolder); const frameworkPaths = computeFrameworkPaths(productsFolder); - buildXCFrameworks(root, buildFolder, frameworkPaths, buildType); + buildXCFrameworks( + root, + buildFolder, + frameworkPaths, + buildType, + cli.identity, + ); } // Done! diff --git a/packages/react-native/scripts/ios-prebuild/xcframework.js b/packages/react-native/scripts/ios-prebuild/xcframework.js index c2740a1ae2e..ffecf7a74e2 100644 --- a/packages/react-native/scripts/ios-prebuild/xcframework.js +++ b/packages/react-native/scripts/ios-prebuild/xcframework.js @@ -138,6 +138,10 @@ function buildXCFrameworks( fs.mkdirSync(outputFolder, {recursive: true}); execSync(`cp -r ${symbol} ${outputFolder}`); }); + + if (identity) { + signXCFramework(identity, outputPath); + } } function copyHeaderFiles( @@ -353,6 +357,16 @@ function extractDestinationFromPath(symbolPath /*: string */) /*: string */ { `Impossible to extract destination from ${symbolPath}. Valid destinations are iphoneos, iphonesimulator and catalyst.`, ); } + +function signXCFramework( + identity /*: string */, + xcframeworkPath /*: string */, +) { + console.log('Signing XCFramework...'); + const command = `codesign --timestamp --sign "${identity}" ${xcframeworkPath}`; + execSync(command, {stdio: 'inherit'}); +} + module.exports = { buildXCFrameworks, };