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

  1. Modify the source codeRCTJavaScriptLoader.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
  1. rightjsbundleA fileAES 128encryption
  2. In this way, if the load needs to be decrypted, the key is obtained for decryption. Decryption method reference