Module: Warden::WebAuthn::AuthenticationInitiationHelpers

Defined in:
lib/warden/webauthn/authentication_initiation_helpers.rb

Overview

Helper methods for generating & storing authentication challenges

Instance Method Summary collapse

Instance Method Details

#authentication_challenge_keyObject



17
18
19
# File 'lib/warden/webauthn/authentication_initiation_helpers.rb', line 17

def authentication_challenge_key
  "current_webauthn_authentication_challenge"
end

#generate_authentication_options(relying_party:, options: {}) ⇒ Object



7
8
9
10
11
# File 'lib/warden/webauthn/authentication_initiation_helpers.rb', line 7

def generate_authentication_options(relying_party:, options: {})
  relying_party.options_for_authentication(**{
    user_verification: "required"
  }.merge(options))
end

#store_challenge_in_session(options_for_authentication:) ⇒ Object



13
14
15
# File 'lib/warden/webauthn/authentication_initiation_helpers.rb', line 13

def store_challenge_in_session(options_for_authentication:)
  session[authentication_challenge_key] = options_for_authentication.challenge
end