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
#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
#authenticatable ⇒ Object (readonly)
Returns the value of attribute authenticatable.
38 39 40 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 38 def authenticatable @authenticatable end |
Class Method Details
.from_message(message) ⇒ Object
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 |
.verifier ⇒ Object
3 4 5 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 3 def verifier Rails.application.("passkey_signup") end |
Instance Method Details
#as_json ⇒ Object
30 31 32 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 30 def as_json end |
#challenge ⇒ Object
34 35 36 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 34 def challenge @challenge ||= credential.challenge end |
#message ⇒ Object
20 21 22 23 24 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 20 def self.class.verifier.generate( { challenge:, options:, authenticatable: authenticatable.as_json }.as_json ) end |
#options ⇒ Object
26 27 28 |
# File 'lib/has_secure_passkey/options_for_create.rb', line 26 def @options ||= { publicKey: credential } end |