dkim 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,8 @@
1
1
  # dkim Changelog
2
2
 
3
+ ## 2011.07.25, Version 0.0.3
4
+ * add Dkim::Interceptor class for integration with rails and [mail](https://github.com/mikel/mail)
5
+
3
6
  ## 2011.06.01, Version 0.0.2
4
7
 
5
8
  * add convenience method Dkim.sign
data/README.md CHANGED
@@ -72,6 +72,20 @@ If you wish to override this behaviour and use whichever algorithm is available
72
72
 
73
73
  Dkim::signing_algorithm = defined?(OpenSSL::Digest::SHA256) ? 'rsa-sha256' : 'rsa-sha1'
74
74
 
75
+ Usage With Rails
76
+ ================
77
+
78
+ Dkim contains `Dkim::Interceptor` which can be used to sign all mail delivered by the [mail gem](https://github.com/mikel/mail) or rails 3, which uses mail.
79
+ For rails, create an initializer (for example `config/initializers/dkim.rb`) with the following template.
80
+
81
+ # Configure dkim globally (see above)
82
+ Dkim::domain = 'example.com'
83
+ Dkim::selector = 'mail'
84
+ Dkim::private_key = open('private.pem').read
85
+
86
+ # This will sign all ActionMailer deliveries
87
+ ActionMailer::Base.register_interceptor('Dkim::Interceptor')
88
+
75
89
  Example executable
76
90
  ==================
77
91
 
@@ -1,5 +1,6 @@
1
1
 
2
2
  require 'dkim/signed_mail'
3
+ require 'dkim/interceptor'
3
4
 
4
5
  module Dkim
5
6
  DefaultHeaders = %w{
@@ -0,0 +1,9 @@
1
+ module Dkim
2
+ class Interceptor
3
+ def self.delivering_email(message)
4
+ message['DKIM-Signature'] = SignedMail.new(message.encoded).dkim_header.value
5
+ message
6
+ end
7
+ end
8
+ end
9
+
@@ -8,7 +8,7 @@ require 'dkim/header_list'
8
8
  module Dkim
9
9
  class SignedMail
10
10
  def initialize message, options={}
11
- message = message.gsub(/\r?\n/, "\r\n")
11
+ message = message.to_s.gsub(/\r?\n/, "\r\n")
12
12
  headers, body = message.split(/\r?\n\r?\n/, 2)
13
13
  @headers = HeaderList.new headers
14
14
  @body = Body.new body
@@ -1,3 +1,3 @@
1
1
  module Dkim
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dkim
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Hawthorn
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-31 00:00:00 -07:00
19
- default_executable:
18
+ date: 2011-07-26 00:00:00 Z
20
19
  dependencies: []
21
20
 
22
21
  description: gem for adding DKIM signatures to email messages
@@ -42,11 +41,11 @@ files:
42
41
  - lib/dkim/dkim_header.rb
43
42
  - lib/dkim/header.rb
44
43
  - lib/dkim/header_list.rb
44
+ - lib/dkim/interceptor.rb
45
45
  - lib/dkim/signed_mail.rb
46
46
  - lib/dkim/version.rb
47
47
  - test/canonicalization_test.rb
48
48
  - test/test_helper.rb
49
- has_rdoc: true
50
49
  homepage: https://github.com/jhawthorn/dkim
51
50
  licenses: []
52
51
 
@@ -76,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
75
  requirements: []
77
76
 
78
77
  rubyforge_project: dkim
79
- rubygems_version: 1.6.2
78
+ rubygems_version: 1.8.5
80
79
  signing_key:
81
80
  specification_version: 3
82
81
  summary: DKIM library in ruby
OSZAR »