authy 2.7.4 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +21 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile +1 -11
- data/LICENSE.txt +1 -1
- data/README.md +59 -184
- data/authy.gemspec +2 -4
- data/examples/Gemfile +6 -0
- data/examples/README.md +48 -0
- data/examples/demo.rb +23 -19
- data/lib/authy/api.rb +67 -61
- data/lib/authy/config.rb +8 -0
- data/lib/authy/onetouch.rb +1 -1
- data/lib/authy/phone_verification.rb +5 -2
- data/lib/authy/url_helpers.rb +0 -4
- data/lib/authy/version.rb +1 -1
- data/lib/authy.rb +2 -2
- data/spec/authy/api_spec.rb +388 -92
- data/spec/authy/config_spec.rb +21 -1
- data/spec/authy/onetouch_spec.rb +86 -30
- data/spec/authy/phone_verification_spec.rb +185 -54
- data/spec/authy/url_helpers_spec.rb +0 -12
- data/spec/spec_helper.rb +1 -2
- data/verify-legacy-v1.md +35 -0
- metadata +14 -17
- data/.travis.yml +0 -4
- data/Gemfile.lock +0 -118
- data/examples/pv-check.rb +0 -9
- data/examples/pv.rb +0 -12
- data/lib/authy/core_ext.rb +0 -26
- data/lib/authy/phone_intelligence.rb +0 -23
- data/spec/authy/phone_intelligence_spec.rb +0 -94
data/spec/authy/config_spec.rb
CHANGED
@@ -12,7 +12,6 @@ describe 'Authy' do
|
|
12
12
|
Authy.api_key = @default_api_key
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
15
|
it "should set and read instance variable" do
|
17
16
|
Authy.api_key = 'foo'
|
18
17
|
expect(Authy.api_key).to eq 'foo'
|
@@ -44,4 +43,25 @@ describe 'Authy' do
|
|
44
43
|
expect(Authy.api_url).to eq 'https://api.authy.com'
|
45
44
|
end
|
46
45
|
end
|
46
|
+
|
47
|
+
describe "user_agent" do
|
48
|
+
before do
|
49
|
+
@default_user_agent = Authy.user_agent
|
50
|
+
Authy.user_agent = nil
|
51
|
+
end
|
52
|
+
|
53
|
+
after do
|
54
|
+
Authy.user_agent = @default_user_agent
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should set and read instance variable" do
|
58
|
+
Authy.user_agent = 'AuthyRuby NewUserAgent'
|
59
|
+
expect(Authy.user_agent).to eq 'AuthyRuby NewUserAgent'
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should fallback to default value" do
|
63
|
+
Authy.user_agent = nil
|
64
|
+
expect(Authy.user_agent).to eq "AuthyRuby/#{Authy::VERSION} (#{RUBY_PLATFORM}, Ruby #{RUBY_VERSION})"
|
65
|
+
end
|
66
|
+
end
|
47
67
|
end
|
data/spec/authy/onetouch_spec.rb
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
class Utils
|
4
|
+
include Authy::URL
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@user = Authy::API.register_user(:email => @email,
|
10
|
-
:cellphone => @cellphone,
|
11
|
-
:country_code => 1)
|
12
|
-
expect(@user).to be_ok
|
13
|
-
end
|
7
|
+
describe Authy::OneTouch do
|
8
|
+
let(:headers) { { "X-Authy-API-Key" => Authy.api_key, "User-Agent" => "AuthyRuby/#{Authy::VERSION} (#{RUBY_PLATFORM}, Ruby #{RUBY_VERSION})" } }
|
9
|
+
let(:user_id) { 81547 }
|
14
10
|
|
11
|
+
describe ".send_approval_request" do
|
12
|
+
let(:url) { "#{Authy.api_url}/onetouch/json/users/#{user_id}/approval_requests" }
|
15
13
|
it 'creates a new approval_request for user' do
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
response_json = {
|
15
|
+
"approval_request" => {
|
16
|
+
"uuid" => "550e8400-e29b-41d4-a716-446655440000"
|
17
|
+
},
|
18
|
+
"success" => true
|
19
|
+
}.to_json
|
20
|
+
params = {
|
19
21
|
message: 'You are moving 10 BTC from your account',
|
20
22
|
details: {
|
21
23
|
'Bank account' => '23527922',
|
@@ -25,15 +27,27 @@ describe Authy::OneTouch do
|
|
25
27
|
'IP Address' => '192.168.0.3'
|
26
28
|
},
|
27
29
|
seconds_to_expire: 150
|
28
|
-
|
30
|
+
}
|
31
|
+
|
32
|
+
expect(Authy::API.http_client).to receive(:request)
|
33
|
+
.once
|
34
|
+
.with(:post, url, {
|
35
|
+
:body => Utils.escape_query(params),
|
36
|
+
:header => headers
|
37
|
+
})
|
38
|
+
.and_return(double(:status => 200, :body => response_json))
|
39
|
+
|
40
|
+
params[:id] = user_id
|
41
|
+
response = Authy::OneTouch.send_approval_request(params)
|
29
42
|
|
30
43
|
expect(response).to be_kind_of(Authy::Response)
|
31
44
|
expect(response).to be_ok
|
32
45
|
end
|
33
46
|
|
34
47
|
it 'requires message as mandatory' do
|
48
|
+
expect(Authy::API.http_client).to receive(:request).never
|
35
49
|
response = Authy::OneTouch.send_approval_request(
|
36
|
-
id:
|
50
|
+
id: user_id,
|
37
51
|
details: {
|
38
52
|
'Bank account' => '23527922',
|
39
53
|
'Amount' => '10 BTC',
|
@@ -49,20 +63,39 @@ describe Authy::OneTouch do
|
|
49
63
|
end
|
50
64
|
|
51
65
|
it 'does not require other fields as mandatory' do
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
66
|
+
response_json = {
|
67
|
+
"approval_request" => {
|
68
|
+
"uuid" => "550e8400-e29b-41d4-a716-446655440000"
|
69
|
+
},
|
70
|
+
"success" => true
|
71
|
+
}.to_json
|
72
|
+
params = {
|
73
|
+
message: 'You are moving 10 BTC from your account'
|
74
|
+
}
|
75
|
+
|
76
|
+
expect(Authy::API.http_client).to receive(:request)
|
77
|
+
.once
|
78
|
+
.with(:post, url, {
|
79
|
+
:body => Utils.escape_query(params),
|
80
|
+
:header => headers
|
81
|
+
})
|
82
|
+
.and_return(double(:status => 200, :body => response_json))
|
83
|
+
|
84
|
+
params[:id] = user_id
|
85
|
+
response = Authy::OneTouch.send_approval_request(params)
|
57
86
|
|
58
87
|
expect(response).to be_kind_of(Authy::Response)
|
59
88
|
expect(response).to be_ok
|
60
89
|
end
|
61
90
|
|
62
91
|
it 'checks logos format' do
|
63
|
-
|
64
|
-
|
65
|
-
|
92
|
+
response_json = {
|
93
|
+
"approval_request" => {
|
94
|
+
"uuid" => "550e8400-e29b-41d4-a716-446655440000"
|
95
|
+
},
|
96
|
+
"success" => true
|
97
|
+
}.to_json
|
98
|
+
params = {
|
66
99
|
message: 'You are moving 10 BTC from your account',
|
67
100
|
details: {
|
68
101
|
'Bank account' => '23527922',
|
@@ -71,9 +104,19 @@ describe Authy::OneTouch do
|
|
71
104
|
hidden_details: {
|
72
105
|
'IP Address' => '192.168.0.3'
|
73
106
|
},
|
74
|
-
|
75
|
-
|
76
|
-
|
107
|
+
logos: [{res: 'low', url: 'http://foo.bar'}],
|
108
|
+
seconds_to_expire: 150
|
109
|
+
}
|
110
|
+
expect(Authy::API.http_client).to receive(:request)
|
111
|
+
.once
|
112
|
+
.with(:post, url, {
|
113
|
+
:body => Utils.escape_query(params),
|
114
|
+
:header => headers
|
115
|
+
})
|
116
|
+
.and_return(double(:status => 200, :body => response_json))
|
117
|
+
|
118
|
+
params[:id] = user_id
|
119
|
+
response = Authy::OneTouch.send_approval_request(params)
|
77
120
|
|
78
121
|
expect(response).to be_kind_of(Authy::Response)
|
79
122
|
expect(response).to be_ok
|
@@ -82,10 +125,23 @@ describe Authy::OneTouch do
|
|
82
125
|
|
83
126
|
describe '.approval_request_status' do
|
84
127
|
it 'returns approval request status' do
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
128
|
+
uuid = '550e8400-e29b-41d4-a716-446655440000'
|
129
|
+
url = "#{Authy.api_url}/onetouch/json/approval_requests/#{uuid}"
|
130
|
+
response_json = {
|
131
|
+
"approval_request" => {
|
132
|
+
"status" => "pending"
|
133
|
+
},
|
134
|
+
"success" => true
|
135
|
+
}.to_json
|
136
|
+
expect(Authy::API.http_client).to receive(:request)
|
137
|
+
.once
|
138
|
+
.with(:get, url, {
|
139
|
+
:header => headers,
|
140
|
+
:query => {},
|
141
|
+
:follow_redirect => nil
|
142
|
+
})
|
143
|
+
.and_return(double(:status => 200, :body => response_json))
|
144
|
+
response = Authy::OneTouch.approval_request_status(uuid: uuid)
|
89
145
|
|
90
146
|
expect(response).to be_kind_of(Authy::Response)
|
91
147
|
expect(response).to be_ok
|
@@ -1,108 +1,239 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
class Utils
|
4
|
+
include Authy::URL
|
5
|
+
end
|
6
|
+
|
3
7
|
describe "Authy::PhoneVerification" do
|
4
|
-
|
8
|
+
let(:valid_phone_number) { '201-555-0123' }
|
9
|
+
let(:invalid_phone_number) { '123' }
|
10
|
+
let(:headers) { { "X-Authy-API-Key" => Authy.api_key, "User-Agent" => "AuthyRuby/#{Authy::VERSION} (#{RUBY_PLATFORM}, Ruby #{RUBY_VERSION})" } }
|
11
|
+
let(:start_url) { "#{Authy.api_url}/protected/json/phones/verification/start" }
|
12
|
+
let(:check_url) { "#{Authy.api_url}/protected/json/phones/verification/check"}
|
5
13
|
|
14
|
+
describe "Sending the verification code" do
|
6
15
|
it "should send the code via SMS" do
|
7
|
-
|
8
|
-
|
16
|
+
response_json = {
|
17
|
+
"carrier" => "Fixed Line Operators and Other Networks",
|
18
|
+
"is_cellphone" => true,
|
19
|
+
"is_ported" => false,
|
20
|
+
"message" => "Text message sent to +1 201-555-0123.",
|
21
|
+
"seconds_to_expire" => 0,
|
22
|
+
"uuid" => nil,
|
23
|
+
"success" => true
|
24
|
+
}.to_json
|
25
|
+
params = {
|
9
26
|
via: "sms",
|
10
27
|
country_code: "1",
|
11
|
-
phone_number:
|
12
|
-
|
13
|
-
|
28
|
+
phone_number: valid_phone_number
|
29
|
+
}
|
30
|
+
expect(Authy::API.http_client).to receive(:request)
|
31
|
+
.once
|
32
|
+
.with(:post, start_url, {
|
33
|
+
:body => Utils.escape_query(params),
|
34
|
+
:header => headers
|
35
|
+
})
|
36
|
+
.and_return(double(:status => 200, :body => response_json))
|
37
|
+
response = Authy::PhoneVerification.start(params)
|
14
38
|
expect(response).to be_kind_of(Authy::Response)
|
15
39
|
expect(response).to be_ok
|
16
|
-
expect(response.message).to eq "Text message sent to +1
|
40
|
+
expect(response.message).to eq "Text message sent to +1 #{valid_phone_number}."
|
17
41
|
end
|
18
42
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
43
|
+
it "should send the code via SMS with code length" do
|
44
|
+
response_json = {
|
45
|
+
"carrier" => "Fixed Line Operators and Other Networks",
|
46
|
+
"is_cellphone" => true,
|
47
|
+
"is_ported" => false,
|
48
|
+
"message" => "Text message sent to +1 201-555-0123.",
|
49
|
+
"seconds_to_expire" => 0,
|
50
|
+
"uuid" => nil,
|
51
|
+
"success" => true
|
52
|
+
}.to_json
|
53
|
+
params = {
|
54
|
+
via: "sms",
|
55
|
+
country_code: "1",
|
56
|
+
phone_number: valid_phone_number,
|
57
|
+
code_length: "4"
|
58
|
+
}
|
59
|
+
expect(Authy::API.http_client).to receive(:request)
|
60
|
+
.once
|
61
|
+
.with(:post, start_url, {
|
62
|
+
:body => Utils.escape_query(params),
|
63
|
+
:header => headers
|
64
|
+
})
|
65
|
+
.and_return(double(:status => 200, :body => response_json))
|
66
|
+
response = Authy::PhoneVerification.start(params)
|
67
|
+
|
68
|
+
expect(response).to be_kind_of(Authy::Response)
|
69
|
+
expect(response).to be_ok
|
70
|
+
expect(response.message).to eq "Text message sent to +1 #{valid_phone_number}."
|
71
|
+
end
|
30
72
|
end
|
31
73
|
|
32
74
|
describe "validate the fields required" do
|
33
75
|
it "should return an error. Country code is required" do
|
34
|
-
|
76
|
+
response_json = {
|
77
|
+
"error_code" => "60004",
|
78
|
+
"message" => "Invalid parameter: country_code - Parameter is required",
|
79
|
+
"errors" => {
|
80
|
+
"message" => "Invalid parameter: country_code - Parameter is required"
|
81
|
+
},
|
82
|
+
"success" => false
|
83
|
+
}.to_json
|
84
|
+
params = {
|
35
85
|
via: "sms",
|
36
|
-
phone_number:
|
37
|
-
|
38
|
-
|
86
|
+
phone_number: valid_phone_number
|
87
|
+
}
|
88
|
+
expect(Authy::API.http_client).to receive(:request)
|
89
|
+
.once
|
90
|
+
.with(:post, start_url, {
|
91
|
+
:body => Utils.escape_query(params),
|
92
|
+
:header => headers
|
93
|
+
})
|
94
|
+
.and_return(double(:status => 400, :body => response_json))
|
95
|
+
response = Authy::PhoneVerification.start(params)
|
39
96
|
|
40
97
|
expect(response).to_not be_ok
|
41
98
|
expect(response.errors['message']).to match(/country_code - Parameter is required/)
|
42
99
|
end
|
43
100
|
|
44
101
|
it "should return an error. Cellphone is invalid" do
|
45
|
-
|
102
|
+
response_json = {
|
103
|
+
"error_code" => "60033",
|
104
|
+
"message" => "Phone number is invalid",
|
105
|
+
"errors" => {
|
106
|
+
"message" => "Phone number is invalid"
|
107
|
+
},
|
108
|
+
"success" => false
|
109
|
+
}.to_json
|
110
|
+
params = {
|
46
111
|
via: "sms",
|
47
112
|
country_code: "1",
|
48
|
-
phone_number:
|
49
|
-
|
113
|
+
phone_number: invalid_phone_number
|
114
|
+
}
|
115
|
+
expect(Authy::API.http_client).to receive(:request)
|
116
|
+
.once
|
117
|
+
.with(:post, start_url, {
|
118
|
+
:body => Utils.escape_query(params),
|
119
|
+
:header => headers
|
120
|
+
})
|
121
|
+
.and_return(double(:status => 400, :body => response_json))
|
122
|
+
response = Authy::PhoneVerification.start(params)
|
50
123
|
|
51
124
|
expect(response).to_not be_ok
|
52
125
|
expect(response.errors['message']).to eq('Phone number is invalid')
|
53
126
|
end
|
54
127
|
end
|
55
128
|
|
56
|
-
describe 'Check that a custom code request' do
|
57
|
-
it "should return an error if not enabled" do
|
58
|
-
pending("API is not returning expected response in this case. The test phone number is invalid")
|
59
|
-
|
60
|
-
response = Authy::PhoneVerification.start(
|
61
|
-
country_code: "1",
|
62
|
-
phone_number: "111-111-1111",
|
63
|
-
custom_code: "1234"
|
64
|
-
)
|
65
|
-
expect(response).not_to be_ok
|
66
|
-
expect(response.message).to eq("Phone verification couldn't be created: custom codes are not allowed.")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
129
|
describe "Check the verification code" do
|
71
130
|
it "should return success true if code is correct" do
|
72
|
-
|
73
|
-
|
74
|
-
|
131
|
+
response_json = {
|
132
|
+
"message" => "Verification code is correct.",
|
133
|
+
"success" => true
|
134
|
+
}.to_json
|
135
|
+
params = {
|
75
136
|
country_code: "1",
|
76
|
-
phone_number:
|
137
|
+
phone_number: valid_phone_number,
|
77
138
|
verification_code: "0000"
|
78
|
-
|
139
|
+
}
|
140
|
+
expect(Authy::API.http_client).to receive(:request)
|
141
|
+
.once
|
142
|
+
.with(:get, check_url, {
|
143
|
+
:query => params,
|
144
|
+
:header => headers,
|
145
|
+
:follow_redirect => nil
|
146
|
+
})
|
147
|
+
.and_return(double(:status => 200, :body => response_json))
|
148
|
+
response = Authy::PhoneVerification.check(params)
|
79
149
|
|
80
150
|
expect(response).to be_ok
|
81
151
|
expect(response.message).to eq('Verification code is correct.')
|
82
152
|
end
|
83
153
|
|
84
154
|
it "should return an error if code is incorrect" do
|
85
|
-
|
86
|
-
|
87
|
-
|
155
|
+
response_json = {
|
156
|
+
"error_code" => "60022",
|
157
|
+
"message" => "Verification code is incorrect",
|
158
|
+
"errors" => {
|
159
|
+
"message" => "Verification code is incorrect"
|
160
|
+
},
|
161
|
+
"success" => false
|
162
|
+
}.to_json
|
163
|
+
params = {
|
88
164
|
country_code: "1",
|
89
|
-
phone_number:
|
165
|
+
phone_number: valid_phone_number,
|
90
166
|
verification_code: "1234"
|
91
|
-
|
167
|
+
}
|
168
|
+
expect(Authy::API.http_client).to receive(:request)
|
169
|
+
.once
|
170
|
+
.with(:get, check_url, {
|
171
|
+
:query => params,
|
172
|
+
:header => headers,
|
173
|
+
:follow_redirect => nil
|
174
|
+
})
|
175
|
+
.and_return(double(:status => 401, :body => response_json))
|
176
|
+
response = Authy::PhoneVerification.check(params)
|
177
|
+
|
178
|
+
expect(response).not_to be_ok
|
179
|
+
expect(response.message).to eq('Verification code is incorrect')
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should return an error if there are no active verifications" do
|
183
|
+
response_json = {
|
184
|
+
"message" => "No pending verifications for #{valid_phone_number} found.",
|
185
|
+
"success" => false,
|
186
|
+
"errors" => {
|
187
|
+
"message" => "No pending verifications for #{valid_phone_number} found."
|
188
|
+
},
|
189
|
+
"error_code" => "60023"
|
190
|
+
}.to_json
|
191
|
+
params = {
|
192
|
+
:country_code => "1",
|
193
|
+
:phone_number => valid_phone_number,
|
194
|
+
:verification_code => "1234"
|
195
|
+
}
|
196
|
+
expect(Authy::API.http_client).to receive(:request)
|
197
|
+
.once
|
198
|
+
.with(:get, check_url, {
|
199
|
+
:query => params,
|
200
|
+
:header => headers,
|
201
|
+
:follow_redirect => nil
|
202
|
+
})
|
203
|
+
.and_return(double(:status => 404, :body => response_json))
|
204
|
+
|
205
|
+
response = Authy::PhoneVerification.check(params)
|
92
206
|
|
93
207
|
expect(response).not_to be_ok
|
94
|
-
expect(response.message).to eq(
|
208
|
+
expect(response.message).to eq("No pending verifications for #{valid_phone_number} found.")
|
95
209
|
end
|
96
210
|
end
|
97
211
|
|
98
212
|
describe 'Check the phone number' do
|
99
213
|
it "should return an error if phone number is invalid" do
|
100
|
-
|
214
|
+
response_json = {
|
215
|
+
"error_code" => "60033",
|
216
|
+
"message" => "Phone number is invalid",
|
217
|
+
"errors" => {
|
218
|
+
"message" => "Phone number is invalid"
|
219
|
+
},
|
220
|
+
"success" => false
|
221
|
+
}.to_json
|
222
|
+
params = {
|
101
223
|
country_code: "1",
|
102
|
-
phone_number:
|
224
|
+
phone_number: invalid_phone_number,
|
103
225
|
verification_code: "1234"
|
104
|
-
|
105
|
-
|
226
|
+
}
|
227
|
+
expect(Authy::API.http_client).to receive(:request)
|
228
|
+
.once
|
229
|
+
.with(:get, check_url, {
|
230
|
+
:query => params,
|
231
|
+
:header => headers,
|
232
|
+
:follow_redirect => nil
|
233
|
+
})
|
234
|
+
.and_return(double(:status => 400, :body => response_json))
|
235
|
+
|
236
|
+
response = Authy::PhoneVerification.check(params)
|
106
237
|
expect(response).not_to be_ok
|
107
238
|
expect(response.message).to eq('Phone number is invalid')
|
108
239
|
end
|
@@ -5,18 +5,6 @@ describe "Authy::URL" do
|
|
5
5
|
include Authy::URL
|
6
6
|
end
|
7
7
|
|
8
|
-
describe "escape_for_url" do
|
9
|
-
it "should user URI escape" do
|
10
|
-
expect(URI).to receive :escape
|
11
|
-
Dummy.escape_for_url("that")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should use Regexp" do
|
15
|
-
expect(Regexp).to receive(:new).with("[^#{URI::PATTERN::UNRESERVED}]").and_return(/a/)
|
16
|
-
Dummy.escape_for_url("that")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
8
|
describe "to_param" do
|
21
9
|
it "should user HTTP::Message.escape" do
|
22
10
|
expect(HTTP::Message).to receive(:escape).exactly(2).times.and_return "basic string"
|
data/spec/spec_helper.rb
CHANGED
@@ -11,8 +11,7 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
11
11
|
|
12
12
|
RSpec.configure do |config|
|
13
13
|
config.before(:suite) do
|
14
|
-
Authy.
|
15
|
-
Authy.api_key = 'bf12974d70818a08199d17d5e2bae630'
|
14
|
+
Authy.api_key = 'valid_api_key'
|
16
15
|
end
|
17
16
|
|
18
17
|
def generate_email
|
data/verify-legacy-v1.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Phone Verification V1
|
2
|
+
|
3
|
+
[Version 2 of the Verify API is now available!](https://www.twilio.com/docs/verify/api) V2 has an improved developer experience and new features. Some of the features of the V2 API include:
|
4
|
+
|
5
|
+
* Twilio helper libraries in JavaScript, Java, C#, Python, Ruby, and PHP
|
6
|
+
* PSD2 Secure Customer Authentication Support
|
7
|
+
* Improved Visibility and Insights
|
8
|
+
|
9
|
+
You are currently viewing Version 1. V1 of the API will be maintained for the time being, but any new features and development will be on Version 2. We strongly encourage you to do any new development with API V2. Check out the migration guide or the API Reference for more information.
|
10
|
+
|
11
|
+
### API Reference
|
12
|
+
|
13
|
+
API Reference is available at https://www.twilio.com/docs/verify/api/v1
|
14
|
+
|
15
|
+
### Starting a phone verification
|
16
|
+
|
17
|
+
`Authy::PhoneVerification.start` takes a country code, phone number and a method (sms or call) to deliver the code.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
response = Authy::PhoneVerification.start(via: "sms", country_code: 1, phone_number: "111-111-1111")
|
21
|
+
if response.ok?
|
22
|
+
# verification was started
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
### Checking a phone verification
|
27
|
+
|
28
|
+
`Authy::PhoneVerification.check` takes a country code, phone number and a verification code.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
response = Authy::PhoneVerification.check(verification_code: "1234", country_code: 1, phone_number: "111-111-1111")
|
32
|
+
if response.ok?
|
33
|
+
# verification was successful
|
34
|
+
end
|
35
|
+
```
|
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:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Authy Inc
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -122,7 +122,8 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
description: Ruby library to access Authy services
|
125
|
+
description: Ruby library to access Authy services. This gem is deprecated, please
|
126
|
+
see the README for details.
|
126
127
|
email:
|
127
128
|
- support@authy.com
|
128
129
|
executables:
|
@@ -131,26 +132,24 @@ extensions: []
|
|
131
132
|
extra_rdoc_files: []
|
132
133
|
files:
|
133
134
|
- ".document"
|
135
|
+
- ".github/workflows/build.yml"
|
134
136
|
- ".gitignore"
|
135
137
|
- ".rspec"
|
136
|
-
-
|
138
|
+
- CHANGELOG.md
|
137
139
|
- Gemfile
|
138
|
-
- Gemfile.lock
|
139
140
|
- LICENSE.txt
|
140
141
|
- README.md
|
141
142
|
- Rakefile
|
142
143
|
- authy.gemspec
|
143
144
|
- bin/authy-api-console
|
145
|
+
- examples/Gemfile
|
146
|
+
- examples/README.md
|
144
147
|
- examples/demo.rb
|
145
|
-
- examples/pv-check.rb
|
146
|
-
- examples/pv.rb
|
147
148
|
- lib/authy.rb
|
148
149
|
- lib/authy/api.rb
|
149
150
|
- lib/authy/config.rb
|
150
|
-
- lib/authy/core_ext.rb
|
151
151
|
- lib/authy/models/user.rb
|
152
152
|
- lib/authy/onetouch.rb
|
153
|
-
- lib/authy/phone_intelligence.rb
|
154
153
|
- lib/authy/phone_verification.rb
|
155
154
|
- lib/authy/response.rb
|
156
155
|
- lib/authy/url_helpers.rb
|
@@ -158,16 +157,16 @@ files:
|
|
158
157
|
- spec/authy/api_spec.rb
|
159
158
|
- spec/authy/config_spec.rb
|
160
159
|
- spec/authy/onetouch_spec.rb
|
161
|
-
- spec/authy/phone_intelligence_spec.rb
|
162
160
|
- spec/authy/phone_verification_spec.rb
|
163
161
|
- spec/authy/response_spec.rb
|
164
162
|
- spec/authy/url_helpers_spec.rb
|
165
163
|
- spec/spec_helper.rb
|
164
|
+
- verify-legacy-v1.md
|
166
165
|
homepage: https://github.com/authy/authy-ruby
|
167
166
|
licenses:
|
168
167
|
- MIT
|
169
168
|
metadata: {}
|
170
|
-
post_install_message:
|
169
|
+
post_install_message:
|
171
170
|
rdoc_options: []
|
172
171
|
require_paths:
|
173
172
|
- lib
|
@@ -182,16 +181,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
181
|
- !ruby/object:Gem::Version
|
183
182
|
version: '0'
|
184
183
|
requirements: []
|
185
|
-
|
186
|
-
|
187
|
-
signing_key:
|
184
|
+
rubygems_version: 3.3.7
|
185
|
+
signing_key:
|
188
186
|
specification_version: 4
|
189
|
-
summary:
|
187
|
+
summary: 'Deprecated: please see README for details'
|
190
188
|
test_files:
|
191
189
|
- spec/authy/api_spec.rb
|
192
190
|
- spec/authy/config_spec.rb
|
193
191
|
- spec/authy/onetouch_spec.rb
|
194
|
-
- spec/authy/phone_intelligence_spec.rb
|
195
192
|
- spec/authy/phone_verification_spec.rb
|
196
193
|
- spec/authy/response_spec.rb
|
197
194
|
- spec/authy/url_helpers_spec.rb
|
data/.travis.yml
DELETED