Function: validateC2paMerkleSegment()
ts
function validateC2paMerkleSegment(
segmentBytes,
merkleMaps,
state?
): Promise<{
nextState: MerkleSegmentState;
result: MerkleSegmentValidation;
}>;Defined in: merkle/validateC2paMerkleSegment.ts:228
Validates a fragmented MP4 VOD media segment against the init manifest's merkle maps (§15.12.2.2). Pure: the caller persists nextState and resets state after a seek.
merkleMaps must be non-empty; the caller is responsible for only calling this in VOD Merkle mode (i.e. after InitSegmentValidation.merkleMaps came back non-empty).
Parameters
segmentBytes
merkleMaps
readonly MerkleMap[]
state?
Returns
Promise<{ nextState: MerkleSegmentState; result: MerkleSegmentValidation; }>
Example
ts
it('validates a segment with a correct Merkle proof', async () => {
const validated = await validateC2paMerkleSegment(segments[0], merkleMaps)
strictEqual(validated.result.isValid, true)
strictEqual(validated.result.location, 0)
strictEqual(validated.result.errorCodes.length, 0)
})