class WebAuthn::AuthenticatorAttestationResponse

Attributes

attestation_object_bytes[R]
attestation_trust_path[R]
attestation_type[R]

Public Class Methods

from_client(response) click to toggle source
# File lib/webauthn/authenticator_attestation_response.rb, line 21
def self.from_client(response)
  encoder = WebAuthn.configuration.encoder

  new(
    attestation_object: encoder.decode(response["attestationObject"]),
    client_data_json: encoder.decode(response["clientDataJSON"])
  )
end
new(attestation_object:, **options) click to toggle source
Calls superclass method
# File lib/webauthn/authenticator_attestation_response.rb, line 32
def initialize(attestation_object:, **options)
  super(**options)

  @attestation_object_bytes = attestation_object
end

Public Instance Methods

attestation_object() click to toggle source
# File lib/webauthn/authenticator_attestation_response.rb, line 49
def attestation_object
  @attestation_object ||= WebAuthn::AttestationObject.deserialize(attestation_object_bytes)
end
verify(expected_challenge, expected_origin = nil, user_verification: nil, rp_id: nil) click to toggle source
Calls superclass method
# File lib/webauthn/authenticator_attestation_response.rb, line 38
def verify(expected_challenge, expected_origin = nil, user_verification: nil, rp_id: nil)
  super

  verify_item(:attested_credential)
  if WebAuthn.configuration.verify_attestation_statement
    verify_item(:attestation_statement)
  end

  true
end

Private Instance Methods

type() click to toggle source
# File lib/webauthn/authenticator_attestation_response.rb, line 68
def type
  WebAuthn::TYPES[:create]
end
valid_attestation_statement?() click to toggle source
# File lib/webauthn/authenticator_attestation_response.rb, line 76
def valid_attestation_statement?
  @attestation_type, @attestation_trust_path = attestation_object.valid_attestation_statement?(client_data.hash)
end
valid_attested_credential?() click to toggle source
# File lib/webauthn/authenticator_attestation_response.rb, line 72
def valid_attested_credential?
  attestation_object.valid_attested_credential?
end