Class: OmniAuth::Yubikey::Verifier

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth-yubikey/verifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_id, api_key, api_url) ⇒ Verifier

Returns a new instance of Verifier.



10
11
12
# File 'lib/omniauth-yubikey/verifier.rb', line 10

def initialize(api_id, api_key, api_url)
  @api_id, @api_key, @api_url = api_id, api_key, api_url
end

Instance Attribute Details

#api_idObject (readonly)

Returns the value of attribute api_id.



8
9
10
# File 'lib/omniauth-yubikey/verifier.rb', line 8

def api_id
  @api_id
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



8
9
10
# File 'lib/omniauth-yubikey/verifier.rb', line 8

def api_key
  @api_key
end

#api_urlObject (readonly)

Returns the value of attribute api_url.



8
9
10
# File 'lib/omniauth-yubikey/verifier.rb', line 8

def api_url
  @api_url
end

Instance Method Details

#verify(otp) ⇒ Object



14
15
16
17
# File 'lib/omniauth-yubikey/verifier.rb', line 14

def verify(otp)
  response = get_response(otp)
  Result.new(otp, response)
end

#verify!(otp) ⇒ Object

Raises:



19
20
21
22
23
# File 'lib/omniauth-yubikey/verifier.rb', line 19

def verify!(otp)
  result = verify(otp)
  raise OtpError, "Received error: #{result.status}" unless result.valid?
  result
end