Skip to content

ManuelFeller/cordova-safe

 
 

Repository files navigation

cordova-safe

Fix for a specific use case on iOS, not including any Android fixes done by other branches. No support (for now); use this version at your risk!

Simple file encryption for Cordova.

Install

$ cordova plugin add cordova-safe@https://github.com/ManuelFeller/cordova-safe

Usage

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);

API

The plugin exposes the following methods:

cordova.plugins.disusered.safe.encrypt(file, key, success, error);
cordova.plugins.disusered.safe.decrypt(file, key, success, error);

Parameters:

  • file: A string representing a local URI
  • key: A key for the crypto operations
  • success: Optional success callback
  • error: Optional error callback

License

MIT © Carlos Rosquillas

About

File encryption for Cordova.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 81.4%
  • JavaScript 9.5%
  • Java 8.3%
  • Shell 0.8%