Skip to content

Check

Check a record from your own code with records.check, or with nothing but the history file and the standalone checker. Shown with a lab checking an evaluation run before an outside evaluator checks it again.

There are three places a record gets checked, and they run the same check. The Shared Record runs it in the reader's browser when the record opens. records.check runs it in your own process. The standalone checker, @pacspace-io/check, runs it for anyone who holds the history file, with no account, no key, and no PacSpace.

What the check does: for every committed entry, recompute the seal from the sealed record in the receipt and compare it with what was committed; confirm the entries are the ones the record says it has, in order; and confirm the file's own fingerprint. With expect, it also says whether the files or fingerprints you hold are among the committed ones. A passing check means the record is unchanged since it was committed. It does not show that what was recorded was true.

From code

Before the lab hands evaluation run 4417 to an outside evaluator, it checks the run's history and confirms that entry 3 names the tool call it logged. It passes the logged file with its blinding file, because the entry's fingerprint is blinded.

TypeScript
import { readFile } from 'node:fs/promises';
import { readBlindingFile } from '@pacspace-io/sdk';

const history = await pac.records.history({ record: 'eval-run-4417' });
const result = await pac.records.check({
  history,
  expect: [{
    // entries count from 1
    entry: 3,
    files: [{
      source: await readFile('./runs/4417/evt-0193.json'),
      blinding: await readBlindingFile('./runs/4417/evt-0193.json.pacspace.json'),
    }],
  }],
});

// true when every check passed
result.ok;

// true when the file is among entry 3's committed ones
result.entries.find((row) => row.entry === 3)?.expected;

// null, or the name of the first check that failed
result.failedCheck;

// a sentence, when a check failed
result.reason;

// true only when `source` was given and read
result.sourceChecked;

expect[].entry and each result's entry count from 1, as every page does; the history file itself keeps the wire's seq, counted from 0, because the check compares the file by its own fingerprint. A row of expect takes files, each a file you hold with its blinding file, or payloads, the fingerprints you kept from fingerprint. A blinded fingerprint matches only with its blinding file; when a file comes without one, its entry is listed in blindingFileNeeded, with a note that says so.

The TypeScript check runs the whole check in your process: every seal, the order, and the file's fingerprint. Pass source and it also reads what was committed from outside PacSpace, and sourceChecked says so. check never throws on a failed check; the result names it.

The Python check today compares your files and fingerprints with the committed payloads and reads each entry's status. It does not recompute the seals. For the whole check from Python, hand the history file to the standalone checker below.

Without PacSpace

The evaluator saves the history file and runs the checker. It reads the record's seals from the proof layer, the infrastructure no party controls where each seal is committed, PacSpace included, and it never calls PacSpace.

Shell
npx @pacspace-io/check history.json

With the fingerprint printed on a statement, in STATEMENT_FINGERPRINT, so the checker also says whether that statement was printed over this exact file:

Shell
npx @pacspace-io/check history.json --fingerprint "$STATEMENT_FINGERPRINT"

It prints a few labeled facts and then plain sentences: how many entries the record has, that they are all here, and how many match what was committed, whether the record agrees with the proof layer, whether the daily statement matches, and whether the fingerprint you gave names this file. The last sentence is always the same, because it is the boundary of the check: the check shows the record is unchanged since it was committed; it does not show that what was recorded was true.

--held-file checks whether an entry that passed the check names a file you hold, such as the tool call the lab gave the evaluator. For a blinded entry, add --blinding with the file's blinding file. Both files are read on this machine, as bytes.

Shell
npx @pacspace-io/check history.json --held-file evt-0193.json --blinding evt-0193.json.pacspace.json
  --held-file <path>     check whether a verified entry names a file you hold
  --blinding <path>      the blinding file for the file you hold, when its entry is blinded
  --history <path>       the seal history or kept copy a disclosure is checked against

The checker also reads a Shared Record's seal history and a copy kept from the link. It checks every seal, their order and that none is missing, checks each revealed field against its entry's seal, and compares the current seal with the proof layer. A file can be checked only against a fingerprint among the revealed fields.

--offline checks the file alone. --json prints the report as a document your code can read. Exit codes: 0 the check passed as asked; 1 it did not, or the file you hold is not in it; 2 the history file, the file you hold, its blinding file or the arguments could not be used; 3 the proof layer could not be reached. When more than one applies, 2 comes before 3, and 3 before 1. Node.js 20.19 or later.

What a failure looks like

A failed check names the first thing that failed, in the order the check runs. The Shared Record says it in a sentence: "This record has 3 entries. 2 match what was committed. Entry 2 does not match." records.check names the check in failedCheck and gives a reason; the checker prints the entries that did not match and the ones the file does not carry. A history that cannot be read at all is refused before any entry is checked.

Which check to use

You holdUse
A key and the record idrecords.history then records.check, in code.
A history file and no keynpx @pacspace-io/check history.json.
A history file and a file the record should nameThe checker with --held-file, and --blinding for a blinded entry.
A link and a codeOpen it. The check runs before you read a word.
A printed statement and the fileThe checker with --fingerprint.