c2pa_testkit library

Platform-neutral conformance, mutation, and performance testing helpers.

Classes

BenchmarkCancellationToken
A cooperative cancellation token for benchmark operations.
BenchmarkResult
The named result of a benchmark run.
BenchmarkSample
One measured benchmark iteration.
BenchmarkStatistics
Aggregate statistics computed from benchmark samples.
BitFlipStep
A mutation that flips one bit in protected or unprotected bytes.
ByteMutation
Deterministic, non-mutating byte fixture transformations.
ByteMutationStep
A single deterministic byte mutation in a MutationPlan.
ByteRange
A half-open byte range used to target fixture mutations.
CallbackReportProjection<T>
A callback-based projection for report types owned by a consuming package.
CampaignCancellationToken
A cooperative cancellation token for campaign runs and cases.
CampaignCaseResult
The callback outcome for one mutation campaign case.
CampaignFailure
A recorded failure from a mutation campaign run.
CampaignReplay
Replay data for reproducing one generated mutation case.
ConformanceFixture
A single asset entry in a conformance fixture index.
ConformanceFixtureIndex
A validated index of conformance fixtures.
ConformanceFixtureSource
Attribution and licensing for a conformance fixture asset.
ConformanceIgnore
A set of conformance fields excluded from comparison.
ConformanceReportProjection<T>
Normalizes the conformance-relevant subset of Dart and c2pa-rs reports.
DeleteRangeStep
A mutation that removes a structural byte range from an asset.
DifferentialComparison
The normalized result of comparing a Dart value with oracle JSON.
DifferentialDifference
A single mismatch at a JSON path in a differential comparison.
DuplicateRangeStep
A mutation that inserts a duplicate copy of a structural byte range.
FakeC2paSigner
A recording signer whose behavior is entirely supplied by callback.
FakeC2paVerifier
A recording verifier whose behavior is entirely supplied by callback.
FixtureAsset
An asset fixture that owns its bytes and descriptive metadata.
InstrumentedByteSource
Records read shape without changing the wrapped source's byte semantics.
InstrumentedReadRecord
A single recorded read attempt against an instrumented source.
IntegerCorruptionStep
A mutation that flips one byte of a length or offset integer.
IntegerField
A fixed-width integer field that can be corrupted in a fixture.
MalformedSizeStep
A mutation that replaces one byte with an invalid CBOR or DER size header.
MutationCampaignCase
A generated mutation case passed to a campaign callback.
MutationCampaignConfig
Configuration that bounds a mutation campaign run.
MutationCampaignReport
The complete result of a mutation campaign run.
MutationCampaignRunner
Runs deterministic mutation campaigns over a fixture corpus.
MutationGeneratorConfig
Configuration for generating byte-level negative-test mutations.
MutationPlan
A deterministic sequence of byte mutations for a fixture.
MutationPlanGenerator
A deterministic mutation-plan generator for byte fixtures.
NestingBombStep
A mutation that inserts a deeply nested byte pattern.
NormalizedProjection<T>
Projects Dart and oracle output into the same JSON-compatible shape.
OracleReportComparison
Outcome of comparing one asset.
OracleReportDifference
A single semantic disagreement between the two reports.
PatternedChunkSource
A logical source composed of fixed-size chunks with a repeating pattern.
RegressionBudget
Thresholds used to detect benchmark regressions.
RegressionBudgetEvaluation
The outcome of evaluating a benchmark against a regression budget.
RegressionBudgetViolation
One metric that violated a RegressionBudget.
ReorderRangesStep
A mutation that swaps two non-overlapping structural byte ranges.
ReportProjection<T>
Projects complete reports for differential testing.
SeededByteGenerator
A deterministic 32-bit byte generator for reproducible test cases.
SignInvocation
A recorded fake-signing request with copied input data.
SparseByteSegment
A concrete byte override inside a synthetic sparse asset.
SparseRandomAccessAsset
A deterministic logical asset that allocates only requested ranges.
TruncateStep
A mutation that removes trailing bytes from an asset.
ValidationResultsProjection
Normalizes ValidationResults and common c2pa-rs JSON field spellings.
VerifyInvocation
A recorded fake-verification request with copied inputs.

Enums

ByteOrder
The byte order used when targeting an integer field.
CampaignFailureKind
The source of a recorded campaign failure.
ConformanceField
A conformance report field that can be projected or ignored.
MutationClassification
A planned corruption category for negative C2PA validation tests.

Constants

trustConfigurationCodes → const Set<String>
Status codes whose value is decided by trust-store configuration rather than by the implementation under test.

Functions

compareOracleReports({required Map<String, Object?>? oracleReport, required Map<String, Object?>? dartReport, bool ignoreTrustConfiguration = true}) → OracleReportComparison
Compares one asset's reports.
compareWithOracle<T>({required T dartResult, required Object? oracleJson, required NormalizedProjection<T> projection}) → DifferentialComparison
Compares a Dart result with decoded oracle JSON through projection.
normalizeJson(Object? value) → Object?
Canonicalizes JSON-compatible data by sorting all map keys.
normalizeJumbfUri(String? uri) → String
Strips self#jumbf= and the manifest-label segment so that absolute and relative JUMBF URIs become comparable.

Typedefs

BeforeInstrumentedRead = FutureOr<void> Function(ByteRange range)
Hook invoked after a read is recorded and before it reaches the source.
CampaignCaseCallback = FutureOr<CampaignCaseResult> Function(MutationCampaignCase testCase)
Handles one generated mutation case during a campaign run.
CampaignPersistenceHook = FutureOr<void> Function(Map<String, Object?> report)
Persists a completed campaign report as a JSON-safe map.
ConformanceProjector<T> = Map<String, Object?> Function(T value)
Converts a package-specific report into conformance JSON fields.
DartReportProjector<T> = Object? Function(T report)
Extracts JSON-compatible comparison data from a Dart report.
FakeSignCallback = FutureOr<Uint8List> Function(Uint8List data)
Test-only signing callback for FakeC2paSigner.
FakeVerifyCallback = Future<bool> Function({required String algorithm, required Uint8List data, required Uint8List publicKey, required Uint8List signature})
Test-only verification callback for FakeC2paVerifier.
OracleReportProjector = Object? Function(Object? value)
Extracts JSON-compatible comparison data from decoded oracle JSON.