UNPKG

persistent-storage

Version:

Abstracts access to any storage object implementing the webstorage Storage interface, offering optional compression using lz-string and optional encryption using crypto

22 lines 904 B
"use strict"; var crypto = require("./crypto"); var _ = require("lodash"); var Config = (function () { function Config(opts) { this.useCompression = _.isBoolean(opts.useCompression) ? opts.useCompression : false; this.useCache = _.isBoolean(opts.useCache) ? opts.useCache : true; this.keyPrefix = opts.keyPrefix || ''; if (opts.encryption) { this.useEncryption = true; this.encryptKeys = _.isBoolean(opts.encryption.encryptKeys) ? opts.encryption.encryptKeys : true; this.encryption = { algorithm: opts.encryption.algorithm || 'aes-256-cbc', key: crypto.deriveEncryptionKey(new crypto.KeyDerivationOptions(opts.encryption)), iv: opts.encryption.iv }; } } return Config; }()); module.exports = Config; //# sourceMappingURL=Config.js.map