0.0.4 • Published 5 years ago

@akiltech/secure-storage v0.0.4

Weekly downloads
-
License
-
Repository
-
Last release
5 years ago

Secure Storage

If you are used to working with localstorage and sessionstorage in your browser and you are tired of exposing some sensitive information. This module is made for you.

Installation

NPM

$ npm install @akiltech/secure-storage --save

YARN

$ yarn add @akiltech/secure-storage

Configuration

import { SecureStorageModule, SecureStorageConfig } from '@akiltech/secure-storage';

const SECURE_STORAGE_CONFIG: SecureStorageConfig = {
  secretKey: {your_secret_key},
  encryptKey: false,
};

@NgModule({
  declarations: [],
  imports: [
    SecureStorageModule.forRoot(SECURE_STORAGE_CONFIG)
  ],
  providers: [],
  bootstrap: []
})
export class AppModule { }

How to use

Session Storage

First of all, import the service

import { SecureSessionStorageService } from '@akiltech/secure-storage';

Local Storage

First of all, import the service

import { SecureLocalStorageService } from '@akiltech/secure-storage';

Available Methods

There are several methods to facilitate the use of a service, you should know that each method returns an observable.

GET

The get method allows you to retrieve the value of your recording.

Parameter(s)ResponseType
keyString (key value)Observable

PUT

This method is used to record a value.

Parameter(s)ResponseType
key and valueBoolean (true or false)Observable

HAS

If you want to check the existence of an element of a key this method will allow you to do so.

Parameter(s)ResponseType
keyBoolean (true or false)Observable

DELETE

Deleted a specific key.

Parameter(s)ResponseType
keyBoolean (true or false)Observable

CLEAN

This method allows you to delete all the elements saved at the browser level in the session or local storage.

Parameter(s)ResponseType
nothingBoolean (true or false)Observable