A corporation manager and dashboard for EVE Online
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

21 lignes
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