Simple file encryption for Cordova.
$ cordova plugin add cordova-safe
var safe = cordova.plugins.disusered.safe,
key = 'someKey';
function success(encryptedFile) {
console.log('Encrypted file: ' + encryptedFile);
safe.decrypt(encryptedFile, key, function(decryptedFile) {
console.log('Decrypted file: ' + decryptedFile);
}, error);
}
function error() {
console.log('Error with cryptographic operation');
}
safe.encrypt('file:/storage/sdcard/DCIM/Camera/1404177327783.jpg', key, success, error);
The plugin exposes the following methods:
cordova.plugins.disusered.safe.encrypt(file, key, success, error);
cordova.plugins.disusered.safe.decrypt(file, key, success, error);
- file: A string representing a local URI
- key: A key for the crypto operations
- success: Optional success callback
- error: Optional error callback
MIT © Carlos Rosquillas