Class: HasSecurePasskey::OptionsForCreate
- Inherits:
-
Object
- Object
- HasSecurePasskey::OptionsForCreate
- Defined in:
- lib/has_secure_passkey/options_for_create.rb
Instance Attribute Summary collapse
-
#authenticatable ⇒ Object
readonly
Returns the value of attribute authenticatable.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
- #challenge ⇒ Object
-
#initialize(authenticatable:, options: nil, challenge: nil) ⇒ OptionsForCreate
constructor
A new instance of OptionsForCreate.
- #message ⇒ Object
- #options ⇒ Object
Constructor Details
permalink #initialize(authenticatable:, options: nil, challenge: nil) ⇒ OptionsForCreate
Returns a new instance of OptionsForCreate.
14 15 16 17 18 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 14 def initialize(authenticatable:, options: nil, challenge: nil) @authenticatable = authenticatable @options = @challenge = challenge end |
Instance Attribute Details
permalink #authenticatable ⇒ Object (readonly)
Returns the value of attribute authenticatable.
39 40 41 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 39 def authenticatable @authenticatable end |
Class Method Details
permalink .from_message(message) ⇒ Object
[View source]
7 8 9 10 11 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 7 def () new(**verifier.verify().symbolize_keys).tap do _1.authenticatable.symbolize_keys! if _1.authenticatable.is_a?(Hash) end end |
permalink .verifier ⇒ Object
[View source]
3 4 5 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 3 def verifier Rails.application.("passkey_signup") end |
Instance Method Details
permalink #as_json ⇒ Object
[View source]
31 32 33 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 31 def as_json end |
permalink #challenge ⇒ Object
[View source]
35 36 37 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 35 def challenge @challenge ||= credential.challenge end |
permalink #message ⇒ Object
[View source]
20 21 22 23 24 25 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 20 def self.class.verifier.generate( { challenge:, options:, authenticatable: authenticatable.as_json(only: %i(email_address webauthn_id)) }.as_json ) end |
permalink #options ⇒ Object
[View source]
27 28 29 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 27 def @options ||= { publicKey: credential } end |