0.0.6 • Published 3 years ago

encrypt-webstorage v0.0.6

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

Encrypted Web Storage

Encrypted Web Storage is a Angular typescript library for setting a session value(Session Storage) with AES encryption. Also it can deal with normal AES encryption decryption( Any values) with or without secret. For the both Session and Normal encryption you can pass your own secret key in argument or it will take a default key.

Known Vulnerabilities

Installation

Use the package manager npm to install Encrypted Web Storage.

npm install encrypt-webstorage@latest

or

npm install --legacy-peer-deps --save encrypt-webstorage@latest

Usage

For session storage encryption

import {WebStorageService} from "encrypt-webstorage";

constructor(private webStorage : WebStorageService){}

// setting the value in session storage
this.webStorage.setItem('test','test'); // U2FsdGVkX1+cLZpklSZLV2mptR9S/px4TtOMBjIeOUU=
this.webStorage.setItem('test',10);
this.webStorage.setItem('test',{"test" : "test"});
// can able to pass all the types code will handle stringify and parse

// get the value back from session
this.webStorage.setItem('test'); //test

For normal encryption

import {EncryptionService} from "encrypt-webstorage";

constructor(private encryptor : EncryptionService){}

const secret_key = "!!34fffd99kdsdnn@as"

// encrypt decryption value without secret key

   let encryptedString = this.encryptor.encryptionAES({"test" : "test"});

    console.log('encrypted',encryptedString); //encrypted U2FsdGVkX19qgGyDwcinGl24YVn1e7fmcdR3t/v43BA=

    let decryptedValue = this.encryptor.decryptionAES(encryptedString);

    console.log('decrypted',decryptedValue); //decrypted {test: "test"}

// encrypt decryption value without secret key

 this.encryptor.encryptionAES({"test" : "test"}, secret_key);

 this.encryptor.decryptionAES(encryptedString, secret_key);


// can able to pass all the types code will handle stringify and parse

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago