#include "device/fido/cable/v2_discovery.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_number_conversions.h"
#include "components/device_event_log/device_event_log.h"
#include "device/fido/cable/cable_discovery_data.h"
#include "device/fido/cable/fido_tunnel_device.h"
#include "device/fido/cable/v2_handshake.h"
#include "device/fido/features.h"
#include "device/fido/fido_parsing_utils.h"
#include "third_party/boringssl/src/include/openssl/aes.h"
namespace device::cablev2 {
namespace {
enum class CableV2DiscoveryEvent { … };
void RecordEvent(CableV2DiscoveryEvent event) { … }
}
Discovery::Discovery(
FidoRequestType request_type,
NetworkContextFactory network_context_factory,
std::optional<base::span<const uint8_t, kQRKeySize>> qr_generator_key,
std::unique_ptr<AdvertEventStream> advert_stream,
std::unique_ptr<EventStream<std::unique_ptr<Pairing>>>
contact_device_stream,
const std::vector<CableDiscoveryData>& extension_contents,
std::optional<base::RepeatingCallback<void(std::unique_ptr<Pairing>)>>
pairing_callback,
std::optional<base::RepeatingCallback<void(std::unique_ptr<Pairing>)>>
invalidated_pairing_callback,
std::optional<base::RepeatingCallback<void(Event)>> event_callback,
bool must_support_ctap)
: … { … }
Discovery::~Discovery() = default;
void Discovery::StartInternal() { … }
void Discovery::OnBLEAdvertSeen(base::span<const uint8_t, kAdvertSize> advert) { … }
void Discovery::OnContactDevice(std::unique_ptr<Pairing> pairing) { … }
void Discovery::PairingIsInvalid(std::unique_ptr<Pairing> pairing) { … }
std::optional<Discovery::UnpairedKeys> Discovery::KeysFromQRGeneratorKey(
const std::optional<base::span<const uint8_t, kQRKeySize>>
qr_generator_key) { … }
std::vector<Discovery::UnpairedKeys> Discovery::KeysFromExtension(
const std::vector<CableDiscoveryData>& extension_contents) { … }
}