1.0.6 • Published 6 years ago

cordova-plugin-file-encryption v1.0.6

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

cordova-plugin-file-encryption

Cordova File Encryption Plugin for Android and iOS.

Install

$ cordova plugin add cordova-plugin-file-encryption

Usage

var encryptor = cordova.plugins.fileEncryption,
    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');
}

encryptor.encrypt('file:/storage/sdcard/DCIM/Camera/1404177327783.jpg', key, success, error);

API

The plugin exposes the following methods:

cordova.plugins.fileEncryption.encrypt(file, key, success, error);
cordova.plugins.fileEncryption.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