I'm making a new application that will be public facing but I don't want any clear text being stored on the server for any user at anytime. This way, there will be no compromising of data. In this case, username and password credentials. This isn't an application where a user will login with their creds, if that were the case I would have used Devise. Instead, I'm taking these username and password credentials and piping them in to the application to talk to an outside service.
The first part of obscurity was making the Rails model create new entries based on UUID instead of sequential numbers. That was pretty easy by following this tutorial How to start using UUID in ActiveRecord with PostgreSQL. The second part was implementing the attr_encrypted gem. attr_encrypted allows you to store data in encrypted format to your ActiveRecord database. In this case, i'm using Postgres.
The README is a start but doesn't get you all the way there. So here is how it's done.
Start off by creating a new scaffold. You must specify encrypted_ before anything you want encrypted in the model
rails g scaffold Model encrypted_user:string encrypted_password:string host:string
Add a comment