Giter Club home page Giter Club logo

action_encrypt's Introduction

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.

action_encrypt's People

Contributors

aserafin avatar dvanderbeek avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

aserafin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.