module Slosilo::Migration::EncryptedAttributes
we don't trust the database to keep all backups safe from the prying eyes so we encrypt sensitive attributes before storing them
Public Class Methods
cipher()
click to toggle source
# File lib/slosilo/migration/attr_encrypted.rb, line 44 def cipher @cipher ||= Slosilo::Migration::Symmetric.new end
decrypt(ctxt)
click to toggle source
# File lib/slosilo/migration/attr_encrypted.rb, line 35 def decrypt ctxt return nil unless ctxt cipher.decrypt ctxt, key: key end
encrypt(value)
click to toggle source
# File lib/slosilo/migration/attr_encrypted.rb, line 30 def encrypt value return nil unless value cipher.encrypt value, key: key end
included(base)
click to toggle source
# File lib/slosilo/migration/attr_encrypted.rb, line 25 def self.included base base.extend ClassMethods end
key()
click to toggle source
# File lib/slosilo/migration/attr_encrypted.rb, line 40 def key Slosilo::encryption_key || (raise "Please set Slosilo::encryption_key") end