Class: Clarion::Registrator
- Inherits:
-
Object
- Object
- Clarion::Registrator
- Defined in:
- lib/clarion/registrator.rb
Instance Attribute Summary collapse
-
#counter ⇒ Object
readonly
Returns the value of attribute counter.
-
#u2f ⇒ Object
readonly
Returns the value of attribute u2f.
Instance Method Summary collapse
-
#initialize(u2f, counter) ⇒ Registrator
constructor
A new instance of Registrator.
- #register!(challenges, response_json) ⇒ Object
- #request ⇒ Object
Constructor Details
#initialize(u2f, counter) ⇒ Registrator
Returns a new instance of Registrator.
5 6 7 8 |
# File 'lib/clarion/registrator.rb', line 5 def initialize(u2f, counter) @u2f = u2f @counter = counter end |
Instance Attribute Details
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
10 11 12 |
# File 'lib/clarion/registrator.rb', line 10 def counter @counter end |
#u2f ⇒ Object (readonly)
Returns the value of attribute u2f.
10 11 12 |
# File 'lib/clarion/registrator.rb', line 10 def u2f @u2f end |
Instance Method Details
#register!(challenges, response_json) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/clarion/registrator.rb', line 16 def register!(challenges, response_json) response = U2F::RegisterResponse.load_from_json(response_json) reg = u2f.register!(challenges, response) key = Key.new(handle: reg.key_handle, public_key: reg.public_key, counter: reg.counter) if counter counter.store(key) end key end |
#request ⇒ Object
12 13 14 |
# File 'lib/clarion/registrator.rb', line 12 def request [u2f.app_id, u2f.registration_requests] end |