blob: 671daeccab596666df5d5f13821ebd4596f00682 [file]
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef THIRD_PARTY_CREDENTIO_GENERATOR_GENERATOR_IMPL_H_
#define THIRD_PARTY_CREDENTIO_GENERATOR_GENERATOR_IMPL_H_
#include <memory>
#include <utility>
#include "absl/base/nullability.h"
#include "absl/functional/any_invocable.h"
#include "absl/status/statusor.h"
#include "async/async_context.h"
#include "cbor/options.h"
#include "claim/generator.h"
#include "claim/manifest_box_assembler.h"
#include "generator/generator.h"
#include "generator/manifest_store_transformer.h"
#include "proto/generator.pb.h"
namespace credentio {
class ManifestStoreGeneratorImpl : public ManifestStoreGenerator {
public:
ManifestStoreGeneratorImpl(
std::unique_ptr<ManifestBoxAssembler> absl_nonnull manifest_assembler,
std::unique_ptr<ManifestEncoder> absl_nonnull manifest_encoder,
const ManifestStoreTransformer* absl_nullable manifest_store_transformer)
: manifest_assembler_(std::move(manifest_assembler)),
manifest_encoder_(std::move(manifest_encoder)),
manifest_store_transformer_(manifest_store_transformer) {}
void GenerateManifestStore(
GenerateManifestStoreRequest request, AsyncContext context,
absl::AnyInvocable<void(absl::StatusOr<GenerateManifestStoreResponse>) &&>
cb) const override;
void GenerateManifestStoreTemplate(
GenerateManifestStoreRequest request, AsyncContext context,
absl::AnyInvocable<void(absl::StatusOr<ManifestStoreTemplate>) &&> cb)
const override;
void FinalizeManifestStore(
FinalizeManifestStoreRequest request, AsyncContext context,
absl::AnyInvocable<void(absl::StatusOr<FinalizeManifestStoreResponse>) &&>
cb) const override;
private:
std::unique_ptr<ManifestBoxAssembler> manifest_assembler_;
std::unique_ptr<ManifestEncoder> manifest_encoder_;
cbor::FromProtoOptions proto_to_cbor_options_;
const ManifestStoreTransformer* absl_nullable manifest_store_transformer_ =
nullptr;
};
} // namespace credentio
#endif // THIRD_PARTY_CREDENTIO_GENERATOR_GENERATOR_IMPL_H_