mailkick 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e84a6786c23946b6e27a67a14d75c01da5cde231928d19c65edd2b591de9a153
4
- data.tar.gz: 1a944d065c7bf4c164db038aabe0073b3759e96a232ec22b29e86cf746ffc02f
3
+ metadata.gz: 29547fd14ea942978a05dce4e217a19095b3e60b32d4f3d0da658603d02b2ef1
4
+ data.tar.gz: 5df27e5ebc7a4be7c60ea04251a78baaba22cf19d958a9043e0fdf30ec3760e2
5
5
  SHA512:
6
- metadata.gz: 3ed9f0315dc5c60ed5b2cc524fd13763566b6126bafceb665dbddcdc2a182f4408a370e267fdcc8ab97cbe616684c7ff5ab91b0fe717d39a65deac854cd3b958
7
- data.tar.gz: 82c2c1d7a1d0077eb60df59a9d672039b17750462a435afdef19125e26f3c122600a2a8f394c06a3119a64c773d4a6ef7a1f61dc5081dca587735eda80c4a9c3
6
+ metadata.gz: d656f3001137374753348508afe6a86a226039a9fba1873fad479d6f6b8f43ecf79f59e28fca498a505ab7b8467b44863fe8b6866f13c305530bc497976f5f49
7
+ data.tar.gz: 06b66e4eb5e9ba1705e8f62eaa3a953e8ff3fef54d65ca44ff6981313d36408e38533154258107cca82a8b02033772e311ee11be07e71dddb99a05be1bee2772
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.1.0 (2023-01-29)
2
+
3
+ - Improved secret token generation
4
+
1
5
  ## 1.0.1 (2021-06-20)
2
6
 
3
7
  - Fixed error message when process out-opts not configured
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2021 Andrew Kane
1
+ Copyright (c) 2014-2023 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -5,8 +5,6 @@ Email subscriptions for Rails
5
5
  - Add one-click unsubscribe links to your emails
6
6
  - Fetch bounces and spam reports from your email service
7
7
 
8
- **Mailkick 1.0 was recently released** - see [how to upgrade](#upgrading)
9
-
10
8
  :postbox: Check out [Ahoy Email](https://github.com/ankane/ahoy_email) for analytics
11
9
 
12
10
  [![Build Status](https://github.com/ankane/mailkick/workflows/build/badge.svg?branch=master)](https://github.com/ankane/mailkick/actions)
@@ -16,7 +14,7 @@ Email subscriptions for Rails
16
14
  Add this line to your application’s Gemfile:
17
15
 
18
16
  ```ruby
19
- gem 'mailkick'
17
+ gem "mailkick"
20
18
  ```
21
19
 
22
20
  And run the generator. This creates a table to store subscriptions.
@@ -125,7 +123,7 @@ Will gladly accept pull requests for others.
125
123
  Add the gem
126
124
 
127
125
  ```ruby
128
- gem 'aws-sdk-sesv2'
126
+ gem "aws-sdk-sesv2"
129
127
  ```
130
128
 
131
129
  And [configure your AWS credentials](https://github.com/aws/aws-sdk-ruby#configuration). Requires `ses:ListSuppressedDestinations` permission.
@@ -137,7 +135,7 @@ If you started using Amazon SES [before November 25, 2019](https://docs.aws.amaz
137
135
  Add the gem
138
136
 
139
137
  ```ruby
140
- gem 'gibbon', '>= 2'
138
+ gem "gibbon", ">= 2"
141
139
  ```
142
140
 
143
141
  And set `ENV["MAILCHIMP_API_KEY"]` and `ENV["MAILCHIMP_LIST_ID"]`.
@@ -147,7 +145,7 @@ And set `ENV["MAILCHIMP_API_KEY"]` and `ENV["MAILCHIMP_LIST_ID"]`.
147
145
  Add the gem
148
146
 
149
147
  ```ruby
150
- gem 'mailgun-ruby'
148
+ gem "mailgun-ruby"
151
149
  ```
152
150
 
153
151
  And set `ENV["MAILGUN_API_KEY"]`.
@@ -157,7 +155,7 @@ And set `ENV["MAILGUN_API_KEY"]`.
157
155
  Add the gem
158
156
 
159
157
  ```ruby
160
- gem 'mandrill-api'
158
+ gem "mandrill-api"
161
159
  ```
162
160
 
163
161
  And set `ENV["MANDRILL_APIKEY"]`.
@@ -167,7 +165,7 @@ And set `ENV["MANDRILL_APIKEY"]`.
167
165
  Add the gem
168
166
 
169
167
  ```ruby
170
- gem 'postmark'
168
+ gem "postmark"
171
169
  ```
172
170
 
173
171
  And set `ENV["POSTMARK_API_KEY"]`.
@@ -177,7 +175,7 @@ And set `ENV["POSTMARK_API_KEY"]`.
177
175
  Add the gem
178
176
 
179
177
  ```ruby
180
- gem 'sendgrid-ruby'
178
+ gem "sendgrid-ruby"
181
179
  ```
182
180
 
183
181
  And set `ENV["SENDGRID_API_KEY"]`. The API key requires only the `Suppressions` permission.
@@ -5,7 +5,11 @@ module Mailkick
5
5
  initializer "mailkick" do |app|
6
6
  Mailkick.discover_services unless Mailkick.services.any?
7
7
 
8
- Mailkick.secret_token ||= begin
8
+ unless Mailkick.secret_token
9
+ Mailkick.secret_token = app.key_generator.generate_key("mailkick")
10
+ Mailkick.message_verifier = ActiveSupport::MessageVerifier.new(Mailkick.secret_token, serializer: JSON)
11
+
12
+ # TODO remove in 2.0
9
13
  creds =
10
14
  if app.respond_to?(:credentials) && app.credentials.secret_key_base
11
15
  app.credentials
@@ -15,7 +19,8 @@ module Mailkick
15
19
  app.config
16
20
  end
17
21
 
18
- creds.respond_to?(:secret_key_base) ? creds.secret_key_base : creds.secret_token
22
+ token = creds.respond_to?(:secret_key_base) ? creds.secret_key_base : creds.secret_token
23
+ Mailkick.message_verifier.rotate(token, serializer: Marshal)
19
24
  end
20
25
  end
21
26
  end
@@ -1,3 +1,3 @@
1
1
  module Mailkick
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/mailkick.rb CHANGED
@@ -22,7 +22,9 @@ require "mailkick/version"
22
22
  require "mailkick/engine" if defined?(Rails)
23
23
 
24
24
  module Mailkick
25
- mattr_accessor :services, :secret_token, :mount, :process_opt_outs_method
25
+ mattr_accessor :services, :mount, :process_opt_outs_method
26
+ mattr_reader :secret_token
27
+ mattr_writer :message_verifier
26
28
  self.services = []
27
29
  self.mount = true
28
30
  self.process_opt_outs_method = ->(_) { raise "process_opt_outs_method not defined" }
@@ -37,8 +39,15 @@ module Mailkick
37
39
  end
38
40
  end
39
41
 
42
+ def self.secret_token=(token)
43
+ @@secret_token = token
44
+ @@message_verifier = nil
45
+ end
46
+
47
+ # TODO use JSON serializer
48
+ # can't currently rotate serializer without rotating token or digest
40
49
  def self.message_verifier
41
- @message_verifier ||= ActiveSupport::MessageVerifier.new(Mailkick.secret_token)
50
+ @@message_verifier ||= ActiveSupport::MessageVerifier.new(Mailkick.secret_token)
42
51
  end
43
52
 
44
53
  def self.generate_token(subscriber, list)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-20 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.2.3
77
+ rubygems_version: 3.4.1
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Email subscriptions for Rails