CML
    Preparing search index...

    Function validateC2paManifestBoxSegment

    • Validates a C2PA manifest-box live stream segment.

      Parses the C2PA manifest embedded in the segment and validates per §19.7.1 and §19.7.2. Recomputes the c2pa.hash.bmff.v3 content hash from the raw segment bytes and compares it against the expected hash in the manifest assertion. Checks live-video assertions (sequenceNumber, streamId, continuityMethod) and manifest-ID chain continuity.

      This function is pure — it does not access any external state. The caller is responsible for persisting nextManifestId and nextState between calls.

      Parameters

      • bytes: Uint8Array

        Raw segment bytes

      • lastManifestId: string | null

        Manifest ID from the previous segment, or null for the first segment

      • Optionalstate: ManifestBoxValidationState

        Optional state from the previous segment for streamId/sequenceNumber checks

      Returns Promise<
          {
              nextManifestId: string
              | null;
              nextState: ManifestBoxValidationState;
              result: ManifestBoxValidationResult;
          },
      >

      Validation result, the manifest ID, and state to persist for the next call

      it('returns isValid=false with errorCodes for empty bytes', async () => {
      const { result, nextManifestId } = await validateC2paManifestBoxSegment(
      new Uint8Array(0),
      null,
      )

      strictEqual(result.isValid, false)
      strictEqual(result.errorCodes.length > 0, true)
      strictEqual(result.manifest, null)
      strictEqual(nextManifestId, null)
      })