Class: WebAuthn::PublicKeyCredential::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/webauthn/public_key_credential/options.rb

Direct Known Subclasses

CreationOptions, RequestOptions

Constant Summary collapse

CHALLENGE_LENGTH =
32

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timeout: nil, extensions: nil, relying_party: WebAuthn.configuration.relying_party) ⇒ Options

Returns a new instance of Options.



13
14
15
16
17
# File 'lib/webauthn/public_key_credential/options.rb', line 13

def initialize(timeout: nil, extensions: nil, relying_party: WebAuthn.configuration.relying_party)
  @relying_party = relying_party
  @timeout = timeout || default_timeout
  @extensions = default_extensions.merge(extensions || {})
end

Instance Attribute Details

#extensionsObject (readonly)

Returns the value of attribute extensions.



11
12
13
# File 'lib/webauthn/public_key_credential/options.rb', line 11

def extensions
  @extensions
end

#relying_partyObject (readonly)

Returns the value of attribute relying_party.



11
12
13
# File 'lib/webauthn/public_key_credential/options.rb', line 11

def relying_party
  @relying_party
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



11
12
13
# File 'lib/webauthn/public_key_credential/options.rb', line 11

def timeout
  @timeout
end

Instance Method Details

#as_jsonObject

Argument wildcard for Ruby on Rails controller automatic object JSON serialization



24
25
26
# File 'lib/webauthn/public_key_credential/options.rb', line 24

def as_json(*)
  to_hash.to_camelback_keys
end

#challengeObject



19
20
21
# File 'lib/webauthn/public_key_credential/options.rb', line 19

def challenge
  encoder.encode(raw_challenge)
end