Beta. STARCO Dev works with synthetic data only: do not send real personal or health data. Every feature shows its real status (Available Beta Beta · in development Coming).

Documentation menu

Example 06

Verify the audit chain yourself.

Read every row of your project's audit chain and recompute its hashes on your own machine. No secret is involved, so anyone you give the rows to can do the same.

time 4 minuses audit chain · SHA-256 Betadata synthetic
Beta.The API this program calls is in beta and works with synthetic data only. The program is complete: with a project key in STARCO_KEY it runs as it is. The TypeScript and CLI tabs use the SDK and the command line, which are not published yet.

The idea#

Each row's row_hash is the SHA-256 of the text "starco-dev-audit/v1\n" + project_id + "\n" + seq + "\n" + prev_hash + "\n" followed by one line per field, field=<byte length>:<value>, joined with new lines, for the fields seq, actor_type, actor_ref, action, resource_type, resource_id, http_status, detail, created_at (a missing value is written field=~). The first prev_hash is 64 zeros. GET /v1/audit returns the same rule as hash_input.

The whole program#

export API="https://api.starco.dev/v1"
AUTH="Authorization: Bearer $STARCO_KEY"
JSON="Content-Type: application/json"
# The server walks the chain for you; keep the head somewhere of your own and compare it later.
curl -s "$API/audit/verify" -H "$AUTH" | jq -c '{ok, events, head_seq, first_broken_seq}'
# Recomputing every hash needs more than a shell one-liner: see the Python tab (30 lines, standard library plus requests).
Output of the curl tabillustrative · synthetic
{"ok":true,"events":14,"head_seq":14,"first_broken_seq":null}

The other tabs print the same facts in their own format. Ids, hashes and counts depend on your project.

What just happened

The server walked the chain and found it intact. The Python, TypeScript and CLI tabs go further: they read every row and recompute every hash on your machine, so the rows you were given are proven consistent with each other without trusting the server's answer. The server's walk counts one row more, because the request that read the chain is itself appended after its answer.

Go further#