Dekimu · anchored receipts docs
Self-verify walkthrough
A long-form, end-to-end verification — done by hand, with curl and openssl. Skip the SDK; trust nothing past your own keyring.
What you'll prove
When you finish this walkthrough you will have independently confirmed three facts about a Dekimu receipt:
- The receipt's body was signed by an Ed25519 key the issuer advertised at the time of issue (signature check).
- The receipt ID was committed to a daily Merkle root built and signed by Dekimu's audit-anchor key (inclusion check).
- That daily root has not been modified or substituted since it was signed (root signature check).
What you will not have proven: that the underlying artifact (a Commander run, a miniterms document) is correct, useful, or true. Anchored Receipts are provenance and privacy-lifecycle protocols, not a quality judgement.
Prerequisites
curl,jq, andopenssl3.x (Ed25519 verification needs OpenSSL 1.1.1+; 3.x is recommended).- A real receipt ID. Get one from any Dekimu app's receipts view, or paste a known ID into the lookup form on
verify.dekimu.com. - A scratch directory. The walkthrough writes a handful of small files into the current working directory.
Step 1 — fetch the claim
Replace $ID with your receipt ID. The first call gets the signed claim; we save it to disk so subsequent steps can parse it.
ID="<paste-id-here>" curl -s "https://verify.dekimu.com/api/v/$ID" > claim.json jq . claim.json | head -40
You should see the receipt's id, kind, issuer, subject, iat, kid, body, and sig. Note the kid — you'll look up the matching public key in step 3.
Step 2 — fetch the inclusion proof
curl -s "https://verify.dekimu.com/api/proof/$ID" > proof.json
jq '{v, claimId, date, rootHash, rootKid}' proof.jsonIf the response is {"error":"not_yet_built"}, the receipt is younger than the most recent daily root seal (00:05 UTC). Wait for the next root build and retry — the signed claim itself is already valid. If it is {"error":"not_verifiable"}, no daily root signed at build time matches this receipt yet, so no proof is served and the receipt is not shown as anchored.
Note rootHash and rootKid. The first is what you'll reconstruct from the Merkle path; the second tells you which audit-root public key to use. The signature in rootSig is the one the daily root received when it was built.
Step 3 — fetch the public keys
curl -s "https://verify.dekimu.com/.well-known/dekimu-claim-keys.json" \ > claim-keys.json curl -s "https://verify.dekimu.com/.well-known/dekimu-audit-root-keys.json" \ > audit-root-keys.json
Two catalogs: one for issuer signing keys (used to sign the claim's body), one for audit-anchor keys (used to sign the daily root). Pull the public key for the claim's kid:
KID=$(jq -r .kid claim.json) ISSUER_KEY_B64URL=$(jq -r --arg k "$KID" '.keys[] | select(.kid==$k) | .publicKey' \ claim-keys.json) echo "Issuer kid: $KID" echo "Issuer key: $ISSUER_KEY_B64URL" jq -r --arg k "$KID" '.keys[] | select(.kid==$k) | .retiredAt // "active"' claim-keys.json
If the key carries a retiredAt, its seed may be held by someone else, so a valid signature proves nothing about when — or by whom — the claim was made. A daily root commits to claim IDs, not bodies, so an anchor alone does not settle it either. Treat such a claim as genuine only if all three hold: its iat is not after retiredAt; the daily root you check in Step 6 is dated on or before retiredAt's UTC day; and /api/v/<id> reports retiredKey.verdict = trusted, which means the ID is on verify's reviewed list of receipts signed before the retirement, with this exact signature.
Step 4 — verify the issuer signature with openssl
Ed25519 verification with raw keys is supported by OpenSSL via PEM. We need to wrap the base64url public key in the standard SubjectPublicKeyInfo envelope, then verify the claim's signed body against sig.
First, write a small Python helper that turns the base64url key into a PEM file and writes the signed body bytes the issuer actually signed:
python3 - <<'PY'
import base64, json, sys
def b64url_decode(s: str) -> bytes:
pad = "=" * (-len(s) % 4)
return base64.urlsafe_b64decode(s + pad)
claim = json.load(open("claim.json"))
keys = json.load(open("claim-keys.json"))["keys"]
key = next(k for k in keys if k["kid"] == claim["kid"])
# Wrap the raw 32-byte Ed25519 public key in SPKI:
# 30 2a 30 05 06 03 2b 65 70 03 21 00 || raw32
raw = b64url_decode(key["publicKey"])
assert len(raw) == 32, "expected 32-byte Ed25519 public key"
spki = bytes.fromhex("302a300506032b6570032100") + raw
import textwrap
b64 = base64.b64encode(spki).decode()
pem = "-----BEGIN PUBLIC KEY-----\n" + "\n".join(textwrap.wrap(b64, 64)) + "\n-----END PUBLIC KEY-----\n"
open("issuer.pem", "w").write(pem)
# The signed body is the canonical JSON of the claim with sig stripped.
# Dekimu uses RFC 8785 JSON Canonicalization Scheme (JCS).
# For a from-scratch verification, install a JCS library; for this walkthrough
# we use the simpler 'sort_keys=True, separators=(",", ":")' form which
# matches the Dekimu canonicalization for claims that contain no floats.
signed = {k: v for k, v in claim.items() if k != "sig"}
signed_bytes = json.dumps(signed, sort_keys=True, separators=(",", ":")).encode()
open("signed.bin", "wb").write(signed_bytes)
# Decode the signature.
sig = b64url_decode(claim["sig"])
open("sig.bin", "wb").write(sig)
print("wrote issuer.pem, signed.bin, sig.bin")
PYNow verify:
openssl pkeyutl -verify \ -pubin -inkey issuer.pem \ -rawin -in signed.bin \ -sigfile sig.bin # Expected output: "Signature Verified Successfully"
If you see Signature Verification Failure instead, the most likely cause is canonicalization drift — Dekimu signs the JCS canonical form; the simple sort_keys=True shim above matches it for claim shapes that don't contain floats. For receipts that do, install a real JCS library (pip install jcs) and run the body through jcs.canonicalize.
Step 5 — verify Merkle inclusion locally
The proof carries the claimId and a siblings array of {side, hash} entries. Hash the claim ID as an RFC 6962 leaf and walk the path with RFC 6962 node hashing. A v: 2 proof has two segments: first up to the issuing app's sub-root (appProof), then from that app's leaf up to the daily root.
python3 - <<'PY'
import hashlib, json
proof = json.load(open("proof.json"))
def sha(b): return hashlib.sha256(b).digest()
def node(left, right): return sha(b"\x01" + left + right) # RFC 6962 node
def walk(cur, siblings):
for s in siblings:
sib = bytes.fromhex(s["hash"])
cur = node(sib, cur) if s["side"] == "L" else node(cur, sib)
return cur
leaf = sha(b"\x00" + proof["claimId"].encode()) # RFC 6962 leaf
if proof["v"] == 2:
# Two segments: claim -> per-app sub-root, then app leaf -> daily root.
app = proof["appProof"]
sub = walk(leaf, app["siblings"])
assert sub.hex() == app["rootHash"], "app sub-tree mismatch"
name = app["app"].encode()
leaf = sha(b"\x02" + bytes([len(name)]) + name + sub) # app leaf
root = walk(leaf, proof["siblings"])
assert root.hex() == proof["rootHash"], (
f"Merkle mismatch: reconstructed {root.hex()} vs proof {proof['rootHash']}"
)
print(f"Merkle root reconstructed: {root.hex()}")
PYThe script asserts the path actually rebuilds the published root. If it fails, the leaf or the path was modified — treat the receipt as untrusted.
Step 6 — verify the root signature
The daily root is signed by the audit-anchor key named by the proof's rootKid. The signature covers exactly {"v":1,"date":…,"rootHash":…} in JCS form — v is always 1, and the kid is not part of it. Rebuild those bytes and run the same openssl recipe:
python3 - <<'PY'
import base64, json, textwrap
proof = json.load(open("proof.json"))
keys = json.load(open("audit-root-keys.json"))["keys"]
key = next(k for k in keys if k["kid"] == proof["rootKid"])
def b64url(s):
return base64.urlsafe_b64decode(s + "=" * (-len(s) % 4))
raw = b64url(key["publicKey"])
assert len(raw) == 32, "expected a 32-byte Ed25519 public key"
spki = bytes.fromhex("302a300506032b6570032100") + raw
b64 = base64.b64encode(spki).decode()
pem = "-----BEGIN PUBLIC KEY-----\n" + "\n".join(textwrap.wrap(b64, 64)) + "\n-----END PUBLIC KEY-----\n"
open("root.pem", "w").write(pem)
# The daily root signature covers exactly {"v": 1, "date", "rootHash"}.
# "v" here is the signature-payload version and is ALWAYS 1, even when the
# proof itself is v2. rootKid is NOT in the payload. JCS (RFC 8785) of this
# object is sorted-key, no-whitespace JSON.
signed = {"v": 1, "date": proof["date"], "rootHash": proof["rootHash"]}
open("root-signed.bin", "wb").write(
json.dumps(signed, sort_keys=True, separators=(",", ":")).encode()
)
open("root-sig.bin", "wb").write(b64url(proof["rootSig"]))
print("wrote root.pem, root-signed.bin, root-sig.bin")
PY
openssl pkeyutl -verify \
-pubin -inkey root.pem \
-rawin -in root-signed.bin \
-sigfile root-sig.bin
# Expected: "Signature Verified Successfully" (OpenSSL 3.0+ for -rawin)Verdict
If steps 4, 5, and 6 all returned successful verifications, the receipt is verified:
- The body was signed by the issuer's public key at the time stamped by
iat. - The receipt ID was committed to a daily Merkle root for
<anchor-date>. - That daily root hash was signed by Dekimu's audit-anchor key when the root was built.
You did not trust Dekimu's servers to perform any of these steps — you trusted only the two key catalogs published at /.well-known/. The same recipe runs against your own copy of those catalogs offline, so long as you fetched them while the issuer keys you care about were still active.