I have been trying to obfuscate the code for a while by using react-native-obfuscating-transformer. Everything seems okay but when I check the bundle.js. I can't see any obfuscated code.
PS: Currently, I try only for IOS.
Here are my config files.
metro.config.js
module.exports = {
transformer: {
babelTransformerPath: require.resolve('./transformer'),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
transformer.js
const obfuscatingTransformer = require('react-native-obfuscating-transformer');
module.exports = obfuscatingTransformer({
upstreamTransformer: require('metro-react-native-babel-transformer'),
enableInDevelopment: true,
obfuscatorOptions: {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.75,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
debugProtection: false,
debugProtectionInterval: false,
disableConsoleOutput: true,
identifierNamesGenerator: 'hexadecimal',
log: false,
numbersToExpressions: true,
renameGlobals: false,
rotateStringArray: true,
selfDefending: true,
shuffleStringArray: true,
simplify: true,
splitStrings: true,
splitStringsChunkLength: 10,
stringArray: true,
stringArrayEncoding: ['base64'],
stringArrayWrappersCount: 2,
stringArrayWrappersChainedCalls: true,
stringArrayWrappersType: 'variable',
stringArrayThreshold: 0.75,
transformObjectKeys: true,
unicodeEscapeSequence: false,
},
});
from How to obfuscate code in react-native for IOS
No comments:
Post a Comment