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
Read it
const res = await client.score({ responseText }); const { receipt } = res; if (receipt) console.log(receipt.receiptId, receipt.status);Store it with the verdict id
Keep
receiptandverdict.verdictIdtogether. You can check the receipt later on your own.
Fields
| Field | What it is |
|---|---|
receiptId, verdictId, workspaceId | Ids |
inputHash, outputHash, verdictHash | SHA-256 fingerprints of the input, the output and the public verdict |
timestamp | When ClearRun issued it, from the server clock |
keyId, alg | Signing key id, and Ed25519 |
signature | Signature over the receipt fields |
prevHash, receiptHash | The link to the previous receipt, and this receipt's hash |
encKeyId | Id of the key used to encrypt the stored copy |
status | stored or queued. It may be missing |
Queued
queued means saving was delayed. See What does receipt status 'queued' mean?