u2f 0.0.5 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dbc29d27e9240d257117ceeb21f4b9ccfd4eaca
4
- data.tar.gz: 56de14fcf1ef2a43fb94baf79e64e9ed5342ab29
3
+ metadata.gz: 60022b213b355bdb9a7c8e30d115cd460990d5bb
4
+ data.tar.gz: c59e0bce1c57789b4fe71f12bfd74576382e78ce
5
5
  SHA512:
6
- metadata.gz: c6adbe094c03b9b0456172d3fa5549766bfa0ef892d95f1d8952660b93f278ea24b06bb227f0cc9812f2f583eee73bb7945e496b3418cf61262b5699f17a692a
7
- data.tar.gz: edc10c0b3fec9b9a5340cff09a3ac24bc60a9d9690fc73687edef2186804c3e7a4582eccf885d3709e62b59c22d14991d3528317b05e9b971dd8491ce3c3383e
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/userbin/ruby-u2f.svg)](https://gemnasium.com/userbin/ruby-u2f)
5
- [![security](https://hakiri.io/github/userbin/ruby-u2f/master.svg)](https://hakiri.io/github/userbin/ruby-u2f/master)
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/userbin/ruby-u2f.png)](https://travis-ci.org/userbin/ruby-u2f)
8
- [![Code Climate](https://codeclimate.com/github/userbin/ruby-u2f/badges/gpa.svg)](https://codeclimate.com/github/userbin/ruby-u2f)
9
- [![Coverage Status](https://img.shields.io/coveralls/userbin/ruby-u2f.svg)](https://coveralls.io/r/userbin/ruby-u2f)
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/userbin/ruby-u2f/tree/master/example) directory for a fully working Padrino server demonstrating U2F.
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/userbin/ruby-u2f/blob/master/example/app/helpers/helpers.rb) on the controller. The initializer takes an **App ID** as argument.
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, registration.counter)
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) 2014 by Johan Brissmyr and Sebastian Wallin
209
+ MIT License. Copyright (c) 2015 by Johan Brissmyr and Sebastian Wallin
data/lib/u2f.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'base64'
2
2
  require 'json'
3
3
  require 'openssl'
4
+ require 'securerandom'
4
5
 
5
6
  require 'u2f/client_data'
6
7
  require 'u2f/errors'
@@ -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 CounterToLowError < Error; end
11
+ class CounterTooLowError < Error; end
12
12
  class AuthenticationFailedError < Error; end
13
13
  class UserNotPresentError < Error;end
14
14
 
@@ -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
- # - +CounterToLowError+:: if there is a counter mismatch between the registered one and the one in the response.
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 CounterToLowError
63
+ fail CounterTooLowError
64
64
  end
65
65
  end
66
66
 
@@ -1,3 +1,3 @@
1
1
  module U2F
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -61,8 +61,8 @@ describe U2F do
61
61
 
62
62
  context 'with incorrect counter' do
63
63
  let(:counter) { 1000 }
64
- it 'raises CounterToLowError' do
65
- expect { u2f_authenticate }.to raise_error(U2F::CounterToLowError)
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.5
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: 2014-12-12 00:00:00.000000000 Z
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/userbin/ruby-u2f
125
+ homepage: https://github.com/castle/ruby-u2f
126
126
  licenses:
127
127
  - MIT
128
128
  metadata: {}