Module: HasSecurePasskey::ApplicationHelper
- Defined in:
- app/helpers/has_secure_passkey/application_helper.rb
Instance Method Summary collapse
- #button_to_passkey_login(text, path = nil, **options, &block) ⇒ Object
- #login_with_passkey(callback:, **options) ⇒ Object
- #prompt_for_new_passkey(callback:, current_authenticatable: nil, **options) ⇒ Object
Instance Method Details
#button_to_passkey_login(text, path = nil, **options, &block) ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/helpers/has_secure_passkey/application_helper.rb', line 28 def (text, path = nil, **, &block) if block_given? has_secure_passkey.challenges_path(text), **, &block else text, has_secure_passkey.challenges_path(path), ** end end |
#login_with_passkey(callback:, **options) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/helpers/has_secure_passkey/application_helper.rb', line 19 def login_with_passkey(callback:, **) = HasSecurePasskey::OptionsForGet.new tag.web_authn(nil, action: :get, callback:, options: .to_json, message: ., **) end |
#prompt_for_new_passkey(callback:, current_authenticatable: nil, **options) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/has_secure_passkey/application_helper.rb', line 3 def prompt_for_new_passkey(callback:, current_authenticatable: nil, **) = if current_authenticatable.present? HasSecurePasskey::OptionsForCreate.new(authenticatable: current_authenticatable) else HasSecurePasskey::OptionsForCreate. (params[:webauthn_message]) end tag.web_authn(nil, action: :create, callback:, options: .to_json, message: ., **) rescue ActiveSupport::MessageVerifier::InvalidSignature false end |