Secure Storage

Improve this doc

$ ionic plugin add cordova-plugin-secure-storage
$ npm install --save @ionic-native/secure-storage

Repo: https://github.com/Crypho/cordova-plugin-secure-storage

This plugin gets, sets and removes key,value pairs from a device's secure storage.

Requires Cordova plugin: cordova-plugin-secure-storage. For more info, please see the Cordova Secure Storage docs.

Supported platforms

Usage

import { SecureStorage, SecureStorageObject } from '@ionic-native/secure-storage';

constructor(private secureStorage: SecureStorage) { }

...

this.secureStorage.create('my_store_name')
  .then((storage: SecureStorageObject) => {

     storage.get('myitem')
       .then(
         data => console.log(data),
         error => console.log(error)
     );

     storage.set('myitem', 'myvalue')
       .then(
        data => console.log(data),
         error => console.log(error)
     );

     storage.remove('myitem')
     .then(
         data => console.log(data),
         error => console.log(error)
     );

  });

Instance Members

create(store)

Creates a namespaced storage.

Param Type Details
store string

Returns: Promise<SecureStorageObject>

SecureStorageObject

Instance Members

get(reference)

Gets a stored item

Param Type Details
reference string

Returns: Promise<any>

set(reference, value)

Stores a value

Param Type Details
reference string
value string

Returns: Promise<any>

remove(reference)

Removes a single stored item

Param Type Details
reference string

Returns: Promise<any>

API

Native

General