TREF automatically detects if content has been tampered with.
The sky is blue due to Rayleigh scattering.
Content matches SHA-256 ID. Icon is normal.
The sky is green due to Rayleigh scattering.
Content was changed but ID kept. Red X appears!
// Automatic validation on display
wrapper.attachEvents(element);
// Manual validation
const result = await wrapper.validate();
if (!result.valid) {
console.log('Tampered!', result.expected, result.actual);
}
// Standalone function
import { validateBlock } from 'tref-block';
const result = await validateBlock(block);