Skip to main content

Data types

This page defines all shared types referenced by the Verify API and Compute API endpoints.

Input

All compute endpoints accept geometry inputs as a discriminated union. The server resolves the input format automatically.
type Input =
  | GeoJSON.Geometry          // Raw GeoJSON geometry
  | OnchainInput              // Onchain attestation reference
  | OffchainInput             // Offchain attestation reference (not yet implemented)
  | VerifiedProofInput;       // Verified location proof
The SDK accepts bare UID strings (e.g., "0xabc123...") and normalizes them to OnchainInput before sending to the API. When calling the API directly, always use the { uid: string } object form.

RawGeometryInput

A standard GeoJSON geometry object:
{
  "type": "Point",
  "coordinates": [2.2945, 48.8584]
}

OnchainInput

A reference to an onchain EAS attestation:
{
  "uid": "0xabc123..."
}

OffchainInput

Not yet implemented. Planned for a future release.
A reference to an offchain attestation stored on IPFS or another URI-addressable store:
{
  "uid": "0xabc...",
  "uri": "ipfs://Qm..."
}

VerifiedProofInput

A previously verified location proof, used to chain proof verification with compute operations. Pass the full VerifiedLocationProofResponse object returned by POST /verify/v0/proof:
interface VerifiedProofInput {
  verifiedProof: VerifiedLocationProofResponse;
}
{
  "verifiedProof": {
    "proof": { "..." : "..." },
    "credibility": { "..." : "..." },
    "evaluationMethod": "multifactor-v0",
    "evaluatedAt": 1706961600
  }
}

LocationClaim

A claim that a subject was at a location during a time window. Extends Location Protocol v0.2.
interface LocationClaim {
  lpVersion: string;              // "0.2"
  locationType: string;           // "geojson-point", "h3-index", etc.
  location: GeoJSON.Geometry;     // The asserted location
  srs: string;                    // Spatial reference system URI

  subject: SubjectIdentifier;     // Who is making the claim
  radius: number;                 // Meters — required
  time: {
    start: number;                // Unix timestamp (seconds)
    end: number;
  };
  eventType?: string;             // "presence", "transaction", "delivery"
}

LocationStamp

Evidence from a single proof-of-location system — one observation. Uses LP format for the observed location.
interface LocationStamp {
  lpVersion: string;
  locationType: string;
  location: GeoJSON.Geometry;     // The OBSERVED location
  srs: string;

  temporalFootprint: {
    start: number;                // Unix timestamp (seconds)
    end: number;
  };

  plugin: string;                 // "proofmode", "witnesschain", "mock"
  pluginVersion: string;
  signals: Record<string, unknown>;
  signatures: Signature[];
}

LocationProof

A claim bundled with one or more stamps.
interface LocationProof {
  claim: LocationClaim;
  stamps: LocationStamp[];
}

SubjectIdentifier

Identifies the subject of a claim. Follows a scheme/value pattern similar to DIDs.
interface SubjectIdentifier {
  scheme: string;   // "eth-address" | "device-pubkey" | "did:web"
  value: string;
}
Examples:
{ "scheme": "eth-address", "value": "0x1234..." }
{ "scheme": "device-pubkey", "value": "0xabcd..." }

Signature

A cryptographic signature on a stamp.
interface Signature {
  signer: SubjectIdentifier;
  algorithm: string;              // "secp256k1" | "ed25519"
  value: string;                  // Hex-encoded
  timestamp: number;              // Unix timestamp (seconds)
}

CredibilityVector

Multidimensional assessment of how well stamps support a claim. Returned by POST /verify/v0/proof.
interface CredibilityVector {
  dimensions: {
    spatial: {
      meanDistanceMeters: number;
      maxDistanceMeters: number;
      withinRadiusFraction: number;     // 0-1
    };
    temporal: {
      meanOverlap: number;              // 0-1
      minOverlap: number;               // 0-1
      fullyOverlappingFraction: number; // 0-1
    };
    validity: {
      signaturesValidFraction: number;  // 0-1
      structureValidFraction: number;   // 0-1
      signalsConsistentFraction: number; // 0-1
    };
    independence: {
      uniquePluginRatio: number;        // 0-1
      spatialAgreement: number;         // 0-1
      pluginNames: string[];
    };
  };
  stampResults: StampResult[];
  meta: {
    stampCount: number;
    evaluatedAt: number;                // Unix timestamp (seconds)
    evaluationMode: 'local' | 'tee' | 'zk';
  };
}

StampResult

Per-stamp verification result within a CredibilityVector.
interface StampResult {
  stampIndex: number;
  plugin: string;
  signaturesValid: boolean;
  structureValid: boolean;
  signalsConsistent: boolean;
  distanceMeters: number;         // Distance from stamp to claim location
  temporalOverlap: number;       // 0-1
  withinRadius: boolean;
  details: Record<string, unknown>; // Plugin-specific
}

AttestationData

EAS attestation data returned by compute endpoints.
interface AttestationData {
  schema: string;                 // Schema UID
  attester: string;               // Attester address
  recipient: string;              // Recipient address
  data: string;                   // ABI-encoded attestation data
  revocable: boolean;             // Whether the attestation can be revoked
  refUID: string;                 // Referenced attestation UID (zero bytes if none)
  signature: string;              // Hex-encoded signature
}
The verify proof endpoint returns an extended attestation that also includes uid, time, expirationTime, and revocationTime. See VerifiedLocationProofResponse for details.

DelegatedAttestationData

Signature and metadata for submitting a delegated attestation onchain.
interface DelegatedAttestationData {
  signature: string;              // Hex-encoded EIP-712 signature
  attester: string;               // Attester address
  deadline: number;               // Unix timestamp — signature expiry
  nonce: number;                  // Attester nonce for replay protection
}

NumericComputeResponse

Response shape for compute operations that return a number (distance, area, length).
interface NumericComputeResponse {
  result: number;
  units: string;                  // "meters", "square_meters"
  operation: string;
  timestamp: number;
  inputRefs: string[];
  attestation: AttestationData;
  delegatedAttestation: DelegatedAttestationData;
}

BooleanComputeResponse

Response shape for compute operations that return true/false (contains, within, intersects).
interface BooleanComputeResponse {
  result: boolean;
  operation: string;
  timestamp: number;
  inputRefs: string[];
  attestation: AttestationData;
  delegatedAttestation: DelegatedAttestationData;
}

VerifiedLocationProofResponse

Response shape for POST /verify/v0/proof.
interface VerifiedLocationProofResponse {
  proof: LocationProof;
  credibility: CredibilityVector;
  evaluationMethod: string;
  evaluatedAt: number;            // Unix timestamp (seconds)
  attestation?: {
    uid: string;                  // Attestation UID
    schema: string;
    attester: string;
    recipient: string;
    data: string;
    revocable: boolean;
    refUID: string;
    time: number;                 // Attestation creation time
    expirationTime: number;       // 0 = no expiration
    revocationTime: number;       // 0 = not revoked
    signature?: string;
  };
  delegatedAttestation?: DelegatedAttestationData;
  chainId?: number;
}