# Verify a GradiumOS Signal yourself

A GradiumOS **Signal** is an Ed25519-signed statement of assessed competence.
You do **not** have to trust GradiumOS's "valid yes" answer — you can check the signature yourself, in 30
seconds, against the public key we publish. That is the whole point of the standard.

## What you're verifying

1. **The public key** is published as a JWKS at
   `https://verify.veranox.in/.well-known/jwks.json` (CORS-open — a browser can fetch it).
2. **The signed proof** for any Signal is at
   `https://verify.veranox.in/api/v1/signal/proof?token=<GOS code>` — it returns the exact
   bytes that were signed (`canonical`), the `signature`, and the key id (`kid`). It carries **no personal
   data** — the learner is a one-way pseudonym; there is no name, email, or contact.
3. These scripts fetch both and verify the Ed25519 signature **locally**. If `signature valid : true`, the
   Signal was issued by the holder of the GradiumOS signing key and has not been altered by a single byte.

## What a signature proves — and what it cannot

**A signature proves issuance and integrity. It cannot prove current validity. Revocation is a
server-checked property.**

The signed claim carries a `status` field, and that field is the status *at the moment of issuance*. It has
to be: those exact bytes are what the signature covers, so revoking a Signal cannot rewrite them without
destroying the proof that makes it checkable at all. A revoked Signal therefore has a perfectly valid
signature over a claim that still reads `"status": "active"`.

The live answer is the proof wrapper's `state` field — `valid` | `revoked` | `expired` | `tampered` — which
comes from a lookup in the GradiumOS database. Both scripts print both statuses, label which is which, and
print an unmissable warning when they disagree:

```
live status (server)   : revoked
status inside the claim: active  (as at issuance — the signature freezes it)

!!! THE TWO STATUSES DISAGREE: server says "revoked", the signed
!!! claim says "active". THE SERVER IS RIGHT ABOUT CURRENT VALIDITY.
!!! DO NOT ACCEPT THIS CREDENTIAL.
```

Both scripts exit non-zero unless the signature checks out **and** the server reports `valid`. If you write
your own verifier, check both — **a signature check alone will validate a revoked credential.**

Verifying revocation without contacting a server is not possible with signatures alone; it needs a published
revocation list or short-lived credentials, and GradiumOS ships neither today. We would rather say that than
let the word "independent" carry a promise it cannot keep.

## Run it

**Node (no dependencies, Node ≥ 18):**
```bash
node verify.mjs "GOS·SIOSA·BCAML·26·0012·STEKY"
```

**Python (`pip install cryptography`):**
```bash
python verify.py "GOS·SIOSA·BCAML·26·0012·STEKY"
```

Expected output for a valid Signal:
```
kid                    : prod-…
signature valid        : true
live status (server)   : valid
status inside the claim: active  (as at issuance — the signature freezes it)

WHAT THIS PROVES : the signature proves ISSUANCE and INTEGRITY …

signed claim     : { … the signed competence claim … }
```

Tamper with one character of the code and re-run — it is rejected: the altered code resolves to no
issued Signal. And because the signature covers the exact `canonical` bytes, any alteration of an issued
Signal's content would make `signature valid` print `false`.

## Why this matters

- **No trust in our server's verdict on the maths.** The cryptography is checked on your machine against a
  key you can pin and audit. Whether a Signal is still live is a separate question and needs us — see above.
- **Tamper-evident.** Any change to the claim breaks the signature.
- **Privacy-preserving.** The default public check (`/api/v1/signal/verify`) returns only competence *bands*;
  this full proof is opt-in (the holder shares the code) and still exposes no identity.
- **Portable.** ~50 lines, two languages, no framework. Adapt it to your own stack.

## The signature scheme

- Algorithm: **Ed25519** (EdDSA over Curve25519).
- Signed message: the `canonical` field — a stable-ordered JSON serialisation of the competence claim.
- Key discovery: match the proof's `kid` against a key in the JWKS; keys rotate, and retired keys remain
  published so previously-issued Signals keep verifying.

Questions or an issue with verification? Open an issue or contact Veranox Systems.
