chromium/third_party/blink/public/common/privacy_budget/identifiable_token_builder.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_BUILDER_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_BUILDER_H_

#include <array>
#include <string_view>

#include "base/containers/span.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_internal_templates.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_token.h"

namespace blink {

// Builds an IdentifiableToken incrementally.
//
// Use this when the input to a sample is a bunch of disjoint objects, or the
// sample needs to include objects that are incrementally encountered.
//
// Notes:
//   * The digest returned by this class is *NOT* the same as the one
//     IdentifiabilityDigestOfBytes for the same set of bytes. This is due to
//     block based chaining of digests used by this class.
//     IdentifiabilityDigestOfBytes and this class are *NOT* interchangeable.
//
//     TODO(asanka): IdentifiabilityDigestOfBytes() and this class should
//     interop better. Perhaps by making the latter use the former.
//
//   * The digest returned by this class is *NOT* the same as what you would
//     acquire by invoking IdentifiableToken() over the same object.
//     IdentifiableToken() and this class are *NOT* interchangeable.
//
//   * The digest returned by this class only depends on the cumulative sequence
//     of bytes that are fed to it. The partitioning thereof is irrelevant.
//
//   * This object never finalizes. Partial digests can be extracted at any
//     point.
class BLINK_COMMON_EXPORT IdentifiableTokenBuilder {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_BUILDER_H_