Class: HasSecurePasskey::OptionsForGet

Inherits:
Object
  • Object
show all
Defined in:
lib/has_secure_passkey/options_for_get.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(challenge: nil) ⇒ OptionsForGet

Returns a new instance of OptionsForGet.



12
13
14
# File 'lib/has_secure_passkey/options_for_get.rb', line 12

def initialize(challenge: nil)
  @challenge = challenge
end

Class Method Details

.from_message(message) ⇒ Object



7
8
9
# File 'lib/has_secure_passkey/options_for_get.rb', line 7

def from_message(message)
  new(**verifier.verify(message).symbolize_keys)
end

.verifierObject



3
4
5
# File 'lib/has_secure_passkey/options_for_get.rb', line 3

def verifier
  Rails.application.message_verifier("passkey_login")
end

Instance Method Details

#as_jsonObject



24
25
26
# File 'lib/has_secure_passkey/options_for_get.rb', line 24

def as_json
  { publicKey: credential.as_json }
end

#challengeObject



20
21
22
# File 'lib/has_secure_passkey/options_for_get.rb', line 20

def challenge
  @challenge ||= credential.challenge
end

#messageObject



16
17
18
# File 'lib/has_secure_passkey/options_for_get.rb', line 16

def message
  self.class.verifier.generate({ challenge: })
end