#include "components/reporting/encryption/encryption.h"
#include <memory>
#include <string>
#include <utility>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/hash/hash.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/task_runner.h"
#include "base/task/thread_pool.h"
#include "base/types/expected.h"
#include "components/reporting/encryption/primitives.h"
#include "components/reporting/util/reporting_errors.h"
#include "components/reporting/util/status.h"
#include "components/reporting/util/statusor.h"
namespace reporting {
Encryptor::Handle::Handle(scoped_refptr<Encryptor> encryptor)
: … { … }
Encryptor::Handle::~Handle() = default;
void Encryptor::Handle::AddToRecord(std::string_view data,
base::OnceCallback<void(Status)> cb) { … }
void Encryptor::Handle::CloseRecord(
base::OnceCallback<void(StatusOr<EncryptedRecord>)> cb) { … }
void Encryptor::Handle::ProduceEncryptedRecord(
base::OnceCallback<void(StatusOr<EncryptedRecord>)> cb,
StatusOr<std::pair<std::string, PublicKeyId>> asymmetric_key_result) { … }
Encryptor::Encryptor()
: … { … }
Encryptor::~Encryptor() = default;
void Encryptor::UpdateAsymmetricKey(
std::string_view new_public_key,
PublicKeyId new_public_key_id,
base::OnceCallback<void(Status)> response_cb) { … }
void Encryptor::OpenRecord(base::OnceCallback<void(StatusOr<Handle*>)> cb) { … }
void Encryptor::RetrieveAsymmetricKey(
base::OnceCallback<void(StatusOr<std::pair<std::string, PublicKeyId>>)>
cb) { … }
StatusOr<scoped_refptr<Encryptor>> Encryptor::Create() { … }
}