Giter Site home page Giter Site logo

ionic-team / demo-encrypted-image-storage Goto Github PK

View Code? Open in Web Editor NEW
1.0 6.0 0.0 3.02 MB

Encrypted image storage demo powered by Ionic Native

Home Page: https://ionicframework.com/docs/enterprise/offline-storage

JavaScript 6.83% TypeScript 67.91% HTML 10.94% CSS 14.33%

demo-encrypted-image-storage's Introduction

Encrypted Image Storage (Powered by Ionic Native)

Demo app used during the "Ionic Native: Native-powered apps, without the hassle" webinar.

The real world use case covered in this app is sensitive document management. For example, if the app stores a scanned driver license or id, this sensitive user information should be protected (via encryption) on the user's device.

Built for iOS and Android.

Note: This demo requires an Ionic Native key to install, build, and run. Ionic Native includes a reliable set of Native solutions and plugins that you can use in your Ionic app, quality controlled and maintained by the Ionic Team. If you are interested in acquiring a key or learning more, please contact us.

How It Works

When the user taps the Scan Id button, the device camera opens and the user takes a picture. The image is encrypted and stored on the user's device. Then, it's displayed on the screen, along with the details from the driver's license (Note that the image recognition portion is faked here - that feature is outside the scope of this example).

Technical Implementation:

After the app is opened, a client-side GUID (unique to the app user) is generated then stored in secure storage, encrypted at-rest on the device using the Ionic Identity Vault solution. In the demo, there’s no login screen, but in a real app the GUID would be generated after the user logged in, thus tying an encryption key entirely unique to them. On subsequent app openings, the GUID is retrieved from IV’s secure storage.

Offline Storage is configured using the GUID as the encryption key for the database. When a new photo is captured via the Camera plugin, it's placed into offline storage encrypted at rest.

As a bonus, Identity Vault's screen protection feature is enabled (hideScreenOnBackground: true) which automatically hides the sensitive user info whenever the app is placed in the background.

Feature Overview:

Project Structure

  • ImageService (src/app/services/image.service.ts): Logic encapsulating Ionic Offline Storage solution and Camera plugin.
  • IdentityService (src/app/services/identity.service.ts): Logic encapsulating dynamic GUID generation for encrypting photos.
  • Home module (src/app/home): UI code.

How to Run

  1. Install Ionic if needed: npm install -g ionic.
  2. Clone this repository.
  3. In a terminal, change directory into the repo: cd demo-encrypted-image-storage.
  4. Register your Ionic Native key: ionic enterprise register.
  5. Install all packages: npm install.
  6. Build and run on a device.

demo-encrypted-image-storage's People

Contributors

dotnetkow avatar jcesarmobile avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.