Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.02 KB

README.md

File metadata and controls

47 lines (33 loc) · 1.02 KB

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