Skip to content
ProductGao Developer — Product releases are signed: verify every download against its channel.

Gao ID token verification

Gao ID is the identity your users already have. Your backend trusts a Gao ID token by verifying it against the issuer’s public keys — no call to Gao is needed. Configure two values for this network, plus the audience Gao assigns to your app:

Setting Value on the Product network
Issuer (GAO_ID_ISSUER) https://id.gao.global
Key set (GAO_ID_JWKS_URL) https://id.gao.global/.well-known/jwks.json
Audience (GAO_ID_AUDIENCE) assigned to your app by Gao

Signing users in from your own app’s front end needs Gao to register the app first (its audience and its allowed origin); there is no self-service registration yet, and Gao provides the sign-in details with the registration.

A JWT that is ES256-signed by one of the issuer’s keys, with iss equal to the issuer, aud equal to your audience, a live exp and a non-empty sub, is an authenticated Gao user.

  1. Read Authorization: Bearer … (401 if missing).
  2. Split header.payload.signature; reject alg other than ES256 and typ other than JWT.
  3. Look up kid in the key set (cache it up to 5 minutes; refresh once on a miss).
  4. Verify the ES256 signature over header.payload.
  5. Check iss, aud, a non-empty sub, exp > now, and nbf ≤ now + 30 when present.
  6. Use sub (the Gao ID root id) as your user id.

A dependency-free key loader (Node 20+, Deno, Cloudflare Workers), given the key-set URL above:

const CACHE = { keys: null as Map<string, CryptoKey> | null, fetched: 0 };
async function loadKey(jwksUrl: string, kid: string): Promise<CryptoKey | null> {
if (!CACHE.keys || Date.now() - CACHE.fetched > 5 * 60 * 1000) {
const r = await fetch(jwksUrl);
if (!r.ok) throw new Error(`jwks_http_${r.status}`);
const { keys } = (await r.json()) as { keys: { kty: string; crv: string; x: string; y: string; kid: string }[] };
const out = new Map<string, CryptoKey>();
for (const k of keys) {
if (k.kty !== 'EC' || k.crv !== 'P-256') continue;
out.set(k.kid, await crypto.subtle.importKey('jwk', { kty: 'EC', crv: 'P-256', x: k.x, y: k.y, ext: true },
{ name: 'ECDSA', namedCurve: 'P-256' }, false, ['verify']));
}
CACHE.keys = out; CACHE.fetched = Date.now();
}
return CACHE.keys.get(kid) ?? null;
}