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
- Every call writes a record. Authorize and verify each append one, whatever the result.
- Records are chained. Each has a
record_hashover its contents and theprev_hashof the record before it, per account. Changing any record breaks every hash after it. - Anyone can check. GET
/recomputes the chain, a receipt verifies offline, and the transparency log publishes each account's chain head.v1/ mandate/ assessments/ verify_ chain
- Authorize or verifyfacts, rule, result
- Ledger recordrecord_hash + prev_hash
- ReceiptES256, 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_. kindstringauthorizeorverify.resultstringvalid,deniedorpending.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;
nullfor 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_idandpolicy_versionstay on the record as written, because they are part of whatrecord_hashcovers. 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" }
}'
import { Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const action = { actionDescription: "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies" };
const auth = await prov.mandate.intents.create({
...action,
actionPayload: { amount: 1850, payee: "acct_brindlecote_supplies" },
agentSessionId: "sess_ledger_1",
deviceId: "dev_00000000000000000000000000000001",
});
await prov.mandate.assessments.create({ intentToken: auth.intentToken, ...action, actionPayload: { amount: 18500, payee: "acct_attacker" } });
import os
from provenanceauth import Provenance
prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
description = "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies"
auth = prov.mandate.intents.create(
action_description=description,
action_payload={"amount": 1850, "payee": "acct_brindlecote_supplies"},
agent_session_id="sess_ledger_1",
device_id="dev_00000000000000000000000000000001",
)
prov.mandate.assessments.create(intent_token=auth["intent_token"], action_description=description, action_payload={"amount": 18500, "payee": "acct_attacker"})
{
"object": "mandate_assessment",
"valid": false,
"reason": "payload_hash_mismatch"
}
List the session's decisions with GET /, 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)
const { data } = await prov.mandate.assessments.list({ session: "sess_ledger_1", limit: 1 });
const decision = data[0]!;
decision = prov.mandate.assessments.list(session="sess_ledger_1", limit=1)["data"][0]
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 /. 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"
const { claims, token, verifyUrl } = await prov.mandate.assessments.receipt(decision.id);
receipt = prov.mandate.assessments.receipt(decision["id"])
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 / 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"
const chain = await prov.mandate.assessments.verifyChain();
chain = prov.mandate.assessments.verify_chain()
{ "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.