0.0
No release in over a year
Easily add encrypted fields to your models.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
 Dependencies

Development

>= 0

Runtime

 Project Readme

ActionEncrypt

Add encrypted fields to ActiveRecord models easily

Installation

Add this line to your application's Gemfile:

gem 'action_encrypt'

And then execute:

$ bundle

Install migrations:

$ rails action_encrypt:install:migrations

Create action_encrypt.rb in your initializers folder and set encryption keys. Generate them using SecureRandom.hex(32). You can decide between storing the values in ENV or using rails encrypted credentials system.

ActionEncrypt.configure do |config|
  config.key_encryption_key = ENV.fetch('KEY_ENCRYPTION_KEY')
  config.blind_index_key = ENV.fetch('BLIND_INDEX_KEY')
end

Create a Data Encryption Key

$ ActionEncrypt::DataEncryptionKey.generate!(primary: true)

Add an encrypted field to your models

class User < ApplicationRecord
  has_encrypted :ssn
end

Now you can use user.ssn as you would any other attribute, but it will be stored securely in the action_encrypt_encrypted_fields table.

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.