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
(Don’t worry about this detail too much, it’s all ✨ magic ✨ that happens behind the scenes.)
Searchable Encrypted Rails models with ActiveStash!
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.
For more information check out the ActiveStash README on GitHub.
First setup a Rails application to use for this tutorial:
$ rails new ActiveStash_Demo $ cd ActiveStash_Demo
- Add ActiveStash to your
- Install the new dependency:
$ bundle install