#include "components/trusted_vault/download_keys_response_handler.h"
#include <map>
#include <optional>
#include <utility>
#include "base/ranges/algorithm.h"
#include "components/trusted_vault/proto/vault.pb.h"
#include "components/trusted_vault/proto_string_bytes_conversion.h"
#include "components/trusted_vault/securebox.h"
#include "components/trusted_vault/trusted_vault_connection.h"
#include "components/trusted_vault/trusted_vault_crypto.h"
#include "components/trusted_vault/trusted_vault_server_constants.h"
namespace trusted_vault {
namespace {
struct ExtractedSharedKey { … };
const trusted_vault_pb::SecurityDomainMember::SecurityDomainMembership*
FindMembershipForSecurityDomain(
const trusted_vault_pb::SecurityDomainMember& member,
SecurityDomainId security_domain) { … }
std::optional<std::vector<ExtractedSharedKey>> ExtractAndSortSharedKeys(
const trusted_vault_pb::SecurityDomainMember::SecurityDomainMembership&
membership,
const SecureBoxPrivateKey& member_private_key) { … }
bool IsValidKeyChain(
const std::vector<ExtractedSharedKey>& key_chain,
const TrustedVaultKeyAndVersion& last_known_trusted_vault_key_and_version) { … }
}
DownloadKeysResponseHandler::ProcessedResponse::ProcessedResponse(
TrustedVaultDownloadKeysStatus status)
: … { … }
DownloadKeysResponseHandler::ProcessedResponse::ProcessedResponse(
TrustedVaultDownloadKeysStatus status,
std::vector<std::vector<uint8_t>> downloaded_keys,
int last_key_version)
: … { … }
DownloadKeysResponseHandler::ProcessedResponse::ProcessedResponse(
const ProcessedResponse& other) = default;
DownloadKeysResponseHandler::ProcessedResponse&
DownloadKeysResponseHandler::ProcessedResponse::operator=(
const ProcessedResponse& other) = default;
DownloadKeysResponseHandler::ProcessedResponse::~ProcessedResponse() = default;
std::optional<TrustedVaultDownloadKeysStatus>
DownloadKeysResponseHandler::GetErrorFromHttpStatus(
TrustedVaultRequest::HttpStatus http_status) { … }
DownloadKeysResponseHandler::DownloadKeysResponseHandler(
SecurityDomainId security_domain,
const TrustedVaultKeyAndVersion& last_trusted_vault_key_and_version,
std::unique_ptr<SecureBoxKeyPair> device_key_pair)
: … { … }
DownloadKeysResponseHandler::~DownloadKeysResponseHandler() = default;
DownloadKeysResponseHandler::ProcessedResponse
DownloadKeysResponseHandler::ProcessResponse(
TrustedVaultRequest::HttpStatus http_status,
const std::string& response_body) const { … }
}