{"repo":"ankane/lockbox","free":true,"listed":false,"github":"https://github.com/ankane/lockbox","clone":"git clone https://github.com/ankane/lockbox.git","description":"Modern encryption for Ruby and Rails","language":"Ruby","stars":1607,"topics":["encryption","activerecord","activestorage","carrierwave","mongoid","libsodium"],"license":"MIT","category":"security-tools","readme_excerpt":"Lockbox :package: Modern encryption for Ruby and Rails - Works with database fields, files, and strings - Maximizes compatibility with existing code and libraries - Makes migrating existing data and key rotation easy - Has zero dependencies and many integrations Learn the principles behind it, how to secure emails with Devise, and how to secure sensitive data in Rails. Installation Add this line to your application’s Gemfile: Key Generation Generate a key Store the key with your other secrets. This is typically Rails credentials or an environment variable (dotenv is great for this). Be sure to use different keys in development and production. Set the following environment variable with your key (you can use this one in development) or add it to your credentials for each environment ( rails credentials:edit --environment ) or create config/initializers/lockbox.rb with something like Then follow the instructions below for the data you want to encrypt. Database Fields - Active Record - Action Text - Mongoid Files - Active Storage - CarrierWave - Shrine - Local Files Other - Strings Active Record Create a migration with: Add to your model: You can use email just like any other attribute. If you need to query encrypted fields, check out Blind Index. Multiple Fields You can specify multiple fields in single line. Types Fields are strings by default. Specify the type of a field with: Note: Use a text column for the ciphertext in migrations, regardless of the type Lockbox automatical","default_branch":null,"files":null,"tree":[],"storefront":"/r/ankane","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ankane/lockbox/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}