This is an extension to tkyaji's cordova-plugin-crypt-file implementation to encrypt HTML assets during build and to decrypt the required assets during runtime.
The original implementation can also be found on https://www.npmjs.com/package/cordova-plugin-crypt-file.
node-rsa
npm install -g node-rsa
javascript-obfuscator
npm install --save-dev javascript-obfuscator
cordova plugin add https://github.com/luhla/cordova-plugin-crypt-assets
- .html
- .htm
- .js
- .css
You can specify the encryption subjects by editing config.xml
instead of plugin.xml
.
config.xml
<cryptfiles>
<include>
<file regex="\.(htm|html|js|css)$" />
</include>
<exclude>
<file regex="exclude_file\.js$" />
</exclude>
<obfuscate value="release|always">
</cryptfiles>
Specify the target file as a regular expression.
cordova [build / prepare / run] android
<obfuscate value="release">
obfuscation will be made when --release parametter present
cordova [build / prepare / run] [ios / android] --release
<obfuscate value="always">
obfuscation will be made always
cordova [build / prepare / run] [ios / android]
no value / other value / tag not present - no obfuscation
- Android - encrypt obfuscate
- iOS - obfuscate
It would be very helpful if you show me your project (If you have GitHub repository, that URL would be nice). It is very hard for me to reporduce your enviroment.
Apache version 2.0