@ctrlo/encrypted-storage
v1.0.2
Published
Module to provide encryption overlay for local storage
Readme
@ctrlo/encrypted-storage
Module to provide encryption overlay for local storage
Usage
const storage = EncryptedStorage.instance();
// Add an item to encrypted local storage encrypted with the supplied key
await storage.setItem(key, value, encryptionKey);
// Retrieve an item from encrypted local storage and decrypt it with the supplied key
const item = await storage.getItem(key, encryptionKey);
// Remove the item with the specified key from encrypted local storage
storage.removeItem(key);
// Clear the encrypted local storage (this will clear *all* local storage items)
storage.clear();
// Get the key for the item at the specified index within local storage, regardless of encryption
const key = await storage.getKey(index);
// get the number of local storage items, regardless of encryption
const length = storage.length;