Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bookshelf-encrypt-columns

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bookshelf-encrypt-columns

Automatically encrypt/decrypt database columns via Bookshelf.js

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
increased by180%
Maintainers
1
Weekly downloads
 
Created
Source

bookshelf-encrypt-columns Build Status

This Bookshelf.js plugin enables you to define which model columns are encrypted on save/update. Those columns will also be automatically decrypted when fetched.

Installation

Install the package via npm:

$ npm install --save bookshelf-encrypt-columns

Usage

Require and register the bookshelf-encrypt-columns plugin:

var bookshelf = require('bookshelf')(knex);
var encryptColumns = require('bookshelf-encrypt-columns');

bookshelf.plugin(encryptColumns, {
  cipher: 'a-valid-cipher',
  key: 'your-strong-key'
});

Both cipher and key are required. By default, the plugin will use the aes-256-ctr cipher. For a list of valid ciphers, please see the Node Crypto docs. Be sure to store your key in a secure location and avoid passing it to the plugin directly.

Define which columns are encrypted with the encryptedColumns prototype property:

bookshelf.Model.extend({
  encryptedColumns: ['secret'],
  tableName: 'test'
});

License

MIT

Credits

This plugin was inspired by and borrows heavily from the bookshelf-json-columns plugin.

Keywords

FAQs

Package last updated on 05 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc