Secure Storage a secure way to store localStorage data with high level of encryption.
A fork of softvar/secure-ls, this library does not include compression and all the interfaces are changed. The library use fingerprint and secure cookie to store the encryption key. It does not expose the keys to the console. If you use custom key you must enclose it yourself.
- Secure data with various types of encryption including
AES
,TDES
,DES
,Rabbit
andRC4
. (defaults toAES
encoding). - Advanced API wrapper over
localStorage
API, providing other basic utilities.
npm install @xzar90/secure-storage
import { SecureStorage } from '@xzar90/secure-storage';
const secureStorage = await SecureStorage.createAsync({}); //default settings
//{
// encodingType: 'aes', // aes | tdes | des | rabbit | rc4
// encryptionSecret: {
// key: undefined, // Leave empty to generate random which is
// expires: 90 // stored in a secure cookie for 90 days.
// },
// storageNamespace: 'secure' // the value which is used to track all
// storage keys.
//}
secureStorage.clear(); //Clear all the values from storageNamespace
secureStorage.setItem(key, value);
secureStorage.getItem(key);
secureStorage.removeItem(key);
You cannot change settings once you have created a instance of SecureStorage.
npm run build
- produces production version of the library under thedist
folder
- Fork the repo on GitHub.
The MIT license (MIT)
Copyright (c) 2022 Josh Gomez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.