class WebAuthn::AttestationObject

def self.deserialize(attestation_object, relying_party)

def self.deserialize(attestation_object, relying_party)
  from_map(CBOR.decode(attestation_object), relying_party)
end

def self.from_map(map, relying_party)

def self.from_map(map, relying_party)
  new(
    authenticator_data: WebAuthn::AuthenticatorData.deserialize(map["authData"]),
    attestation_statement: WebAuthn::AttestationStatement.from(
      map["fmt"],
      map["attStmt"],
      relying_party: relying_party
    )
  )
end

def initialize(authenticator_data:, attestation_statement:)

def initialize(authenticator_data:, attestation_statement:)
  @authenticator_data = authenticator_data
  @attestation_statement = attestation_statement
end

def valid_attestation_statement?(client_data_hash)

def valid_attestation_statement?(client_data_hash)
  attestation_statement.valid?(authenticator_data, client_data_hash)
end

def valid_attested_credential?

def valid_attested_credential?
  authenticator_data.attested_credential_data_included? &&
    authenticator_data.attested_credential_data.valid?
end