CipherStash Documentation

ActiveStash (Ruby on Rails)

ActiveStash is the Rails-specific gem for using CipherStash QX.

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 QX 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 QX via ActiveRecord callbacks. Queries are delegated to CipherStash QX 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