2.1.6 • Published 12 months ago

@jihyunlab/web-secure-storage v2.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@jihyunlab/web-secure-storage

Version Downloads Last commit License Linter code style: prettier\ Build Lint Prettier codecov

@jihyunlab/web-secure-storage can be used by web applications.

@jihyunlab/web-secure-storage encrypts values and stores them in local or session storage. When retrieving stored values, they are decrypted back to their original values

The encryption function is implemented with @jihyunlab/web-crypto and provides encryption for AES 256 CBC and AES 256 GCM.

Installation

npm i @jihyunlab/web-secure-storage

Usage

You can easily encrypt data and store it in storage, then retrieve it.

import {
  CIPHER,
  STORAGE,
  WebSecureStorage,
} from '@jihyunlab/web-secure-storage';

const storage = await WebSecureStorage.create(
  STORAGE.LOCAL,
  CIPHER.AES_256_GCM,
  'your secret key'
);

storage.clear();

await storage.setItem('item', 'jihyunlab'); // 89b1e3c2996e08d5549ecb9d625faca6db785c7d0f9ba51c3985e80ae1143263273308f5eb

const value = await storage.getItem('item');
console.log(value); // jihyunlab

storage.removeItem('item');

You can configure encryption options such as salt and iteration.

const storage = await WebSecureStorage.create(
  STORAGE.LOCAL,
  CIPHER.AES_256_GCM,
  'your secret key',
  {
    salt: 'salt',
    iterations: 256,
  }
);

Credits

Authored and maintained by JihyunLab <info@jihyunlab.com>

License

Open source licensed as MIT.

2.1.2

12 months ago

2.1.1

12 months ago

2.1.4

12 months ago

2.1.3

12 months ago

2.1.6

12 months ago

2.1.5

12 months ago

2.1.0

12 months ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago