Class: TwoFactorAuth::RegistrationRequest

Inherits:
Object
  • Object
show all
Includes:
Adamantium
Defined in:
app/models/two_factor_auth/registration_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_id = TwoFactorAuth.trusted_facet_list_url, key_handles = [], challenge = nil) ⇒ RegistrationRequest

Returns a new instance of RegistrationRequest.



9
10
11
12
13
# File 'app/models/two_factor_auth/registration_request.rb', line 9

def initialize app_id=TwoFactorAuth.trusted_facet_list_url, key_handles=[], challenge=nil
  @app_id = app_id
  @key_handles = key_handles
  @challenge = challenge
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



7
8
9
# File 'app/models/two_factor_auth/registration_request.rb', line 7

def app_id
  @app_id
end

#key_handlesObject (readonly)

Returns the value of attribute key_handles.



7
8
9
# File 'app/models/two_factor_auth/registration_request.rb', line 7

def key_handles
  @key_handles
end

Instance Method Details

#challengeObject



15
16
17
# File 'app/models/two_factor_auth/registration_request.rb', line 15

def challenge
  @challenge || TwoFactorAuth::random_encoded_challenge
end

#serializedObject

this matches te browser’s u2f api



25
26
27
28
29
30
31
# File 'app/models/two_factor_auth/registration_request.rb', line 25

def serialized
  {
    appId: app_id,
    challenge: challenge,
    version: TwoFactorAuth::U2F_VERSION,
  }.to_json
end

#signsObject



20
21
22
# File 'app/models/two_factor_auth/registration_request.rb', line 20

def signs
  []
end