chromium/device/fido/device_response_converter.cc

// Copyright 2018 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/device_response_converter.h"

#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>

#include "base/containers/contains.h"
#include "base/containers/span.h"
#include "base/i18n/streaming_utf8_validator.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.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/authenticator_data.h"
#include "device/fido/authenticator_supported_options.h"
#include "device/fido/features.h"
#include "device/fido/fido_constants.h"
#include "device/fido/fido_parsing_utils.h"
#include "device/fido/fido_transport_protocol.h"
#include "device/fido/opaque_attestation_statement.h"

namespace device {

namespace {

constexpr size_t kResponseCodeLength =;

ProtocolVersion ConvertStringToProtocolVersion(std::string_view version) {}

std::optional<Ctap2Version> ConvertStringToCtap2Version(
    std::string_view version) {}

std::optional<std::vector<uint8_t>> GetPRFOutputs(
    const cbor::Value& results_value) {}

}  // namespace

CBOR;

CtapDeviceResponseCode GetResponseCode(base::span<const uint8_t> buffer) {}

// Decodes byte array response from authenticator to CBOR value object and
// checks for correct encoding format.
std::optional<AuthenticatorMakeCredentialResponse>
ReadCTAPMakeCredentialResponse(FidoTransportProtocol transport_used,
                               const std::optional<cbor::Value>& cbor) {}

std::optional<AuthenticatorGetAssertionResponse> ReadCTAPGetAssertionResponse(
    FidoTransportProtocol transport_used,
    const std::optional<cbor::Value>& cbor) {}

std::optional<AuthenticatorGetInfoResponse> ReadCTAPGetInfoResponse(
    base::span<const uint8_t> buffer) {}

static std::optional<std::string> FixInvalidUTF8String(
    base::span<const uint8_t> utf8_bytes) {}

PathPredicate;

static std::optional<cbor::Value> FixInvalidUTF8Value(
    const cbor::Value& v,
    std::vector<const cbor::Value*>* path,
    PathPredicate predicate) {}

// ContainsInvalidUTF8 returns true if any element of |v| (recursively) contains
// a string with invalid UTF-8. It bases this determination purely on the type
// of the nodes and doesn't actually check the contents of the strings
// themselves.
static bool ContainsInvalidUTF8(const cbor::Value& v) {}

std::optional<cbor::Value> FixInvalidUTF8(cbor::Value in,
                                          PathPredicate predicate) {}

std::optional<PINUVAuthProtocol> ToPINUVAuthProtocol(int64_t in) {}

}  // namespace device