domaine 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/lib/domaine.rb +10 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cec5960ef254765f677f0ecba1a28665f5c8dd58025111f232db565c8c1ca7e
|
4
|
+
data.tar.gz: 78f0a1a28dc6b64bd325697ee949961a7814bbe7ff1dbc1c2e51edb095b643f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e115f4d986894c6a443c3783d46d9c3be1b955789dd221deaed6396aaa0bec034899d471c8eaf3fc06db466684ac865d2b81009cabb7e1415a2a0345ccc2954
|
7
|
+
data.tar.gz: '028396ae8069691a23594895e7332337342fe2c808b46003bdc5972997e33962d8d142c559e3e5332ea207c05c4b074949c5f3f2c6233172d05014eb32ce20ff'
|
data/lib/domaine.rb
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
module Domain
|
2
|
+
|
3
|
+
VALID_DKIM_KEY = 'ANSWER: 1'.freeze
|
4
|
+
|
5
|
+
##################################################################
|
6
|
+
# This method is used to validate the domain and selector and return
|
7
|
+
# true if the domain and selector are listed in the DNS records.
|
8
|
+
##################################################################
|
2
9
|
def self.valid_dkim(domain, selector)
|
3
10
|
dig_command = "dig txt #{selector}._domainkey.#{domain}"
|
4
11
|
valid_domain = false
|
12
|
+
|
5
13
|
IO.popen(dig_command) do |stdout|
|
6
14
|
output = stdout.read
|
7
|
-
valid_domain =
|
15
|
+
valid_domain = output.include?(VALID_DKIM_KEY) if output
|
8
16
|
end
|
17
|
+
|
9
18
|
valid_domain
|
10
19
|
end
|
11
20
|
end
|