Class: U2F::ClientData

Inherits:
Object
  • Object
show all
Defined in:
lib/u2f/client_data.rb

Overview

Constant Summary collapse

REGISTRATION_TYP =
"navigator.id.finishEnrollment".freeze
AUTHENTICATION_TYP =
"navigator.id.getAssertion".freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#challengeObject

Returns the value of attribute challenge.



9
10
11
# File 'lib/u2f/client_data.rb', line 9

def challenge
  @challenge
end

#originObject

Returns the value of attribute origin.



9
10
11
# File 'lib/u2f/client_data.rb', line 9

def origin
  @origin
end

#typObject Also known as: type

Returns the value of attribute typ.



9
10
11
# File 'lib/u2f/client_data.rb', line 9

def typ
  @typ
end

Class Method Details

.load_from_json(json) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/u2f/client_data.rb', line 20

def self.load_from_json(json)
  client_data = ::JSON.parse(json)
  instance = new
  instance.typ = client_data['typ']
  instance.challenge = client_data['challenge']
  instance.origin = client_data['origin']
  instance
end

Instance Method Details

#authentication?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/u2f/client_data.rb', line 16

def authentication?
  typ == AUTHENTICATION_TYP
end

#registration?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/u2f/client_data.rb', line 12

def registration?
  typ == REGISTRATION_TYP
end