The cause of
Since jsbundle files can be easily viewed as source code, you can use Rn-debundle to view them. This is very deadly to the security of the code, so we need to encrypt the file, using AES 128 encryption, decryption is also very fast.
plan
- Modify the source code
RCTJavaScriptLoader.mm
+ (void)loadBundleAtURL:(NSURL *)scriptURL
onProgress:(RCTSourceLoadProgressBlock)onProgress
onComplete:(RCTSourceLoadBlock)onComplete {
/** If the load fails, load it asynchronously. Simply decrypt NSData to parse the path according to scriptURL, such as for... /main.jsbundle? E = PWD, the key is' PWD ', you can define your own rule */
}
Copy the code
- right
jsbundle
A fileAES 128encryption - In this way, if the load needs to be decrypted, the key is obtained for decryption. Decryption method reference