Module: Unmagic::Passkeys

Defined in:
lib/unmagic/passkeys.rb,
lib/unmagic/passkeys/engine.rb,
lib/unmagic/passkeys/version.rb,
lib/unmagic/passkeys/rails/routes.rb,
lib/unmagic/passkeys/test/helpers.rb,
lib/unmagic/passkeys/configuration.rb,
lib/generators/unmagic/passkeys/install_generator.rb

Overview

Passkey (WebAuthn) authentication for Rails. The module methods are thin delegators to the Unmagic::Passkeys::Credential Active Record model so host code reads as Unmagic::Passkeys.authenticate(params).

Defined Under Namespace

Modules: FormHelper, Generators, Holder, Rails, Request, Test, WebAuthn Classes: ApplicationController, ChallengesController, Configuration, ConfigurationError, Credential, CredentialsController, Engine, SessionsController

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.authenticate(passkey) ⇒ Object



54
55
56
# File 'lib/unmagic/passkeys.rb', line 54

def authenticate(passkey)
  Credential.authenticate(passkey)
end

.authentication_options(**options) ⇒ Object



50
51
52
# File 'lib/unmagic/passkeys.rb', line 50

def authentication_options(**options)
  Credential.authentication_options(**options)
end

.configurationObject

The singleton Configuration. Memoized with defaults; mutate via configure.



29
30
31
# File 'lib/unmagic/passkeys.rb', line 29

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Configure the engine in a single block:

Unmagic::Passkeys.configure do |config|
config.relying_party_name = "Shopping"
end

Yields:



38
39
40
# File 'lib/unmagic/passkeys.rb', line 38

def configure
  yield configuration
end

.register(passkey, **attributes) ⇒ Object



46
47
48
# File 'lib/unmagic/passkeys.rb', line 46

def register(passkey, **attributes)
  Credential.register(passkey, **attributes)
end

.registration_options(**options) ⇒ Object



42
43
44
# File 'lib/unmagic/passkeys.rb', line 42

def registration_options(**options)
  Credential.registration_options(**options)
end