Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

File Encryption

Improve this doc

Simple file encryption for Cordova.

Repo: https://github.com/disusered/cordova-safe

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-safe
    $ npm install --save @ionic-native/file-encryption@4
    
  2. Add this plugin to your app's module

Supported platforms

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

API

Native

General