Skip to main content

What You’ll Build

This quickstart walks you through the full offline authorization lifecycle for a Gemma 4 on-device agent:
  1. Create a consent bundle while online (one API call)
  2. Verify grant tokens offline using the JWKS snapshot in the bundle
  3. Log actions to a tamper-evident audit log (hash-chained, Ed25519-signed)
  4. Sync the audit log back to the Grantex cloud when connectivity returns
The entire verification path runs locally with zero network calls.

Prerequisites

  • Node.js 18+ (TypeScript) or Python 3.10+ (Python)
  • A Grantex developer account and API key (sign up free)
  • A registered agent with the scopes your Gemma 4 model needs

Step 1: Install

The consent bundle packages everything the device needs to operate offline: a signed grant token, a JWKS snapshot for signature verification, and an Ed25519 key pair for audit signing.
This is the only step that requires network connectivity. Everything after this runs entirely on-device.

Step 3: Create an Offline Verifier

Load the bundle and create a verifier that uses the embedded JWKS snapshot.

Step 4: Verify a Token Offline

Every time the Gemma 4 agent attempts an action, verify the grant token before allowing it. No network call is made.

Step 5: Create an Offline Audit Log

Every authorized action should be recorded. The audit log is append-only, Ed25519-signed, and hash-chained so tampering is detectable at sync time.

Step 6: Sync When Back Online

When connectivity returns, upload the offline audit entries to the Grantex cloud. The server verifies the hash chain and Ed25519 signatures, then reconciles the entries with the cloud audit log.

Expected Output

Environment Variables

Next Steps

Last modified on April 3, 2026