CipherStash
CipherStash Documentation

ActiveStash (Ruby on Rails)

ActiveStash is the Rails-specific gem for using CipherStash.

ActiveStash gives you encrypted search on ActiveRecord models using application-level encryption. It works by adding search on top of existing libraries like Lockbox and ActiveRecord Encryption. When records are created or updated, they are indexed into a CipherStash collection, which can be queried via an ActiveStash::Relation. (Don’t worry about this detail too much, it’s all ✨ magic ✨ that happens behind the scenes.)

Searchable Encrypted Rails models with ActiveStash!

How does it work?

ActiveStash uses the “look-aside” pattern to create an external, fully encrypted index for your ActiveRecord models. Every time you create or update a record, the data is indexed to CipherStash via ActiveRecord callbacks. Queries are delegated to CipherStash but return ActiveRecord models so things just work.

If you’ve used Elasticsearch with gems like Searchkick, this pattern will be familiar to you.

Active Stash Lookaside Pattern

For more information check out the ActiveStash README on GitHub.

Installing ActiveStash

First setup a Rails application to use for this tutorial:

$ rails new ActiveStash_Demo
$ cd ActiveStash_Demo
  1. Add ActiveStash to your Gemfile:
gem "active_stash"
  1. Install the new dependency:
$ bundle install