#include "device/fido/authenticator_data.h"
#include <utility>
#include "base/strings/string_number_conversions.h"
#include "components/cbor/diagnostic_writer.h"
#include "components/cbor/reader.h"
#include "components/cbor/writer.h"
#include "components/device_event_log/device_event_log.h"
#include "device/fido/attested_credential_data.h"
#include "device/fido/fido_parsing_utils.h"
namespace device {
namespace {
constexpr size_t kAttestedCredentialDataOffset = …;
uint8_t AuthenticatorDataFlags(bool user_present,
bool user_verified,
bool backup_eligible,
bool backup_state,
bool has_attested_credential_data,
bool has_extension_data) { … }
uint8_t CombineAuthenticatorDataFlags(
base::span<const AuthenticatorData::Flag> flags) { … }
inline std::array<uint8_t, kSignCounterLength> MarshalSignCounter(
uint32_t sign_counter) { … }
}
std::optional<AuthenticatorData> AuthenticatorData::DecodeAuthenticatorData(
base::span<const uint8_t> auth_data) { … }
AuthenticatorData::AuthenticatorData(
base::span<const uint8_t, kRpIdHashLength> rp_id_hash,
uint8_t flags,
base::span<const uint8_t, kSignCounterLength> counter,
std::optional<AttestedCredentialData> data,
std::optional<cbor::Value> extensions)
: … { … }
AuthenticatorData::AuthenticatorData(
base::span<const uint8_t, kRpIdHashLength> rp_id_hash,
std::initializer_list<Flag> flags,
uint32_t sign_counter,
std::optional<AttestedCredentialData> data,
std::optional<cbor::Value> extensions)
: … { … }
AuthenticatorData::AuthenticatorData(
base::span<const uint8_t, kRpIdHashLength> rp_id_hash,
bool user_present,
bool user_verified,
bool backup_eligible,
bool backup_state,
uint32_t sign_counter,
std::optional<AttestedCredentialData> attested_credential_data,
std::optional<cbor::Value> extensions)
: … { … }
AuthenticatorData::AuthenticatorData(AuthenticatorData&& other) = default;
AuthenticatorData& AuthenticatorData::operator=(AuthenticatorData&& other) =
default;
AuthenticatorData::~AuthenticatorData() = default;
bool AuthenticatorData::DeleteDeviceAaguid() { … }
bool AuthenticatorData::EraseExtension(std::string_view name) { … }
std::vector<uint8_t> AuthenticatorData::SerializeToByteArray() const { … }
std::vector<uint8_t> AuthenticatorData::GetCredentialId() const { … }
void AuthenticatorData::ValidateAuthenticatorDataStateOrCrash() { … }
}