lib/mailkick.rb in mailkick-1.0.1 vs lib/mailkick.rb in mailkick-1.1.0
- old
+ new
@@ -20,11 +20,13 @@
# integrations
require "mailkick/engine" if defined?(Rails)
module Mailkick
- mattr_accessor :services, :secret_token, :mount, :process_opt_outs_method
+ mattr_accessor :services, :mount, :process_opt_outs_method
+ mattr_reader :secret_token
+ mattr_writer :message_verifier
self.services = []
self.mount = true
self.process_opt_outs_method = ->(_) { raise "process_opt_outs_method not defined" }
def self.fetch_opt_outs
@@ -35,11 +37,18 @@
Service.subclasses.each do |service|
services << service.new if service.discoverable?
end
end
+ def self.secret_token=(token)
+ @@secret_token = token
+ @@message_verifier = nil
+ end
+
+ # TODO use JSON serializer
+ # can't currently rotate serializer without rotating token or digest
def self.message_verifier
- @message_verifier ||= ActiveSupport::MessageVerifier.new(Mailkick.secret_token)
+ @@message_verifier ||= ActiveSupport::MessageVerifier.new(Mailkick.secret_token)
end
def self.generate_token(subscriber, list)
raise ArgumentError, "Missing subscriber" unless subscriber
raise ArgumentError, "Missing list" unless list.present?