websecure-local-storage
Version:
secure localstorage data
44 lines (28 loc) • 959 B
Markdown
JavaScript library of websecure-local-storage.
Requirements:
- Node.js
- npm (Node.js package manager)
```bash
npm install websecure-local-storage
```
ES6 import case:
- ```Setup your ENV CRYPT_LOCAL_STORAGE_SECRET```
```javascript
import { secureStorage } from 'websecure-local-storage';
const secureLs = secureStorage();
secureLs.setItem('foo-key','bar-val');
console.log(secureLs.getItem('foo-key')); // bar-val
console.log(localStorage.getItem('foo-key'));// null
console.log(localStorage.getItem('Y2ViZTAzMGIyZjVhY2E0YTYxYWVjNmU3OWUzMGUwZTM2YmU3MTdhOA=='));// U2FsdGVkX1/hB+TTx5wd1JpWIIX1WHTS96tGvYMtUmQ=
```
If CRYPT_LOCAL_STORAGE_SECRET is not set, only the keys are encrypted
Encrypt localStorage keys: SHA1 <- BASE64
Encrypt/Decrypt localStorage values: AES
Encrypt/Decrypt secret: ENV CRYPT_LOCAL_STORAGE_SECRET
This is an initia release.