Skip to main content
Enable Proof of Location in the application’s Proof of Location tab in the developer portal. The caller needs an OfflineID user JWT, an owned profile and App ID. Read the location privacy disclosure before submitting.

Use the SDK

@offline-protocol/pol (0.1.2) submits the commitment and completes the operator witness exchange. It works in React, Next.js and React Native. You supply the App ID, an OfflineID user JWT and the coordinates; the SDK does not sign users in.
The package ships TypeScript source, so a Next.js app must transpile it. Add it to transpilePackages in next.config:
Use pol.location.commit({ claim }) when you need only the onchain commitment, without a witness attestation. A ProofOfLocationProvider and useProofOfLocation hook are available for React, and @offline-protocol/pol/wasm provides an optional WASM client for Next.js, covered by the same transpilePackages entry. Validate the returned attestation as described below before relying on it.

Submit with the raw API

The response is { "message": "...", "data": { ... } }, with operators, id, transaction, commitment and geoHash inside data. A 200 confirms task submission, not witness acceptance. id is the random task ID. See task identifiers for its format and how to match it to an attestation.

Witness exchange

This describes the operator’s raw protocol, which @offline-protocol/pol implements for you. The older identity SDK hooks do not. The operator must have observed and cached the submitted onchain task before handling the exchange.
  1. Connect to a provisioned operator’s WebSocket. Returned URLs can use https://; map that scheme to wss:// (or http:// to ws:// for an approved local test), retaining the host and configured path. Do not pass an HTTPS URL directly to a WebSocket constructor.
  2. Send { "type": "ping", "id": "<data.id>", "claimedLocation": { "lat": 51.5074, "lon": -0.1278 } }.
  3. On { "type": "pong" }, promptly send { "type": "ack" }. The operator measures this round trip.
  4. Read { "type": "attestation", "attestation": ... }. Validate signer, chain, deployment, task, commitment, result and freshness before accepting it. See individual results.
Each witness submits an onchain response, which costs its operator Sepolia gas. A pong is not evidence of acceptance. The exchange can fail if the task is not yet cached, registration is incomplete or transaction submission fails. Set a timeout and surface failure; do not blindly resubmit a commitment after a network timeout.

Released SDK limitations

Use @offline-protocol/pol for Proof of Location. React Native 0.3.3 removes useProofOfLocation and React 0.2.0 removes useLocation. The hooks in older versions omit the required witness id and ignore attestation replies. Do not rely on them for witness evidence. The gateway now maps older SDKs’ x-project-id to X-App-Id. Direct API clients must send X-App-Id as shown above. Hosted usage-limit enforcement is active; header compatibility does not repair the older hooks’ witness exchange.

Handle errors

The API maps other upstream 5xx responses to 502; it does not forward every upstream 500 unchanged.