Cordova File/Text Encryption Plugin for Android and iOS.
Using RNCryptor(iOS) and JNCryptor(Android) for interchangeable files.
Based on:
$ cordova plugin add cordova-plugin-file-rncryptor
or
$ npm i git+https://github.com/vmartins/cordova-plugin-file-rncryptor
$ npx cap sync
window['FileRNCryptor'].encrypt($localPath, $password,
($$file)=>{ $resolve($$file); },
($$err)=>{ $reject($$err); });
window['FileRNCryptor'].decrypt($localPath, $password,
($$file)=>{ $resolve($$file); },
($$err)=>{ $reject($$err); });
window['FileRNCryptor'].encryptText($text, $password,
($$crypt)=>{ $resolve($$crypt); },
($$err)=>{ $reject($$err); });
window['FileRNCryptor'].decryptText($text, $password,
($$crypt)=>{ $resolve($$crypt); },
($$err)=>{ $reject($$err); });
The plugin exposes the following methods:
window['FileRNCryptor'].encrypt(file, key, success, error);
window['FileRNCryptor'].decrypt(file, key, success, error);
window['FileRNCryptor'].encryptText(text, key, success, error);
window['FileRNCryptor'].decryptText(text, key, success, error);
- file: A string representing a local path
- text: A string
- key: A key for the crypto operations
- success: Optional success callback
- error: Optional error callback