Building apps at a large company? Check out Ionic Enterprise

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

Enrcypt 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