Class: TwoFactorAuth::AuthenticationRequest
- Inherits:
-
Object
- Object
- TwoFactorAuth::AuthenticationRequest
- Includes:
- Adamantium
- Defined in:
- app/models/two_factor_auth/authentication_request.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#key_handle ⇒ Object
readonly
Returns the value of attribute key_handle.
Instance Method Summary collapse
- #challenge ⇒ Object
-
#initialize(app_id, key_handle, challenge = nil) ⇒ AuthenticationRequest
constructor
A new instance of AuthenticationRequest.
-
#serialized ⇒ Object
this matches te browser’s u2f api.
Constructor Details
#initialize(app_id, key_handle, challenge = nil) ⇒ AuthenticationRequest
Returns a new instance of AuthenticationRequest.
9 10 11 12 13 |
# File 'app/models/two_factor_auth/authentication_request.rb', line 9 def initialize app_id, key_handle, challenge=nil @app_id = app_id @key_handle = key_handle @challenge = challenge end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
7 8 9 |
# File 'app/models/two_factor_auth/authentication_request.rb', line 7 def app_id @app_id end |
#key_handle ⇒ Object (readonly)
Returns the value of attribute key_handle.
7 8 9 |
# File 'app/models/two_factor_auth/authentication_request.rb', line 7 def key_handle @key_handle end |
Instance Method Details
#challenge ⇒ Object
15 16 17 |
# File 'app/models/two_factor_auth/authentication_request.rb', line 15 def challenge @challenge || TwoFactorAuth::random_encoded_challenge end |
#serialized ⇒ Object
this matches te browser’s u2f api
21 22 23 24 25 26 27 28 |
# File 'app/models/two_factor_auth/authentication_request.rb', line 21 def serialized { appId: app_id, keyHandle: TwoFactorAuth.websafe_base64_encode(key_handle), challenge: challenge, version: U2F_VERSION, }.to_json end |