blob: d32a6063b9f77a432aa98c2b7d2bcd23a83bc2b4 [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_UTILS_STATUS_TRACKER_H_
#define THIRD_PARTY_CREDENTIO_UTILS_STATUS_TRACKER_H_
#include "constants/status_codes.h"
#include "proto/manifest.pb.h"
#include "proto/validation_result.pb.h"
#include "proto/validation_status.pb.h"
#include "validator/tracker.h"
namespace credentio {
// A tracker for writing hard binding success and failure codes to the manifest
// containing the hard binding assertion and optionally the active manifest.
//
// The success and failure codes are written to the manifest containing the
// assertion using the provided ValidationTracker and, if the manifest
// containing the assertion is not the active manifest, optionally to the active
// manifest using the optional ValidationTracker.
//
// The success and failure codes are written to the active manifest using a
// google-code prefixed version of the c2pa success/failure code. This is
// necessary because the summarizer only reads from the active manifest and
// needs the success/failure codes to know which hard binding assertions were
// evaluated.
class StatusTracker {
public:
virtual ~StatusTracker() = default;
virtual void RecordSuccess(SuccessStatusCode code,
ValidationTracker::RecordOptions options) = 0;
virtual void RecordFailure(FailureStatusCode code,
ValidationTracker::RecordOptions options) = 0;
virtual void RecordInformational(
InformationalStatusCode code,
ValidationTracker::RecordOptions options) = 0;
};
} // namespace credentio
#endif // THIRD_PARTY_CREDENTIO_UTILS_STATUS_TRACKER_H_