catbox-crypto

4.0.1 • Public • Published

catbox-crypto

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

  • 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
    • keySize - cipher key size in bytes
      • Default: 16
    • ivSize - cipher initialization vector size in bytes
      • Default: 16
    • engine - is an object, or function detailing the catbox cache strategy to extend
    • engineOptions - the cache strategy configuration object

Example

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) { ...  });
});

Readme

Keywords

Package Sidebar

Install

npm i catbox-crypto

Weekly Downloads

8

Version

4.0.1

License

none

Last publish

Collaborators

  • alivesay