class WebAuthn::PublicKeyCredential::CreationOptions
Attributes
algs[RW]
attestation[RW]
authenticator_selection[RW]
exclude[RW]
rp[RW]
user[RW]
Public Class Methods
new( attestation: nil, authenticator_selection: nil, exclude_credentials: nil, exclude: nil, pub_key_cred_params: nil, algs: nil, rp: {}, user:, **keyword_arguments )
click to toggle source
Calls superclass method
# 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] ||= configuration.rp_name rp[:id] ||= configuration.rp_id RPEntity.new(**rp) else rp end @user = if user.is_a?(Hash) UserEntity.new(**user) else user end end
Public Instance Methods
exclude_credentials()
click to toggle source
# File lib/webauthn/public_key_credential/creation_options.rb, line 58 def exclude_credentials @exclude_credentials || exclude_credentials_from_exclude end
pub_key_cred_params()
click to toggle source
# 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
Private Instance Methods
attributes()
click to toggle source
Calls superclass method
# File lib/webauthn/public_key_credential/creation_options.rb, line 68 def attributes super.concat([:rp, :user, :pub_key_cred_params, :attestation, :authenticator_selection, :exclude_credentials]) end
exclude_credentials_from_exclude()
click to toggle source
# File lib/webauthn/public_key_credential/creation_options.rb, line 72 def exclude_credentials_from_exclude if exclude as_public_key_descriptors(exclude) end end
pub_key_cred_params_from_algs()
click to toggle source
# File lib/webauthn/public_key_credential/creation_options.rb, line 78 def pub_key_cred_params_from_algs Array(algs || configuration.algorithms).map do |alg| alg_id = if alg.is_a?(String) || alg.is_a?(Symbol) COSE::Algorithm.by_name(alg.to_s).id else alg end { type: TYPE_PUBLIC_KEY, alg: alg_id } end end