
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
@bytehide/react-native-shield
Advanced tools
This README provides step-by-step instructions for integrating and using the ByteHide React Native Shield Plugin for obfuscating your React Native project's source code.
Install the plugin as a development dependency in your project:
npm install @bytehide/react-native-shield --save-dev
You can create a standalone script to perform obfuscation manually.
obfuscate.js
, and add the following: const shield = require('@bytehide/react-native-shield');
const distDir = './dist'; // Path to the dist directory
const projectToken = 'your_project_token'; // Project token
const replace = true; // Whether to replace the original files or save as new files
const excludePatterns = []; // Patterns to exclude from obfuscation
const obfuscatedExtension = '.obf'; // Extension for obfuscated files
shield
.obfuscate(distDir, projectToken, replace, excludePatterns, obfuscatedExtension)
.then(() => console.log('Obfuscation completed successfully!'))
.catch((err) => console.error('Error during obfuscation:', err));
Run the script manually when needed:
node obfuscate.js
package.json
ScriptsInclude the obfuscation step as a script in your project's package.json
:
Modify package.json
:
"scripts": {
"obfuscate": "node obfuscate.js"
}
Execute the obfuscation script:
npm run obfuscate
build.gradle
)Add a custom task to android/app/build.gradle
:
task obfuscateJs(type: Exec) {
commandLine "node", "${project.rootDir}/obfuscate.js"
}
preBuild.dependsOn obfuscateJs
Go to Build Phases > + Add Run Script Phase in Xcode.
Add the following script:
node "$SRCROOT/../obfuscate.js"
You can integrate the obfuscation step as a custom React Native CLI command.
react-native.config.js
: module.exports = {
commands: [
{
name: 'obfuscate',
func: () => {
const shield = require('@bytehide/react-native-shield');
const distDir = './dist'; // Path to the dist directory
const projectToken = process.env.BYTEHIDE_PROJECT_TOKEN || 'your_project_token';
if (projectToken === 'your_project_token') {
console.error('Project token is required. Please provide it as an argument or set the BYTEHIDE_PROJECT_TOKEN environment variable.');
process.exit(1);
}
// Optional parameters: replace, excludePatterns, obfuscatedExtension
const replace = false; // If true, the original files will be replaced with the obfuscated files
const excludePatterns = []; // Patterns to exclude from obfuscation
const obfuscatedExtension = '.obf'; // Extension for obfuscated files
shield
.obfuscate(distDir, projectToken, replace, excludePatterns, obfuscatedExtension)
.then(() => console.log('Obfuscation completed successfully!'))
.catch((err) => console.error('Error during obfuscation:', err));
},
},
],
};
Run the command:
npx react-native obfuscate
bin
CommandYou can use the bin
command to obfuscate your project.
npx @bytehide/react-native-shield obfuscate --src ./dist --projectToken your_project_token --replace false --obfuscatedExtension .obf --exclude "*.test.js, *.spec.js"
This command will obfuscate the files in the ./dist
directory, excluding any files matching the patterns *.test.js
and *.spec.js
.
MIT
Happy coding but keep it safe with @bytehide/react-native-shield
! 🛡️
FAQs
React Native plugin for ByteHide Shield obfuscation.
The npm package @bytehide/react-native-shield receives a total of 1 weekly downloads. As such, @bytehide/react-native-shield popularity was classified as not popular.
We found that @bytehide/react-native-shield demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.