Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/rulvar / verifyCandidateBytes

Function: verifyCandidateBytes()

ts
function verifyCandidateBytes(bytes, hash): boolean;

Defined in: packages/core/dist/index.d.ts

Verifies retained candidate bytes against a journaled candidateHash (RV4207). The retained blob holds the candidate's TEXT verbatim (the document itself for a string result, its JSON serialization otherwise), while the hash covers the canonical VALUE, so the check tries the value both ways: as the string document, then as parsed JSON. Returns false on any mismatch or unparsable bytes, never throws: the caller is an audit path, and a corrupt blob is a finding there, not a crash.

Parameters

ParameterType
bytesstring | Uint8Array<ArrayBufferLike>
hashstring

Returns

boolean