#include "services/network/test/trust_token_request_handler.h"
#include "base/base64.h"
#include "base/check.h"
#include "base/containers/span.h"
#include "base/functional/callback.h"
#include "base/json/json_string_value_serializer.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "components/cbor/reader.h"
#include "components/cbor/values.h"
#include "crypto/sha2.h"
#include "net/http/http_request_headers.h"
#include "net/http/structured_headers.h"
#include "services/network/public/cpp/trust_token_http_headers.h"
#include "services/network/trust_tokens/scoped_boringssl_bytes.h"
#include "services/network/trust_tokens/types.h"
#include "third_party/boringssl/src/include/openssl/curve25519.h"
#include "third_party/boringssl/src/include/openssl/evp.h"
#include "third_party/boringssl/src/include/openssl/trust_token.h"
namespace network::test {
namespace {
struct IssuanceKeyPair { … };
IssuanceKeyPair GenerateIssuanceKeyPair(int id) { … }
bool HasKeyPairExpired(const IssuanceKeyPair& p) { … }
}
TrustTokenRequestHandler::Options::Options() = default;
TrustTokenRequestHandler::Options::~Options() = default;
TrustTokenRequestHandler::Options::Options(const Options&) = default;
TrustTokenRequestHandler::Options& TrustTokenRequestHandler::Options::operator=(
const Options&) = default;
struct TrustTokenRequestHandler::Rep { … };
bssl::UniquePtr<TRUST_TOKEN_ISSUER>
TrustTokenRequestHandler::Rep::CreateIssuerContextFromUnexpiredKeys() const { … }
TrustTokenRequestHandler::TrustTokenRequestHandler(Options options) { … }
TrustTokenRequestHandler::TrustTokenRequestHandler()
: … { … }
TrustTokenRequestHandler::~TrustTokenRequestHandler() = default;
std::string TrustTokenRequestHandler::GetKeyCommitmentRecord() const { … }
std::optional<std::string> TrustTokenRequestHandler::Issue(
std::string_view issuance_request) { … }
std::optional<std::string> TrustTokenRequestHandler::Redeem(
std::string_view redemption_request) { … }
void TrustTokenRequestHandler::RecordSignedRequest(
const GURL& destination,
const net::HttpRequestHeaders& headers) { … }
std::optional<TrustTokenSignedRequest>
TrustTokenRequestHandler::last_incoming_signed_request() const { … }
void TrustTokenRequestHandler::UpdateOptions(Options options) { … }
}