% chapa explain --verification
Badge verification
Chapa badges marked Verified metrics link to a v7 receipt token. The token lets anyone confirm that Chapa recorded the score receipt behind the badge and that the receipt has not changed since. Badges marked Public metrics do not claim cryptographic attestation. Here is exactly what verification checks and what it does not.
Why verification exists
Chapa badges are embeddable SVGs that live on READMEs, portfolios and resumes. Because they display outside of Chapa, anyone could edit an SVG to inflate a score, change an archetype or fabricate metrics. The receipt token lets anyone compare a badge with the receipt that Chapa recorded.
Each badge marked Verified metrics shows a short receipt reference on its right edge, for example v7.1a2b3c4d.5e6f7a8b. The share page links to the complete token. Anyone can open that link or paste the complete token into the form at the top of this page to see the recorded receipt and its verification states.
How it works
The token is generated using HMAC-SHA256, a widely used, industry-standard message authentication code. The process has three steps:
- Record the receipt: when Chapa scores a registered developer, it records an immutable receipt revision with the policy, the observation window, the inputs, the score, the dimensions and optional Craft. The receipt is serialized as canonical JSON, so the same receipt always produces the same bytes.
- Sign the complete receipt: Chapa signs the complete canonical receipt bytes with a secret key that only the Chapa server knows. The result is a full 256-bit HMAC of 64 hexadecimal characters. Nothing is truncated.
- Build the token: the token is v7.<revision UUID>.<64-character HMAC>. The revision UUID identifies one immutable receipt revision. A later rescore creates a new revision with a new token.
Receipts are stored durably and do not expire on a timer. They remain until scoring withdrawal or account deletion. To verify, anyone can look up the token, read the recorded receipt and compare it with what the badge displays.
What the receipt contains
The signature covers the complete receipt, not a selection of badge fields. The main parts are:
| Part | Example | Why it matters |
|---|---|---|
| Policy | v7.5 | Identifies the scoring rules that produced the score |
| Revision | Revision UUID and number | Identifies one immutable receipt; a rescore creates a new revision |
| Observation window | 365 days ending 2026-10-11 | Binds the score to a fixed period |
| Inputs | Recorded activity and outcome aggregates | Lets anyone replay the arithmetic offline |
| Score | Band, composite and dimensions | The headline values that the badge displays |
| Craft | Optional and separate from the core score | Included when a valid report exists |
| Coverage and limitations | Classified coverage and exclusions | Records what the evidence does not cover |
Receipts use canonical JSON serialization, and the envelope also records a SHA-256 content hash. The same receipt always produces the same bytes, so the signature can be checked again later with the same key.
What it guarantees
- Receipt integrity: if any part of the recorded receipt changes, the signature no longer matches and signature authentication fails.
- Authenticity: only the Chapa server can produce a valid signature, because only it knows the signing key. The result reports whether the signature authenticated with the available key.
- Separate verification states: the result reports each state separately: whether Chapa recorded the issuance, whether the signature authenticated, and that the arithmetic can be replayed offline from the public aggregates. It also shows whether the revision is current, superseded or retracted.
What it does not guarantee
Transparency means being honest about limitations too:
- Not a blockchain: receipts are stored in the Chapa database, not on a public ledger. Verification depends on Chapa records and the Chapa signing key. A revoked revision has no retrievable receipt, and its tombstone does not authenticate a supplied signature.
- Trust in the sources: a valid signature proves that Chapa recorded this receipt. It does not independently prove that the source evidence is accurate, and it does not prove software quality or causal impact. Chapa trusts its linked platforms (GitHub, Bitbucket, Codeberg and GitLab) as data sources.
- Not tamper-proof at the SVG level: anyone can edit an SVG file. The lookup does not inspect an SVG, and an edited badge that keeps the original link still returns the original receipt. Compare the badge with the recorded receipt.
How to verify a badge
- Open the badge share page and follow its verification link, or copy the complete v7 token from it. The short reference on the badge edge is not a complete token.
- Paste the complete token into the form at the top of this page.
- The result shows the verification states and the recorded receipt. Compare the receipt with what the badge displays.
You can also use the API directly: GET /api/verify/<hash> returns a JSON response with the verification states and the receipt envelope. A retired v6 hexadecimal code returns HTTP 410. Rate-limited to 30 requests per minute per IP.
Design decisions
| Decision | Rationale |
|---|---|
| HMAC-SHA256 | Industry standard, widely audited, and supported natively in Node.js. Security relies on key secrecy, not algorithm secrecy. |
| Full 256-bit signature | The token carries the complete HMAC. The badge prints only a short reference; the link carries the full token. |
| Signature over the complete receipt | Every recorded part is covered, including the inputs and optional Craft, so the arithmetic can be replayed and checked. |
| Immutable revisions | A rescore creates a new revision instead of changing an old one. An old token shows as superseded, not as invalid. |
| Separate states | Recorded issuance, signature authentication and arithmetic replay are reported separately, so one result never claims more than it checked. |