Class: WebAuthn::PublicKeyCredential::CreationOptions

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

Constant Summary

Constants inherited from Options

Options::CHALLENGE_LENGTH

Instance Attribute Summary collapse

Attributes inherited from Options

#extensions, #relying_party, #timeout

Instance Method Summary collapse

Methods inherited from Options

#challenge

Methods included from JSONSerializer

#as_json

Constructor Details

#initialize(attestation: nil, authenticator_selection: nil, exclude_credentials: nil, exclude: nil, pub_key_cred_params: nil, algs: nil, rp: {}, user:, **keyword_arguments) ⇒ CreationOptions

Returns a new instance of CreationOptions.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/webauthn/public_key_credential/creation_options.rb', line 20

def initialize(
  attestation: nil,
  authenticator_selection: nil,
  exclude_credentials: nil,
  exclude: nil,
  pub_key_cred_params: nil,
  algs: nil,
  rp: {},
  user:,
  **keyword_arguments
)
  super(**keyword_arguments)

  @attestation = attestation
  @authenticator_selection = authenticator_selection
  @exclude_credentials = exclude_credentials
  @exclude = exclude
  @pub_key_cred_params = pub_key_cred_params
  @algs = algs

  @rp =
    if rp.is_a?(Hash)
      rp[:name] ||= relying_party.name
      rp[:id] ||= relying_party.id

      RPEntity.new(**rp)
    else
      rp
    end

  @user =
    if user.is_a?(Hash)
      UserEntity.new(**user)
    else
      user
    end
end

Instance Attribute Details

#algsObject

Returns the value of attribute algs.



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

def algs
  @algs
end

#attestationObject

Returns the value of attribute attestation.



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

def attestation
  @attestation
end

#authenticator_selectionObject

Returns the value of attribute authenticator_selection.



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

def authenticator_selection
  @authenticator_selection
end

#excludeObject

Returns the value of attribute exclude.



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

def exclude
  @exclude
end

#rpObject

Returns the value of attribute rp.



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

def rp
  @rp
end

#userObject

Returns the value of attribute user.



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

def user
  @user
end

Instance Method Details

#exclude_credentialsObject



58
59
60
# File 'lib/webauthn/public_key_credential/creation_options.rb', line 58

def exclude_credentials
  @exclude_credentials || exclude_credentials_from_exclude
end

#pub_key_cred_paramsObject



62
63
64
# File 'lib/webauthn/public_key_credential/creation_options.rb', line 62

def pub_key_cred_params
  @pub_key_cred_params || pub_key_cred_params_from_algs
end