A corporation manager and dashboard for EVE Online
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

21 lines
406 B

  1. module Encryptor
  2. extend ActiveSupport::Concern
  3. class_methods do
  4. def encrypt(value)
  5. ensure_encryptor
  6. @crypt.encrypt_and_sign(value)
  7. end
  8. def decrypt(value)
  9. ensure_encryptor
  10. @crypt.decrypt_and_verify(value)
  11. end
  12. private
  13. def ensure_encryptor
  14. @crypt ||= ActiveSupport::MessageEncryptor.new(Rails.application.secrets.secret_key_base)
  15. end
  16. end
  17. end