Class: Decrypt

Inherits:
Object
  • Object
show all
Defined in:
lib/encrypt_column/decrypt.rb

Class Method Summary collapse

Class Method Details

.cipher(ciphertext) ⇒ Object



2
3
4
5
6
7
# File 'lib/encrypt_column/decrypt.rb', line 2

def self.cipher(ciphertext)
  raise 'Encryption Key Config Missing' unless ENV['ENCRYPTION_KEY'].present?
  ActiveSupport::MessageEncryptor.new(ENV['ENCRYPTION_KEY']).decrypt_and_verify(ciphertext)
rescue ActiveSupport::MessageVerifier::InvalidSignature
  return ciphertext
end