How to read the receipt on a ClearRun response

Hosted score, evaluate and chat responses include receipt next to verdict when ClearRun stores one. It holds the hashes, the signature, the chain link and status. The SDK types declare it as an optional Receipt on score and evaluate responses.

Last updated

Applies to version 1.2.0 of @clearrun/sdk and @clearrun/cli.

Steps

  1. Read it

    const res = await client.score({ responseText });
    const { receipt } = res;
    if (receipt) console.log(receipt.receiptId, receipt.status);
  2. Store it with the verdict id

    Keep receipt and verdict.verdictId together. You can check the receipt later on your own.

Fields

Fields
FieldWhat it is
receiptId, verdictId, workspaceIdIds
inputHash, outputHash, verdictHashSHA-256 fingerprints of the input, the output and the public verdict
timestampWhen ClearRun issued it, from the server clock
keyId, algSigning key id, and Ed25519
signatureSignature over the receipt fields
prevHash, receiptHashThe link to the previous receipt, and this receipt's hash
encKeyIdId of the key used to encrypt the stored copy
statusstored or queued. It may be missing

Queued

queued means saving was delayed. See What does receipt status 'queued' mean?