README.md in blind_index-1.0.0 vs README.md in blind_index-1.0.1
- old
+ new
@@ -1,15 +1,13 @@
# Blind Index
Securely search encrypted database fields
-Works with [Lockbox](https://github.com/ankane/lockbox) and [attr_encrypted](https://github.com/attr-encrypted/attr_encrypted)
+Works with [Lockbox](https://github.com/ankane/lockbox) ([full example](https://ankane.org/securing-user-emails-lockbox)) and [attr_encrypted](https://github.com/attr-encrypted/attr_encrypted) ([full example](https://ankane.org/securing-user-emails-in-rails))
-Here’s a [full example](https://ankane.org/securing-user-emails-in-rails) of how to use it
+Learn more about [securing sensitive data in Rails](https://ankane.org/sensitive-data-rails)
-Check out [this post](https://ankane.org/sensitive-data-rails) for more info on securing sensitive data with Rails
-
[![Build Status](https://travis-ci.org/ankane/blind_index.svg?branch=master)](https://travis-ci.org/ankane/blind_index)
## How It Works
We use [this approach](https://paragonie.com/blog/2017/05/building-searchable-encrypted-databases-with-php-and-sql) by Scott Arciszewski. To summarize, we compute a keyed hash of the sensitive data and store it in a column. To query, we apply the keyed hash function to the value we’re searching and then perform a database search. This results in performant queries for exact matches. `LIKE` queries are not possible, but you can index expressions.
@@ -32,15 +30,15 @@
```ruby
gem 'argon2', git: 'https://github.com/technion/ruby-argon2.git', submodules: true
```
-Until `argon2 >= 2.0.1` is released.
+Until `argon2 > 2.0.2` is released.
## Getting Started
-> Note: Your model should already be set up with Lockbox or attr_encrypted. The examples are for a `User` model with `encrypts :email` or `attr_encrypted :email`. See the [full example](https://ankane.org/securing-user-emails-in-rails) if needed.
+> Note: Your model should already be set up with Lockbox or attr_encrypted. The examples are for a `User` model with `encrypts :email` or `attr_encrypted :email`. See the full examples for [Lockbox](https://ankane.org/securing-user-emails-lockbox) and [attr_encrypted](https://ankane.org/securing-user-emails-in-rails) if needed.
First, generate a key
```ruby
BlindIndex.generate_key
@@ -249,9 +247,19 @@
test_user:
email_bidx: <%= User.generate_email_bidx("test@example.org").inspect %>
```
Be sure to include the `inspect` at the end or it won’t be encoded properly in YAML.
+
+## Mongoid
+
+For Mongoid, use:
+
+```ruby
+class User
+ field :email_bidx, type: String
+end
+```
## Reference
Set default options in an initializer with: