Episodes

Resources

Download Source Code

Summary

# Terminal
bin/rails action_text:install
bin/rails db:encryption:init
bin/rails credentials:edit

# config/credentials.yml.enc
active_record_encryption:
  primary_key: fyEH7x03990mjMltmS88gUUBRnU1YGla
  deterministic_key: sCoaRYss4KvS6jrZZpmNPBW2Ft4ym82y
  key_derivation_salt: bJq0GQn1cmPB8zbstJOQLj5T4iIHBemN

# models/user.rb
class User < ApplicationRecord
  has_rich_text :description, encrypted: true

  validates :passphrase, uniqueness: true
  encrypts :passphrase, deterministic: true #, ignore_case: true #, downcase: true
  # original_passphase
  # User.find_by(passphrase: "tacosoup")

  # serialize :settings, Hash
  # encrypts :settings
end

# config/initializers/filter_parameter_logging.rb
Rails.application.config.filter_parameters += [
  :passw, :secret, :token, 
  :_key, :crypt, :salt, :certificate, 
  :otp, :ssn, :description
]