Class: Booth::Models::Authenticator

Inherits:
ApplicationRecord show all
Defined in:
lib/booth/models/authenticator.rb

Overview

A WebAuthn Passkey.

Instance Method Summary collapse

Instance Method Details

#confirmed?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/booth/models/authenticator.rb', line 25

def confirmed?
  confirmed_at.present?
end

#generate_webauth_idObject



21
22
23
# File 'lib/booth/models/authenticator.rb', line 21

def generate_webauth_id
  self.webauthn_id = ::WebAuthn.generate_user_id
end

#provider_attributesObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/booth/models/authenticator.rb', line 29

def provider_attributes
  unless aaguid
    return { provider_name: nil,
             provider_icon_dark: nil,
             provider_icon_light: nil }
  end

  provider = ::Booth::Core::Webauth::Provider.find(aaguid)
  unless provider
    return { provider_name: nil,
             provider_icon_dark: nil,
             provider_icon_light: nil }
  end

  { provider_name: provider.name,
    provider_icon_dark: provider.icon_dark,
    provider_icon_light: provider.icon_light }
end

#stepObject



48
49
50
# File 'lib/booth/models/authenticator.rb', line 48

def step
  ::Booth::Core::Authenticators::Step.call(self)
end