nativescript-secure-android-keystore
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

npm npm Twitter Follow

Secure data in android keystore

Github

Encrypt the data and decrypt whenever want to use It save data in shared preferences using keystore encryption Currently only works with Android

Prerequisites / Requirements

Android version Latest Version

Installation

tns plugin add nativescript-secure-android-keystore

Usage

Describe any usage specifics for your plugin. Give examples for Android, iOS, Angular if needed. See nativescript-secure-android-keystore

Javascript

        
const  SecureAndroidKeystore =  require("nativescript-secure-android-keystore");
 
function createViewModel() {
     ...
    var secure = new SecureAndroidKeystore.SecureAndroidKeystore();
    secure.storeData('mykey', 'pass1234');
    secure.retrieveData('mykey').then(res => {
        console.log(res);
    });
    ....
    return viewModel;
}
 
 

Typescript

     import { SecureAndroidKeystore } from 'nativescript-secure-android-keystore';
 
        
        private secureAndroidKeystoreSecureAndroidKeystore;
 
        //Inside some method         
            this.secureAndroidKeystore = new SecureAndroidKeystore();
            this.secureAndroidKeystore.storeData('mykey','pass1234');
            this.secureAndroidKeystore.retrieveData('mykey').then(res=>{
            this.message = res;
            console.log('message', this.message );
            })
        

## Angular Typescript

app.module.ts
    ...
     import { SecureAndroidKeystore } from 'nativescript-secure-android-keystore';
     ....
     
@NgModule({
    .
    .
    .
    bootstrap: [
        AppComponent
    ],
  
    providers: [
        SecureAndroidKeystore
    ],
    .
    .
    .
})
 
any.component.ts
 
        ...
     import { SecureAndroidKeystore } from 'nativescript-secure-android-keystore';
     ....
 
     constructor(private secureAndroidKeystoreSecureAndroidKeystore){
 
     }
        
     anyMethod(){
          //Inside some method         
            this.secureAndroidKeystore.storeData('mykey','pass1234');
            this.secureAndroidKeystore.retrieveData('mykey').then(res=>{
            this.message = res;
            console.log('message', this.message );
          })
 
     }
       
        

API

Property Default Description
Store data method storeData('key', 'passdata') method for saving any data,
Get the data retrieveData Method for data getting and using which return promise

License

Apache License Version 2.0, January 2004

For Any issue please raise issue in github repo

Tutorials

Need a little more to get started? Check out tutorial.

Package Sidebar

Install

npm i nativescript-secure-android-keystore

Weekly Downloads

0

Version

1.0.3

License

Apache-2.0

Unpacked Size

32.6 kB

Total Files

17

Last publish

Collaborators

  • acharyaks90