Class: Decidim::AttributeEncryptor
- Inherits:
-
Object
- Object
- Decidim::AttributeEncryptor
- Defined in:
- lib/decidim/attribute_encryptor.rb
Class Method Summary collapse
Class Method Details
.cryptor ⇒ Object
13 14 15 16 17 18 |
# File 'lib/decidim/attribute_encryptor.rb', line 13 def self.cryptor key = ActiveSupport::KeyGenerator.new("attribute").generate_key( Rails.application.secrets.secret_key_base, ActiveSupport::MessageEncryptor.key_len ) ActiveSupport::MessageEncryptor.new(key) end |
.decrypt(string_encrypted) ⇒ Object
9 10 11 |
# File 'lib/decidim/attribute_encryptor.rb', line 9 def self.decrypt(string_encrypted) cryptor.decrypt_and_verify(string_encrypted) if string_encrypted.present? end |
.encrypt(string) ⇒ Object
5 6 7 |
# File 'lib/decidim/attribute_encryptor.rb', line 5 def self.encrypt(string) cryptor.encrypt_and_sign(string) if string.present? end |