View as Markdown

Mandate · Concept

Decision ledger

The decision ledger is your account's append-only record of every authorize and verify: the token, the facts as evaluated, the policy version and rule, and the result. Each record is hash-chained to the one before it, so you can prove later that a person authorized an action and that the record wasn't edited.

When to use it

  • Answer "who authorized this, and under which rule?" for an audit or a dispute.
  • Hand a counterparty a signed receipt they can check without trusting you or Provenance.
  • Find every denied action for an agent session, a token or a reason.

How it works

  1. Every call writes a record. Authorize and verify each append one, whatever the result.
  2. Records are chained. Each has a record_hash over its contents and the prev_hash of the record before it, per account. Changing any record breaks every hash after it.
  3. Anyone can check. GET /v1/mandate/assessments/verify_chain recomputes the chain, a receipt verifies offline, and the transparency log publishes each account's chain head.
  1. Authorize or verify
    facts, rule, result
  2. Ledger record
    record_hash + prev_hash
  3. Receipt
    ES256, verifiable offline

There's no endpoint to edit or delete a record. Deleting an account removes personal fields but keeps the chain intact.

Key fields

idstring
The decision's ID, prefixed dec_.
kindstring
authorize or verify.
resultstring
valid, denied or pending.
reasonstring | null
The reason code when the result isn't valid.
factsobject | null
The facts the policy evaluated, such as the amount and action type.
matched_rule_idstring | null
The policy rule that decided it.
policy_versioninteger | null
The policy version in force; null for the default policy.
policyobject | null
The rule that decided, read back as the same block every assessment carries: its current ID and name, its action, and each condition against the facts this record kept. matched_rule_id and policy_version stay on the record as written, because they are part of what record_hash covers.
jtistring
The intent token's ID.
agent_session_idstring
The agent session the token was minted for.
record_hashstring
SHA-256 over this record's canonical contents.
prev_hashstring
The previous record's record_hash.

Records also carry the registered agent, grant, approver or trace when one was involved. A verify an auto_approve clause approved carries auto_approval (the rule, the clause, its label and the policy version), and GET /v1/mandate/assessments?automatic=true lists those.

Find a decision and get its receipt

Make a decision to look at: authorize a payment, then verify a changed payload so it's denied. Export the sandbox account key first:

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5

curl -s $PROVENANCE_API/v1/mandate/intents \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
    "action_payload": { "amount": 1850, "payee": "acct_brindlecote_supplies" },
    "agent_session_id": "sess_ledger_1",
    "device_id": "dev_00000000000000000000000000000001"
  }' > authorization.json
export INTENT_TOKEN=$(jq -r .intent_token authorization.json)

curl $PROVENANCE_API/v1/mandate/assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "intent_token": "'"$INTENT_TOKEN"'",
    "action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
    "action_payload": { "amount": 18500, "payee": "acct_attacker" }
  }'
{
  "object": "mandate_assessment",
  "valid": false,
  "reason": "payload_hash_mismatch"
}

List the session's decisions with GET /v1/mandate/assessments, newest first. You can also filter by token, result, reason or a time range:

curl -s "$PROVENANCE_API/v1/mandate/assessments?session=sess_ledger_1&limit=1" \
  -H "Authorization: Bearer $PROVENANCE_KEY" | tee decisions.json
export DECISION_ID=$(jq -r '.data[0].id' decisions.json)

The response, trimmed:

{
  "object": "list",
  "data": [
    {
      "id": "mas_01M5Q36E142MXMY0ADRNRAFW7P",
      "object": "mandate_assessment",
      "kind": "verify",
      "agent_session_id": "sess_ledger_1",
      "device_id": "dev_00000000000000000000000000000001",
      "result": "denied",
      "reason": "payload_hash_mismatch",
      "matched_rule_id": null,
      "record_hash": "ffd41ae065bf4eca4098739b361faa47e132fdee91d97eecfd29c4dcdef64bd8",
      "prev_hash": "eeefb28780ff95619231fb234ec2986f5693888219f753e5835f92782a7b65b4"
    }
  ],
  "has_more": true
}

Get its receipt with GET /v1/mandate/assessments/{id}/receipt. The response is a receipt object: claims is the signed content, decoded, and token is an ES256 JWS signed with the same keys as intent tokens, so anyone can verify it offline or paste it into the console's Verify a proof page. Receipts are rebuilt from the record each time, never stored; add ?format=pdf for a one-page PDF.

curl $PROVENANCE_API/v1/mandate/assessments/$DECISION_ID/receipt \
  -H "Authorization: Bearer $PROVENANCE_KEY"

The response, trimmed:

{
  "object": "receipt",
  "id": "rcpt_5b0d2b1f8e7c4a6d9e3f1a2b3c4d5e6f",
  "claims": {
    "receipt_id": "rcpt_5b0d2b1f8e7c4a6d9e3f1a2b3c4d5e6f",
    "decision_id": "mas_01M5Q36E142MXMY0ADRNRAFW7P",
    "kind": "verify",
    "agent_session_id": "sess_ledger_1",
    "result": "denied",
    "reason": "payload_hash_mismatch",
    "biometric_bound": false,
    "record_hash": "ffd41ae065bf4eca4098739b361faa47e132fdee91d97eecfd29c4dcdef64bd8"
  },
  "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtcmVjZWlwdCtqd3QifQ.eyJkZWNpc2lvbl9pZCI6ImRlY18wMU01UTM2RTE0Mk1YTVkwQURSTlJBRlc3UCJ9.Yl1jB3gTWRUDUfgfLtDY2wZvFVtA3_VoFfUqHrfZDr4-Oiqn5kPCpoqeOwiPbqzSv0OFVUB1pCe5zz4fXH1RWQ",
  "verify_url": "https://…/developers/verify?receipt=eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtcmVjZWlwdCtqd3QifQ…"
}

Check the chain

GET /v1/mandate/assessments/verify_chain recomputes every hash in the account's chain, or in a created_gte and created_lte range, and reports the first break:

curl $PROVENANCE_API/v1/mandate/assessments/verify_chain \
  -H "Authorization: Bearer $PROVENANCE_KEY"
{ "object": "chain_verification", "valid": true }

A broken chain returns valid: false with broken_at and a reason. The console's Decisions page has the same check and a filterable view of every record.

Limitations: only account keys write to the ledger; decisions made with a carrier key aren't chained here.