chromium/device/fido/hid/fido_hid_device.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "device/fido/hid/fido_hid_device.h"

#include <limits>
#include <string_view>
#include <vector>

#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/containers/fixed_flat_set.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "components/device_event_log/device_event_log.h"
#include "crypto/random.h"
#include "device/fido/hid/fido_hid_message.h"

namespace device {

// U2F devices only provide a single report so specify a report ID of 0 here.
static constexpr uint8_t kReportId =;
static constexpr uint8_t kWinkCapability =;

FidoHidDevice::FidoHidDevice(device::mojom::HidDeviceInfoPtr device_info,
                             device::mojom::HidManager* hid_manager)
    :{}

FidoHidDevice::~FidoHidDevice() = default;

FidoDevice::CancelToken FidoHidDevice::DeviceTransact(
    std::vector<uint8_t> command,
    DeviceCallback callback) {}

void FidoHidDevice::Cancel(CancelToken token) {}

void FidoHidDevice::Transition(std::optional<State> next_state) {}

FidoHidDevice::PendingTransaction::PendingTransaction(
    FidoHidDeviceCommand command_type,
    std::vector<uint8_t> in_command,
    DeviceCallback in_callback,
    CancelToken in_token)
    :{}

FidoHidDevice::PendingTransaction::~PendingTransaction() = default;

void FidoHidDevice::Connect(
    device::mojom::HidManager::ConnectCallback callback) {}

void FidoHidDevice::OnConnect(
    mojo::PendingRemote<device::mojom::HidConnection> connection) {}

void FidoHidDevice::OnInitWriteComplete(std::vector<uint8_t> nonce,
                                        bool success) {}

// ParseInitReply parses a potential reply to a U2FHID_INIT message. If the
// reply matches the given nonce then the assigned channel ID is returned.
std::optional<uint32_t> FidoHidDevice::ParseInitReply(
    const std::vector<uint8_t>& nonce,
    const std::vector<uint8_t>& buf) {}

void FidoHidDevice::OnPotentialInitReply(
    std::vector<uint8_t> nonce,
    bool success,
    uint8_t report_id,
    const std::optional<std::vector<uint8_t>>& buf) {}

void FidoHidDevice::WriteMessage(FidoHidMessage message) {}

void FidoHidDevice::PacketWritten(FidoHidMessage message, bool success) {}

void FidoHidDevice::ReadMessage() {}

void FidoHidDevice::OnRead(bool success,
                           uint8_t report_id,
                           const std::optional<std::vector<uint8_t>>& buf) {}

void FidoHidDevice::OnReadContinuation(
    FidoHidMessage message,
    bool success,
    uint8_t report_id,
    const std::optional<std::vector<uint8_t>>& buf) {}

void FidoHidDevice::MessageReceived(FidoHidMessage message) {}

void FidoHidDevice::RetryAfterChannelBusy() {}

void FidoHidDevice::TryWink(base::OnceClosure callback) {}

void FidoHidDevice::ArmTimeout() {}

void FidoHidDevice::OnTimeout() {}

// WriteCancelComplete is the callback from writing a cancellation message. Its
// primary purpose is to hold a reference to the HidConnection so that the write
// doesn't get discarded. It's a static function because it may be called after
// the destruction of the |FidoHidDevice| that created it.
// static
void FidoHidDevice::WriteCancelComplete(
    scoped_refptr<FidoHidDevice::RefCountedHidConnection> connection,
    bool success) {}

void FidoHidDevice::WriteCancel() {}

// VidPidToString returns the device's vendor and product IDs as formatted by
// the lsusb utility.
static std::string VidPidToString(const mojom::HidDeviceInfoPtr& device_info) {}

std::string FidoHidDevice::GetDisplayName() const {}

std::string FidoHidDevice::GetId() const {}

FidoTransportProtocol FidoHidDevice::DeviceTransport() const {}

void FidoHidDevice::DiscoverSupportedProtocolAndDeviceInfo(
    base::OnceClosure done) {}

// static
std::string FidoHidDevice::GetIdForDevice(
    const device::mojom::HidDeviceInfo& device_info) {}

base::WeakPtr<FidoDevice> FidoHidDevice::GetWeakPtr() {}

}  // namespace device