u2f 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -9
- data/lib/u2f.rb +1 -0
- data/lib/u2f/errors.rb +1 -1
- data/lib/u2f/u2f.rb +2 -2
- data/lib/version.rb +1 -1
- data/spec/lib/u2f_spec.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60022b213b355bdb9a7c8e30d115cd460990d5bb
|
4
|
+
data.tar.gz: c59e0bce1c57789b4fe71f12bfd74576382e78ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02a8053ff4803e1d9f8ebb0c4fd7b9ea36beebcad129d6b4842ca7b4db13a1f4b5611418b41c4571351f470c5641fc1a0200cd40c0d1cd2d9f10c168a50180c4
|
7
|
+
data.tar.gz: 537e239d9577a020d3a796dbf9840aa243b0432274fe29ed40e02b2ece1c75384dadd18ee26417d7153126e40dc903c9f5d7b6e7844696fc0ba40a95a60fc210
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# Ruby U2F
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/u2f.png)](http://badge.fury.io/rb/u2f)
|
4
|
-
[![Dependency Status](https://gemnasium.com/
|
5
|
-
[![security](https://hakiri.io/github/
|
4
|
+
[![Dependency Status](https://gemnasium.com/castle/ruby-u2f.svg)](https://gemnasium.com/castle/ruby-u2f)
|
5
|
+
[![security](https://hakiri.io/github/castle/ruby-u2f/master.svg)](https://hakiri.io/github/castle/ruby-u2f/master)
|
6
6
|
|
7
|
-
[![Build Status](https://travis-ci.org/
|
8
|
-
[![Code Climate](https://codeclimate.com/github/
|
9
|
-
[![Coverage Status](https://img.shields.io/coveralls/
|
7
|
+
[![Build Status](https://travis-ci.org/castle/ruby-u2f.png)](https://travis-ci.org/castle/ruby-u2f)
|
8
|
+
[![Code Climate](https://codeclimate.com/github/castle/ruby-u2f/badges/gpa.svg)](https://codeclimate.com/github/castle/ruby-u2f)
|
9
|
+
[![Coverage Status](https://img.shields.io/coveralls/castle/ruby-u2f.svg)](https://coveralls.io/r/castle/ruby-u2f)
|
10
10
|
|
11
11
|
Provides functionality for working with the server side aspects of the U2F
|
12
12
|
protocol as defined in the [FIDO specifications](http://fidoalliance.org/specifications/download). To read more about U2F and how to use a U2F library, visit [developers.yubico.com/U2F](http://developers.yubico.com/U2F).
|
@@ -17,7 +17,7 @@ U2F is an open 2-factor authentication standard that enables keychain devices, m
|
|
17
17
|
|
18
18
|
## Working example application
|
19
19
|
|
20
|
-
Check out the [example](https://github.com/
|
20
|
+
Check out the [example](https://github.com/castle/ruby-u2f/tree/master/example) directory for a fully working Padrino server demonstrating U2F.
|
21
21
|
|
22
22
|
## Installation
|
23
23
|
|
@@ -42,7 +42,7 @@ The U2F library has two major tasks:
|
|
42
42
|
|
43
43
|
Each task starts by generating a challenge on the server, which is rendered to a web view, read by the browser API:s and transmitted to the plugged in U2F devices for verification. The U2F device responds and triggers a callback in the browser, and a form is posted back to your server where you verify the challenge and store the U2F device information to your database.
|
44
44
|
|
45
|
-
You'll need an instance of `U2F:U2F`, which is conveniently placed in an [instance method](https://github.com/
|
45
|
+
You'll need an instance of `U2F:U2F`, which is conveniently placed in an [instance method](https://github.com/castle/ruby-u2f/blob/master/example/app/helpers/helpers.rb) on the controller. The initializer takes an **App ID** as argument.
|
46
46
|
|
47
47
|
```ruby
|
48
48
|
def u2f
|
@@ -190,7 +190,8 @@ def create
|
|
190
190
|
|
191
191
|
begin
|
192
192
|
u2f.authenticate!(session[:challenges], response,
|
193
|
-
registration.public_key,
|
193
|
+
Base64.decode64(registration.public_key),
|
194
|
+
registration.counter)
|
194
195
|
rescue U2F::Error => e
|
195
196
|
return "Unable to authenticate: <%= e.class.name %>"
|
196
197
|
ensure
|
@@ -205,4 +206,4 @@ end
|
|
205
206
|
|
206
207
|
## License
|
207
208
|
|
208
|
-
MIT License. Copyright (c)
|
209
|
+
MIT License. Copyright (c) 2015 by Johan Brissmyr and Sebastian Wallin
|
data/lib/u2f.rb
CHANGED
data/lib/u2f/errors.rb
CHANGED
@@ -8,7 +8,7 @@ module U2F
|
|
8
8
|
class AttestationSignatureError < Error; end
|
9
9
|
class NoMatchingRequestError < Error; end
|
10
10
|
class NoMatchingRegistrationError < Error; end
|
11
|
-
class
|
11
|
+
class CounterTooLowError < Error; end
|
12
12
|
class AuthenticationFailedError < Error; end
|
13
13
|
class UserNotPresentError < Error;end
|
14
14
|
|
data/lib/u2f/u2f.rb
CHANGED
@@ -39,7 +39,7 @@ module U2F
|
|
39
39
|
# - +ClientDataTypeError+:: if the response is of the wrong type
|
40
40
|
# - +AuthenticationFailedError+:: if the authentication failed
|
41
41
|
# - +UserNotPresentError+:: if the user wasn't present during the authentication
|
42
|
-
# - +
|
42
|
+
# - +CounterTooLowError+:: if there is a counter mismatch between the registered one and the one in the response.
|
43
43
|
#
|
44
44
|
def authenticate!(challenges, response, registration_public_key,
|
45
45
|
registration_counter)
|
@@ -60,7 +60,7 @@ module U2F
|
|
60
60
|
fail UserNotPresentError unless response.user_present?
|
61
61
|
|
62
62
|
unless response.counter > registration_counter
|
63
|
-
fail
|
63
|
+
fail CounterTooLowError
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
data/lib/version.rb
CHANGED
data/spec/lib/u2f_spec.rb
CHANGED
@@ -61,8 +61,8 @@ describe U2F do
|
|
61
61
|
|
62
62
|
context 'with incorrect counter' do
|
63
63
|
let(:counter) { 1000 }
|
64
|
-
it 'raises
|
65
|
-
expect { u2f_authenticate }.to raise_error(U2F::
|
64
|
+
it 'raises CounterTooLowError' do
|
65
|
+
expect { u2f_authenticate }.to raise_error(U2F::CounterTooLowError)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
context 'with incorrect counter' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: u2f
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Brissmyr
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -122,7 +122,7 @@ files:
|
|
122
122
|
- spec/lib/sign_response_spec.rb
|
123
123
|
- spec/lib/u2f_spec.rb
|
124
124
|
- spec/spec_helper.rb
|
125
|
-
homepage: https://github.com/
|
125
|
+
homepage: https://github.com/castle/ruby-u2f
|
126
126
|
licenses:
|
127
127
|
- MIT
|
128
128
|
metadata: {}
|