Just Encrypt
The simplest gem to encrypt and decrypt data, you only need to set a secret password to your credentials.
Getting started
JustEncrypt works with Rails 5.2 onwards. Add the following line to your Gemfile:
gem 'just-encrypt'Then run bundle install
Next, you need to add a secret key into your credentials file, the key must be 32 bytes. You can generate one easily with OpenSSL:
$ openssl rand -hex 32Then edit your credentials:
$ EDITOR=vim rails credentials:editAnd add the secret key generated with the next structure:
just_encrypt:
secret: YOUR_SECRET_KEYEncrypt data
require 'just-encrypt'
JustEncrypt.encrypt('STRING_TO_ENCRYPT')Decrypt data
require 'just-encrypt'
JustEncrypt.decrypt('STRING_TO_DECRYPT')Contributing
- Fork it
- Commit changes
- Submit a Pull Request
- ❤️