// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_K_ANONYMITY_SERVICE_K_ANONYMITY_TRUST_TOKEN_GETTER_H_ #define CHROME_BROWSER_K_ANONYMITY_SERVICE_K_ANONYMITY_TRUST_TOKEN_GETTER_H_ #include <memory> #include <string> #include "base/containers/circular_deque.h" #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "chrome/browser/k_anonymity_service/k_anonymity_service_storage.h" #include "components/signin/public/identity_manager/access_token_info.h" #include "components/signin/public/identity_manager/primary_account_access_token_fetcher.h" #include "google_apis/gaia/google_service_auth_error.h" #include "net/base/isolation_info.h" #include "net/http/http_response_headers.h" #include "services/data_decoder/public/cpp/data_decoder.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/mojom/trust_tokens.mojom.h" namespace network { class SimpleURLLoader; } // namespace network // This class performs the series of requests necessary to get a trust token // from the Google K-anonymity server using hard-coded URLs. The trust token is // stored by the network service, while the non-unique user ID and trust token // key commitment are provided to the class's caller. The steps of this are: // 1. Get an OAuth token with the K-anonymity service scope. // 2. Request a non-unique user ID (short ID) from the k-anonymity auth server. // This requires the OAuth token for authentication. // 3. Request the trust token key commitment corresponding to the short bucket // ID. Note that the receiver responds in a non-standard format that the // browser converts internally. // 4. Request the trust token. This requires the OAuth token for authentication. // // The short ID and the trust token key commitment expire once every 24 hours. // The trust token will be good until it is used or the key that created // expires. class KAnonymityTrustTokenGetter { … }; #endif // CHROME_BROWSER_K_ANONYMITY_SERVICE_K_ANONYMITY_TRUST_TOKEN_GETTER_H_