#include "services/network/trust_tokens/trust_token_key_commitment_parser.h"
#include "base/base64.h"
#include "base/json/json_reader.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "services/network/public/mojom/trust_tokens.mojom.h"
#include "services/network/trust_tokens/suitable_trust_token_origin.h"
#include "services/network/trust_tokens/types.h"
namespace network {
const char kTrustTokenKeyCommitmentProtocolVersionField[] = …;
const char kTrustTokenKeyCommitmentIDField[] = …;
const char kTrustTokenKeyCommitmentBatchsizeField[] = …;
const char kTrustTokenKeyCommitmentKeysField[] = …;
const char kTrustTokenKeyCommitmentExpiryField[] = …;
const char kTrustTokenKeyCommitmentKeyField[] = …;
namespace {
bool ParseSingleKeyLabel(std::string_view in) { … }
enum class ParseKeyResult { … };
ParseKeyResult ParseSingleKeyExceptLabel(
const base::Value::Dict& in,
mojom::TrustTokenVerificationKey* out) { … }
mojom::TrustTokenKeyCommitmentResultPtr ParseSingleIssuer(
const base::Value& commitments_by_version) { … }
Entry;
SuitableTrustTokenOrigin& canonicalized_issuer(Entry& e) { … }
mojom::TrustTokenKeyCommitmentResultPtr& commitment(Entry& e) { … }
}
mojom::TrustTokenKeyCommitmentResultPtr TrustTokenKeyCommitmentParser::Parse(
std::string_view response_body) { … }
std::unique_ptr<base::flat_map<SuitableTrustTokenOrigin,
mojom::TrustTokenKeyCommitmentResultPtr>>
TrustTokenKeyCommitmentParser::ParseMultipleIssuers(
std::string_view response_body) { … }
}