Ephemeral encryption layer for catbox cache strategy engines.
Extends any catbox
caching engine to automatically encrypt values stored in the cache using random keys. Uses catbox-memory
by default.
options
- an object with the following keys:algorithm
- cipher algorithm to use- Default:
'aes-128-cbc'
- see
$ openssl list-public-key-algorithms
for list of supported algorithms
- Default:
keySize
- cipher key size in bytes- Default:
16
- Default:
ivSize
- cipher initialization vector size in bytes- Default:
16
- Default:
engine
- is an object, or function detailing the catbox cache strategy to extend- Default:
result of require('catbox-memory')
- see catbox documentation
- Default:
engineOptions
- the cache strategy configuration object- see catbox documentation
var Catbox = require('catbox');
var options = {
algorithm: 'aes-256-cbc',
keySize: 32,
ivSize: 16,
engine: 'catbox-memory',
engineOptions: {
maxByteSize: 209715200
}
};
var client = new Catbox.Client(require('catbox-crypto'), options);
var key = {
segment: 'test',
id: 'test'
};
client.start(function () {
client.set(key, 0xbeef, 1000, function (err) { ... });
});