Skip to main content

Cache Encrypted Local Storage Driver

Introduction#

This driver implements Cache Driver Interface.

The encrypted local storage driver implements and manipulates data from The Browser Local Storage with encrypted data using Encryption.

Usage#

The same exact usage is the same Cache Manager except the setDriver and getDriver, these methods are for the cache manager only.

Example of usage outside the cache manager#

import { EncryptedLocalStorageDriver } from 'mongez/cache';
let driver: EncryptedLocalStorageDriver = new EncryptedLocalStorageDriver();
driver.set('name', 'Hasan'); // this will be stored in the local storage with encrypted value.

Nothing is different except from Plain Local Storage Driver that the stored value in the local storage will be encrypted.

danger

The driver won't work unless there is a key defined under encryption.key in the configurations list, check Encryption Configurations for more details.