Sha256: 8d786faafc1d2ee587fb5565e056cbec0b0ea3a27bb01e254ab16f2d8bd0d2fd
Contents?: true
Size: 688 Bytes
Versions: 96
Compression:
Stored size: 688 Bytes
Contents
# frozen_string_literal: true module Decidim class NewsletterEncryptor # Method to create string encrypt using sent_at time to unsubscribe's user def self.sent_at_encrypted(user_id, sent_at) crypt_data.encrypt_and_sign("#{user_id}-#{sent_at.to_i}") end # Method to decrypt sent_at newsletter. def self.sent_at_decrypted(string_encrypted) crypt_data.decrypt_and_verify(string_encrypted) end def self.crypt_data key = ActiveSupport::KeyGenerator.new("sent_at").generate_key( Rails.application.secrets.secret_key_base, ActiveSupport::MessageEncryptor.key_len ) ActiveSupport::MessageEncryptor.new(key) end end end
Version data entries
96 entries across 96 versions & 1 rubygems