Module: Passkeyed
- Defined in:
- lib/passkeyed.rb,
lib/passkeyed/model.rb,
lib/passkeyed/errors.rb,
lib/passkeyed/version.rb,
lib/passkeyed/ceremonies.rb,
lib/passkeyed/credential.rb,
lib/passkeyed/configuration.rb,
lib/generators/passkeyed/install/install_generator.rb,
sig/passkeyed/model.rbs,
sig/passkeyed/errors.rbs,
sig/passkeyed/version.rbs,
sig/passkeyed/ceremonies.rbs,
sig/passkeyed/credential.rbs,
sig/passkeyed/configuration.rbs
Overview
passkeyed adds passwordless, usernameless passkey (WebAuthn) authentication to Rails apps as a small, transparent runtime plus an install generator.
The heavier pieces (the ActiveRecord credential model and the two concerns) are autoloaded so the gem can be required before ActiveRecord is ready.
Defined Under Namespace
Modules: Ceremonies, Generators, Model Classes: AuthenticationError, ChallengeExpired, ChallengeMissing, Configuration, ConfigurationError, Credential, CredentialNotFound, Error, RegistrationError
Constant Summary collapse
- VERSION =
"0.1.0"
Class Attribute Summary collapse
-
.base_record_class ⇒ Object
The ActiveRecord base class Passkeyed::Credential inherits from.
Class Method Summary collapse
- .configuration ⇒ Configuration
-
.configure {|configuration| ... } ⇒ void
Yields the configuration for editing, then validates it.
-
.reset_configuration! ⇒ Configuration
Mainly for tests: forget all configuration.
Class Attribute Details
.base_record_class ⇒ Object
The ActiveRecord base class Passkeyed::Credential inherits from. Defaults to the host app's ApplicationRecord when defined (so multi-database connects_to/role config is inherited), falling back to ActiveRecord::Base. Set in an initializer to override. Accepts a class or a class name string.
Ordering matters: the parent class is resolved once, when Credential is first autoloaded, so assign this before anything references Passkeyed::Credential (an initializer is early enough; a later assignment is silently ignored).
164 165 166 167 |
# File 'lib/passkeyed/configuration.rb', line 164 def base_record_class klass = @base_record_class || (defined?(ApplicationRecord) ? ApplicationRecord : ActiveRecord::Base) klass.is_a?(String) ? klass.constantize : klass end |
Class Method Details
.configuration ⇒ Configuration
171 172 173 |
# File 'lib/passkeyed/configuration.rb', line 171 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ void
This method returns an undefined value.
Yields the configuration for editing, then validates it. Call once during boot (an initializer).
177 178 179 180 181 |
# File 'lib/passkeyed/configuration.rb', line 177 def configure yield(configuration) if block_given? configuration.validate! configuration end |
.reset_configuration! ⇒ Configuration
Mainly for tests: forget all configuration.
184 185 186 |
# File 'lib/passkeyed/configuration.rb', line 184 def reset_configuration! @configuration = Configuration.new end |