File Encryption
Simple file encryption for Cordova.
Repo: https://github.com/disusered/cordova-safe
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-safe $ npm install --save @ionic-native/file-encryption@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
Usage
import { FileEncryption } from '@ionic-native/file-encryption';
constructor(private fileEncryption: FileEncryption) { }
...
this.fileEncryption.decrypt('assets/json/topSecret.json', 'secretKey');
this.fileEncryption.encrypt('assets/json/topSecret.json', 'secretKey');
Instance Members
encrypt(file, key)
Encrypt a file
Param | Type | Details |
---|---|---|
file |
string
|
A string representing a local URI |
key |
string
|
A key for the crypto operations |
Returns: Promise<any>
Returns a promise that resolves when something happens
decrypt(file, key)
Decrypt a file
Param | Type | Details |
---|---|---|
file |
string
|
A string representing a local URI |
key |
string
|
A key for the crypto operations |
Returns: Promise<any>
Returns a promise that resolves when something happens