An app asks one specific person to approve exactly one action, right now. They get a push notification, open a Gipity-hosted page, see what they are approving, and confirm with a passkey (Face ID, Touch ID, Windows Hello, a security key). The approval is short-lived, single-use, and carries a WebAuthn signature from their passkey, so anything outside Gipity (a device at home, a CI job, a door controller) can verify it itself. Even a compromised server can't forge one.

Use it whenever a human must sign off on a specific change before it runs:

Don't build this yourself with WebAuthn in the app's own pages: apps share an origin (app.gipity.ai), so a passkey made there could be used by any other app. The approve page runs on the API host, where no app code runs.

For an automation pausing until its owner clicks approve in an email, a workflow approval step is simpler (see workflow). Passkey approvals are for when the approval itself must be provable.

The flow

  1. A function calls approval.request({ summary, payload, approver }). It returns at once with an id, the payloadHash, the approveUrl and expiresAt.
  2. The approver gets a Gipity Notify push (or an email if they have no push subscription) linking to approveUrl.
  3. They sign in as themselves, read the summary, details and the exact payload, and tap Approve with passkey (or Deny). The first time, the page has them set up a passkey.
  4. Your code reads approval.get(id) (from a function) or GET /api/<appGuid>/approvals/<id> (from outside), checks the proof, and calls consume exactly once before acting.

From a function

# gipity.yaml
functions:
  - name: request-change
    auth: user
    services: ['approval']
  - name: apply-change
    auth: user
    services: ['approval']
// functions/request-change.js
export default async function (ctx, { approval }) {
  const req = await approval.request({
    summary: 'Set boiler to 65C',                 // shown as the heading, max 200 chars
    details: 'Kitchen controller, from the app',  // optional, max 4000 chars
    payload: { cmd: 'set', device: 'boiler', target: 65 }, // the EXACT action, any JSON, max 16 KB
    approver: 'owner',                            // 'owner' (default) or a user guid of this app
    ttlSeconds: 300,                              // 30 to 3600, default 300
  });
  // req = { id, payloadHash, approveUrl, expiresAt, delivery }
  return { id: req.id, approveUrl: req.approveUrl, delivery: req.delivery };
}
// functions/apply-change.js
export default async function (ctx, { approval, crypto }) {
  const { id, payload } = ctx.body;
  const a = await approval.get(id);
  // a = { id, status, summary, payloadHash, expiresAt, approver, resolvedAt, consumedAt, proof }
  if (a.status !== 'approved') return { ok: false, status: a.status };
  // Single use: consume compares the hash in constant time and flips approved -> consumed once.
  const hash = crypto.hash('sha256', canonicalJson(payload));
  if (!(await approval.consume(id, hash))) return { ok: false, status: 'not consumable' };
  // ...now do exactly what payload says...
  return { ok: true };
}

Canonical JSON and the payload hash

payloadHash is the lowercase hex SHA-256 of the canonical JSON of the payload (RFC 8785, JCS): object keys sorted, no whitespace, strings and numbers as JSON.stringify writes them. { "b": 1, "a": [true, null] } becomes {"a":[true,null],"b":1}. A function's own helper:

function canonicalJson(v) {
  if (v === null || typeof v !== 'object') return JSON.stringify(v);
  if (Array.isArray(v)) return '[' + v.map(canonicalJson).join(',') + ']';
  return '{' + Object.keys(v).sort().map(k => JSON.stringify(k) + ':' + canonicalJson(v[k])).join(',') + '}';
}

Python: the registry's device client (examples/python) has canonical_json / payload_hash that match the server byte for byte, and verify_approval runs every check below. Hand-rolled, json.dumps(payload, sort_keys=True, separators=(',', ':'), ensure_ascii=False) matches for ASCII keys, strings, booleans, null and integers. Either way, keep payloads to those (send "65.5" or 655 tenths, not 65.5) so every language hashes the same bytes.

From outside Gipity (devices, CI)

curl -H "X-Api-Key: $KEY" https://a.gipity.ai/api/<appGuid>/approvals/<id>
curl -X POST -H "X-Api-Key: $KEY" -H 'Content-Type: application/json' \
  -d '{"payloadHash":"<hex>"}' https://a.gipity.ai/api/<appGuid>/approvals/<id>/consume

Verify offline (what a device does)

Pin the approver's public key once, out of band: take proof.publicKeyJwk from their first (test) approval, and check its fingerprint with them. The fingerprint is the first 16 hex characters of the key's RFC 7638 JWK thumbprint (sha256 of the required members in sorted order with no whitespace: EC {"crv","kty","x","y"}, OKP {"crv","kty","x"}, RSA {"e","kty","n"}), in groups of four, e.g. feed 9234 487a e4fe. The approver's passkey page lists the fingerprint of each of their passkeys, and gipity approval show prints the one that signed. Gipity emails the approver whenever a passkey is added to or removed from their approvals.

Then, for every approval, before running the action:

  1. Recompute payloadHash from the command you are about to run; it must equal the approval's.
  2. Recompute summaryHash = lowercase hex sha256 of the canonical JSON of {"details": details or null, "summary": summary} (the words the approver read on the page, from the approval you fetched).
  3. Recompute challenge = sha256("gipity-approval:v2|" + id + "|" + payloadHash + "|" + summaryHash + "|" + expiresAt) (raw 32 bytes, UTF-8 input; expiresAt exactly as returned, e.g. 2026-11-18T21:40:00.000Z). This is the WebAuthn challenge the passkey signed.
  4. Decode clientDataJSON: type == "webauthn.get", challenge == base64url(challenge) (no padding), origin == "https://a.gipity.ai".
  5. Decode authenticatorData: the first 32 bytes equal sha256("a.gipity.ai"); the flags byte (offset 32) has UP (0x01) and UV (0x04) set.
  6. Verify signature over authenticatorData || sha256(clientDataJSON) with the pinned key (ES256: ECDSA P-256 + SHA-256, DER signature; also EdDSA and RS256), and check proof.publicKeyJwk is that key.
  7. Check expiresAt is in the future, then consume. Only act if consume succeeds.

Test vector

A real approval the platform produced (software P-256 passkey, expired since). Every value recomputes from the ones above it: payloadHash from payload, summaryHash from summary + details, challenge from id + the two hashes + expiresAt, fingerprint from publicKeyJwk, and signature verifies over authenticatorData || sha256(clientDataJSON) with publicKeyJwk. A verifier in any language should reproduce each one (with now before expiresAt). The same proof is the fixture of gipity approval verify and of the Python device client.

{
  "id": "ap_f6fqnxkk",
  "summary": "Set boiler to 65C",
  "details": "Kitchen controller",
  "payload": {
    "cmd": "set",
    "target": 65,
    "unit": "C"
  },
  "payloadHash": "e5077358c282959159ce2019ee996d068d65bd580a323329cb79f4b9f803b7a3",
  "summaryHash": "420b7a5c41bf256ff007a819a194866b1b27342218da54a93ad443fc1533ff61",
  "expiresAt": "2026-11-18T19:11:03.000Z",
  "challenge": "dMRmST9w94cDZTeh61f3f5uI_lL94NcriT5Nko_UXOo",
  "origin": "https://a.gipity.ai",
  "publicKeyJwk": {
    "kty": "EC",
    "crv": "P-256",
    "x": "mL_dOR6nPZJ-qrnmkV9duae4wibw_7l6efzJtbeaLCw",
    "y": "3zSEhuyO8xQncBqJaesq9VtYFNzn_fRwN9h3lgN5MH8",
    "alg": "ES256"
  },
  "fingerprint": "feed 9234 487a e4fe",
  "authenticatorData": "N4A08rFf6oofD0rATEu86Zw9VoPTEyUl7LLGA6OQvyEFAAAAAQ",
  "clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiZE1SbVNUOXc5NGNEWlRlaDYxZjNmNXVJX2xMOTROY3JpVDVOa29fVVhPbyIsIm9yaWdpbiI6Imh0dHBzOi8vYS5naXBpdHkuYWkiLCJjcm9zc09yaWdpbiI6ZmFsc2V9",
  "signature": "MEUCIQCJ0pgK93EnCSGBaXvI9e5Q9jBYpor5Jmd6uLtI4eXYpgIgf7OkMT0Z4ZEyXZqZrIWO5oVYPSTI-k9s7bRj_amuM-g"
}

Passkeys

Each approver enrolls their own passkeys at https://a.gipity.ai/approvals/passkeys (an app user adds ?app=<appGuid>); the approve page links there when they have none. App users' passkeys belong to them in that app only (an app-user approver signs in on the app's own sign-in page, so the app needs auth: { mode: app } or both). Approving requires user verification (biometric or PIN), and the authenticator's signature counter must move forward, so a cloned key is refused. The page lists each passkey's fingerprint, and adding or removing a passkey emails the person, so a passkey added behind their back doesn't go unnoticed.

The approve page always shows the summary, the details and the full payload (open, not collapsed) before the passkey prompt, so a misleading summary can't hide a different action; the passkey signs all three.

CLI

gipity approval list                       # includes approvals you are the approver of ([..., passkey])
gipity approval show <ap_id>               # status, payload hash, expiry, proof + the fingerprint of the passkey that signed
gipity approval passkeys                   # your passkeys (with fingerprints) + where to add them
gipity approval verify <ap_id> --payload payload.json --key approver-key.jwk

verify runs the offline checks above against the stored proof and exits non-zero if any fails; without --key it uses the proof's own key and says the key wasn't pinned.

Common mistakes