blob: 360db8899c2fc2370eaf35f24140477772b0b435 [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_TOOLS_ASSET_WRITER_H_
#define THIRD_PARTY_CREDENTIO_TOOLS_ASSET_WRITER_H_
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include "proto/generator.pb.h"
#include "riegeli/bytes/reader.h"
#include "riegeli/bytes/writer.h"
#include "testing/local_key_crypto_write_handler.h"
namespace credentio {
// Writes a C2PA manifest store into `destination` based on `source` and
// `request`, using `LocalKeyCryptoWriteHandler` configured with
// `crypto_options`.
//
// `media_type` specifies the MIME type of the asset (e.g., "image/png").
// See the "Supported Media Formats" section of README.md for supported types.
absl::Status WriteAsset(LocalKeyCryptoWriteHandlerOptions crypto_options,
GenerateManifestStoreRequest request,
absl::string_view media_type, riegeli::Reader& source,
riegeli::Writer& destination);
// Convenience wrapper that opens `input_path` and `output_path` and infers
// the media type from `input_path`.
absl::Status WriteAssetFile(LocalKeyCryptoWriteHandlerOptions crypto_options,
GenerateManifestStoreRequest request,
absl::string_view input_path,
absl::string_view output_path);
} // namespace credentio
#endif // THIRD_PARTY_CREDENTIO_TOOLS_ASSET_WRITER_H_