class Comet::WebAuthnPublicKeyCredentialCreationOptions
WebAuthnPublicKeyCredentialCreationOptions is a typed class wrapper around the underlying Comet Server API data structure.
def clear
def clear @challenge = [] @relying_party = Comet::WebAuthnRelyingPartyEntity.new @user = Comet::WebAuthnUserEntity.new @parameters = [] @authenticator_selection = Comet::WebAuthnAuthenticatorSelection.new @timeout = 0 @credential_exclude_list = [] @extensions = {} @attestation = '' @unknown_json_fields = {} end
def from_hash(obj)
-
obj
(Hash
) -- The complete object as a Ruby hash
def from_hash(obj) raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash obj.each do |k, v| case k when 'challenge' @challenge = Base64.decode64(v) when 'rp' @relying_party = Comet::WebAuthnRelyingPartyEntity.new @relying_party.from_hash(v) when 'user' @user = Comet::WebAuthnUserEntity.new @user.from_hash(v) when 'pubKeyCredParams' if v.nil? @parameters = [] else @parameters = Array.new(v.length) v.each_with_index do |v1, i1| @parameters[i1] = Comet::WebAuthnCredentialParameter.new @parameters[i1].from_hash(v1) end end when 'authenticatorSelection' @authenticator_selection = Comet::WebAuthnAuthenticatorSelection.new @authenticator_selection.from_hash(v) when 'timeout' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @timeout = v when 'excludeCredentials' if v.nil? @credential_exclude_list = [] else @credential_exclude_list = Array.new(v.length) v.each_with_index do |v1, i1| @credential_exclude_list[i1] = Comet::WebAuthnCredentialDescriptor.new @credential_exclude_list[i1].from_hash(v1) end end when 'extensions' @extensions = {} if v.nil? @extensions = {} else v.each do |k1, v1| @extensions[k1] = v1 end end when 'attestation' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @attestation = v else @unknown_json_fields[k] = v end end end
def from_json(json_string)
-
json_string
(String
) -- The complete object in JSON format
def from_json(json_string) raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String from_hash(JSON.parse(json_string)) end
def initialize
def initialize clear end
def to_h
-
(Hash)
- The complete object as a Ruby hash
def to_h to_hash end
def to_hash
-
(Hash)
- The complete object as a Ruby hash
def to_hash ret = {} ret['challenge'] = Base64.strict_encode64(@challenge) ret['rp'] = @relying_party ret['user'] = @user unless @parameters.nil? ret['pubKeyCredParams'] = @parameters end unless @authenticator_selection.nil? ret['authenticatorSelection'] = @authenticator_selection end unless @timeout.nil? ret['timeout'] = @timeout end unless @credential_exclude_list.nil? ret['excludeCredentials'] = @credential_exclude_list end unless @extensions.nil? ret['extensions'] = @extensions end unless @attestation.nil? ret['attestation'] = @attestation end @unknown_json_fields.each do |k, v| ret[k] = v end ret end
def to_json(options = {})
-
(String)
- The complete object as a JSON string
def to_json(options = {}) to_hash.to_json(options) end