#include "device/fido/filter.h"
#include <optional>
#include "base/feature_list.h"
#include "base/json/json_reader.h"
#include "base/metrics/field_trial_params.h"
#include "base/no_destructor.h"
#include "base/ranges/algorithm.h"
#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "components/device_event_log/device_event_log.h"
namespace device {
namespace fido_filter {
namespace {
BASE_FEATURE(…);
const base::FeatureParam<std::string> kFilterJSON{ … };
struct FilterStep { … };
bool IsString(const base::Value& v) { … }
bool IsNonEmptyString(const base::Value& v) { … }
bool IsListOf(const base::Value* v, bool (*predicate)(const base::Value&)) { … }
std::vector<std::string> GetStringOrListOfStrings(const base::Value* v) { … }
std::optional<std::vector<FilterStep>> ParseJSON(std::string_view json) { … }
const char* OperationToString(Operation op) { … }
const char* IDTypeToString(IDType id_type) { … }
size_t g_testing_depth = …;
struct CurrentFilter { … };
CurrentFilter* GetCurrentFilter() { … }
bool MaybeParseFilter(std::string_view json) { … }
}
void MaybeInitialize() { … }
Action Evaluate(
Operation op,
std::string_view rp_id,
std::optional<std::string_view> device,
std::optional<std::pair<IDType, base::span<const uint8_t>>> id) { … }
ScopedFilterForTesting::ScopedFilterForTesting(std::string_view json)
: … { … }
ScopedFilterForTesting::ScopedFilterForTesting(
std::string_view json,
ScopedFilterForTesting::PermitInvalidJSON)
: … { … }
ScopedFilterForTesting::~ScopedFilterForTesting() { … }
bool ParseForTesting(std::string_view json) { … }
}
}