authy 2.6.2 → 2.7.0
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/.travis.yml +4 -0
- data/Gemfile.lock +51 -55
- data/README.md +33 -1
- data/lib/authy/api.rb +3 -1
- data/lib/authy/version.rb +1 -1
- data/spec/authy/api_spec.rb +16 -0
- data/spec/authy/phone_intelligence_spec.rb +4 -0
- data/spec/authy/phone_verification_spec.rb +8 -4
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a7a9d75bf6b712ad35e60eea16462aa4d97bea5
|
|
4
|
+
data.tar.gz: f56ddadf3459645a46cb2d2b13ad83fa1adf3a87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a57a8444a61350a4568af7cff50009a2798e3d0cd69798b133085e45ab179121f8c1b304a160d62300b2812fe80b04478ea55c01f310fe21de24a51ab5e2aa2a
|
|
7
|
+
data.tar.gz: 5e243df783f49669dce867aa303cb5e75009e751748a862a08862b67061fbff211eca00c4f1db3854c45f39ec7b08dd6ddff47f1062d2dedb64f38bb5f0e691d
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
addressable (2.4.0)
|
|
5
|
+
ast (2.2.0)
|
|
6
|
+
axiom-types (0.1.1)
|
|
7
|
+
descendants_tracker (~> 0.0.4)
|
|
6
8
|
ice_nine (~> 0.11.0)
|
|
7
|
-
|
|
8
|
-
addressable (2.3.8)
|
|
9
|
-
ast (2.1.0)
|
|
9
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
10
10
|
builder (3.2.2)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
codeclimate-engine-rb (0.3.1)
|
|
12
|
+
virtus (~> 1.0)
|
|
13
|
+
coderay (1.1.1)
|
|
14
|
+
coercible (1.0.0)
|
|
15
|
+
descendants_tracker (~> 0.0.1)
|
|
15
16
|
descendants_tracker (0.0.4)
|
|
16
17
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
17
18
|
diff-lcs (1.2.5)
|
|
@@ -19,19 +20,18 @@ GEM
|
|
|
19
20
|
equalizer (0.0.11)
|
|
20
21
|
faraday (0.9.2)
|
|
21
22
|
multipart-post (>= 1.2, < 3)
|
|
22
|
-
git (1.
|
|
23
|
-
github_api (0.
|
|
24
|
-
addressable (~> 2.
|
|
23
|
+
git (1.3.0)
|
|
24
|
+
github_api (0.13.1)
|
|
25
|
+
addressable (~> 2.4.0)
|
|
25
26
|
descendants_tracker (~> 0.0.4)
|
|
26
27
|
faraday (~> 0.8, < 0.10)
|
|
27
28
|
hashie (>= 3.4)
|
|
28
29
|
multi_json (>= 1.7.5, < 2.0)
|
|
29
|
-
nokogiri (~> 1.6.6)
|
|
30
30
|
oauth2
|
|
31
31
|
hashie (3.4.3)
|
|
32
32
|
highline (1.7.8)
|
|
33
|
-
httpclient (2.7.
|
|
34
|
-
ice_nine (0.11.
|
|
33
|
+
httpclient (2.7.1)
|
|
34
|
+
ice_nine (0.11.2)
|
|
35
35
|
jeweler (2.0.1)
|
|
36
36
|
builder
|
|
37
37
|
bundler (>= 1.0)
|
|
@@ -42,67 +42,60 @@ GEM
|
|
|
42
42
|
rake
|
|
43
43
|
rdoc
|
|
44
44
|
json (1.8.3)
|
|
45
|
-
jwt (1.5.
|
|
46
|
-
memoizable (0.4.2)
|
|
47
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
|
45
|
+
jwt (1.5.1)
|
|
48
46
|
method_source (0.8.2)
|
|
49
|
-
|
|
47
|
+
mini_portile2 (2.0.0)
|
|
50
48
|
multi_json (1.11.2)
|
|
51
49
|
multi_xml (0.5.5)
|
|
52
50
|
multipart-post (2.0.0)
|
|
53
|
-
nokogiri (1.6.
|
|
54
|
-
|
|
55
|
-
oauth2 (1.
|
|
51
|
+
nokogiri (1.6.7.2)
|
|
52
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
53
|
+
oauth2 (1.1.0)
|
|
56
54
|
faraday (>= 0.8, < 0.10)
|
|
57
|
-
jwt (~> 1.0)
|
|
55
|
+
jwt (~> 1.0, < 1.5.2)
|
|
58
56
|
multi_json (~> 1.3)
|
|
59
57
|
multi_xml (~> 0.5)
|
|
60
|
-
rack (
|
|
61
|
-
parser (2.
|
|
62
|
-
ast (
|
|
63
|
-
private_attr (1.1.0)
|
|
64
|
-
procto (0.0.2)
|
|
58
|
+
rack (>= 1.2, < 3)
|
|
59
|
+
parser (2.3.0.6)
|
|
60
|
+
ast (~> 2.2)
|
|
65
61
|
pry (0.10.3)
|
|
66
62
|
coderay (~> 1.1.0)
|
|
67
63
|
method_source (~> 0.8.1)
|
|
68
64
|
slop (~> 3.4)
|
|
69
65
|
rack (1.6.4)
|
|
70
|
-
rainbow (2.
|
|
71
|
-
rake (
|
|
72
|
-
rdoc (4.2.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
rainbow (2.1.0)
|
|
67
|
+
rake (11.1.1)
|
|
68
|
+
rdoc (4.2.2)
|
|
69
|
+
json (~> 1.4)
|
|
70
|
+
reek (4.0.0)
|
|
71
|
+
codeclimate-engine-rb (~> 0.3.1)
|
|
72
|
+
parser (~> 2.3, >= 2.3.0.6)
|
|
76
73
|
rainbow (~> 2.0)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
rspec-
|
|
80
|
-
rspec-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
rspec-expectations (3.3.1)
|
|
74
|
+
rspec (3.4.0)
|
|
75
|
+
rspec-core (~> 3.4.0)
|
|
76
|
+
rspec-expectations (~> 3.4.0)
|
|
77
|
+
rspec-mocks (~> 3.4.0)
|
|
78
|
+
rspec-core (3.4.4)
|
|
79
|
+
rspec-support (~> 3.4.0)
|
|
80
|
+
rspec-expectations (3.4.0)
|
|
85
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
86
|
-
rspec-support (~> 3.
|
|
87
|
-
rspec-mocks (3.
|
|
82
|
+
rspec-support (~> 3.4.0)
|
|
83
|
+
rspec-mocks (3.4.1)
|
|
88
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
89
|
-
rspec-support (~> 3.
|
|
90
|
-
rspec-support (3.
|
|
91
|
-
simplecov (0.
|
|
85
|
+
rspec-support (~> 3.4.0)
|
|
86
|
+
rspec-support (3.4.1)
|
|
87
|
+
simplecov (0.11.2)
|
|
92
88
|
docile (~> 1.1.0)
|
|
93
89
|
json (~> 1.8)
|
|
94
90
|
simplecov-html (~> 0.10.0)
|
|
95
91
|
simplecov-html (0.10.0)
|
|
96
92
|
slop (3.6.0)
|
|
97
93
|
thread_safe (0.3.5)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
equalizer (~> 0.0.9)
|
|
104
|
-
parser (~> 2.2.2)
|
|
105
|
-
procto (~> 0.0.2)
|
|
94
|
+
virtus (1.0.5)
|
|
95
|
+
axiom-types (~> 0.1)
|
|
96
|
+
coercible (~> 1.0)
|
|
97
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
|
98
|
+
equalizer (~> 0.0, >= 0.0.9)
|
|
106
99
|
yard (0.8.7.6)
|
|
107
100
|
|
|
108
101
|
PLATFORMS
|
|
@@ -117,3 +110,6 @@ DEPENDENCIES
|
|
|
117
110
|
rspec
|
|
118
111
|
simplecov
|
|
119
112
|
yard
|
|
113
|
+
|
|
114
|
+
BUNDLED WITH
|
|
115
|
+
1.11.2
|
data/README.md
CHANGED
|
@@ -152,12 +152,44 @@ end
|
|
|
152
152
|
`Authy::PhoneVerification.check` takes a country code, phone number and a verification code.
|
|
153
153
|
|
|
154
154
|
```ruby
|
|
155
|
-
response = Authy::PhoneVerification.
|
|
155
|
+
response = Authy::PhoneVerification.check(verification_code: "1234", country_code: 1, phone_number: "111-111-1111")
|
|
156
156
|
if response.ok?
|
|
157
157
|
# verification was successful
|
|
158
158
|
end
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
+
## OneTouch Verification
|
|
162
|
+
|
|
163
|
+
Another way to provide Two_factor authentication with Authy is by using OneTouch feature.
|
|
164
|
+
Check the [official docs](http://docs.authy.com/onetouch_getting_started.html)
|
|
165
|
+
|
|
166
|
+
`Authy::OneTouch.send_approval_request` takes the Authy user ID, a message to fill up the push notification
|
|
167
|
+
body, an optional hash details for the user and another optional hash for hidden details for internal app
|
|
168
|
+
control.
|
|
169
|
+
|
|
170
|
+
```ruby
|
|
171
|
+
one_touch = Authy::OneTouch.send_approval_request(
|
|
172
|
+
id: @user.authy_id,
|
|
173
|
+
message: "Request to Login",
|
|
174
|
+
details: {
|
|
175
|
+
'Email Address' => @user.email,
|
|
176
|
+
},
|
|
177
|
+
hidden_details: { ip: '1.1.1.1' }
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
As soon as the user approves or reject the push notification, Authy will hit a callback endpoint
|
|
182
|
+
(set into Dashboard) updating user's `authy_status` flag. You might have an endpoint in a controller
|
|
183
|
+
such as:
|
|
184
|
+
|
|
185
|
+
```ruby
|
|
186
|
+
def callback
|
|
187
|
+
authy_id = params[:authy_id]
|
|
188
|
+
@user = User.find_by authy_id: authy_id
|
|
189
|
+
@user.update(authy_status: params[:status])
|
|
190
|
+
end
|
|
191
|
+
```
|
|
192
|
+
|
|
161
193
|
|
|
162
194
|
## Contributing to authy
|
|
163
195
|
|
data/lib/authy/api.rb
CHANGED
|
@@ -15,9 +15,11 @@ module Authy
|
|
|
15
15
|
|
|
16
16
|
def self.register_user(attributes)
|
|
17
17
|
api_key = attributes.delete(:api_key)
|
|
18
|
+
send_install_link_via_sms = attributes.delete(:send_install_link_via_sms) { true }
|
|
18
19
|
params = {
|
|
19
20
|
:user => attributes,
|
|
20
|
-
:api_key => api_key || Authy.api_key
|
|
21
|
+
:api_key => api_key || Authy.api_key,
|
|
22
|
+
:send_install_link_via_sms => send_install_link_via_sms
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
url = "#{Authy.api_uri}/protected/json/users/new"
|
data/lib/authy/version.rb
CHANGED
data/spec/authy/api_spec.rb
CHANGED
|
@@ -40,6 +40,22 @@ describe "Authy::API" do
|
|
|
40
40
|
user.errors['message'].should =~ /invalid api key/i
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
it "should allow overriding send_install_link_via_sms default" do
|
|
44
|
+
user = Authy::API.register_user(
|
|
45
|
+
:email => generate_email,
|
|
46
|
+
:cellphone => generate_cellphone,
|
|
47
|
+
:country_code => 1,
|
|
48
|
+
:send_install_link_via_sms => false #default is true. See http://docs.authy.com/totp.html#totp-api
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
user.should be_kind_of(Authy::Response)
|
|
52
|
+
|
|
53
|
+
user.should be_kind_of(Authy::User)
|
|
54
|
+
user.should_not be_nil
|
|
55
|
+
user.id.should_not be_nil
|
|
56
|
+
user.id.should be_kind_of(Integer)
|
|
57
|
+
end
|
|
58
|
+
|
|
43
59
|
end
|
|
44
60
|
|
|
45
61
|
describe "verificating tokens" do
|
|
@@ -53,6 +53,8 @@ describe "Authy::PhoneIntelligence" do
|
|
|
53
53
|
|
|
54
54
|
describe "Check the verification code" do
|
|
55
55
|
it "should return success true if code is correct" do
|
|
56
|
+
pending("API is not returning expected response in this case.")
|
|
57
|
+
|
|
56
58
|
response = Authy::PhoneIntelligence.verification_check(
|
|
57
59
|
:country_code => "1",
|
|
58
60
|
:phone_number => "111-111-1111",
|
|
@@ -64,6 +66,8 @@ describe "Authy::PhoneIntelligence" do
|
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
it "should return an error if code is incorrect" do
|
|
69
|
+
pending("API is not returning expected response in this case.")
|
|
70
|
+
|
|
67
71
|
response = Authy::PhoneIntelligence.verification_check(
|
|
68
72
|
:country_code => "1",
|
|
69
73
|
:phone_number => "111-111-1111",
|
|
@@ -53,25 +53,29 @@ describe "Authy::PhoneVerification" do
|
|
|
53
53
|
|
|
54
54
|
describe "Check the verification code" do
|
|
55
55
|
it "should return success true if code is correct" do
|
|
56
|
+
pending("API is not returning expected response in this case.")
|
|
57
|
+
|
|
56
58
|
response = Authy::PhoneVerification.check(
|
|
57
59
|
:country_code => "1",
|
|
58
60
|
:phone_number => "111-111-1111",
|
|
59
61
|
:verification_code => "0000"
|
|
60
62
|
)
|
|
61
63
|
|
|
62
|
-
response.
|
|
63
|
-
response.message.
|
|
64
|
+
expect(response).to be_ok
|
|
65
|
+
expect(response.message).to eq('Verification code is correct.')
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
it "should return an error if code is incorrect" do
|
|
69
|
+
pending("API is not returning expected response in this case.")
|
|
70
|
+
|
|
67
71
|
response = Authy::PhoneVerification.check(
|
|
68
72
|
:country_code => "1",
|
|
69
73
|
:phone_number => "111-111-1111",
|
|
70
74
|
:verification_code => "1234"
|
|
71
75
|
)
|
|
72
76
|
|
|
73
|
-
response.
|
|
74
|
-
response.message.
|
|
77
|
+
expect(response).not_to be_ok
|
|
78
|
+
expect(response.message).to eq('Verification code is incorrect.')
|
|
75
79
|
end
|
|
76
80
|
end
|
|
77
81
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: authy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Authy Inc
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-07-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httpclient
|
|
@@ -133,6 +133,7 @@ files:
|
|
|
133
133
|
- ".document"
|
|
134
134
|
- ".gitignore"
|
|
135
135
|
- ".rspec"
|
|
136
|
+
- ".travis.yml"
|
|
136
137
|
- Gemfile
|
|
137
138
|
- Gemfile.lock
|
|
138
139
|
- LICENSE.txt
|