// PixelKeep original reference-file check. Node 20+. No network or file writes.
import {readFile} from 'node:fs/promises';import {createHash} from 'node:crypto';
const [sourcePath='source.jpg',restoredPath='restored.jpg']=process.argv.slice(2);
const expected='c6597fa19f5fcaebca4139b43a5f23acd614e91073826729e2a2bd9496d39d9b';
try {
 const [source,restored]=await Promise.all([readFile(sourcePath),readFile(restoredPath)]);
 const sha=b=>createHash('sha256').update(b).digest('hex');
 const record={purpose:'Verify the published PixelKeep sample, not an arbitrary archive',source:{path:sourcePath,bytes:source.length,sha256:sha(source)},restored:{path:restoredPath,bytes:restored.length,sha256:sha(restored)},expectedSourceSha256:expected,sourceMatchesPublishedSample:sha(source)===expected,restoredBytesEqualSource:source.equals(restored)};
 console.log(JSON.stringify(record,null,2));if(!record.sourceMatchesPublishedSample||!record.restoredBytesEqualSource)process.exitCode=1;
} catch(error){console.error('Could not read both local files: '+error.message);process.exitCode=1;}
