Skip to main content

Swift — raw HTTP today, native package planned

Native client status: PLANNED

There is no published Swift package yet — no SPM coordinates, and no packages/sdk-swift/ directory exists in the repo. Today you get full parity through three real surfaces: the terminal CLI (/cli/), raw HTTP (the wire format below — what every client wraps), and zeq.py (Python — single file, fetched from any node). When a native package ships it will wrap exactly this wire format, so code written against HTTP today won't change semantically.

Get the CLI (recommended first install)

Every node serves the terminal CLI with a sha256-pinned installer — the fastest way onto the framework:

curl -fsSL https://zeqstate.com/install.sh | sh # any node works as the origin
zeq tutorial # guided: account → machine → first compute → verify

Full install notes + the complete command reference: /cli/.

Compute over raw HTTP — Foundation only

URLSession + JSONSerialization, async/await, no third-party dependencies. Drop into a main.swift:

import Foundation

let url = URL(string: "https://zeqapi.com/api/zeq/compute")!
var req = URLRequest(url: url)
req.httpMethod = "POST"
let key = ProcessInfo.processInfo.environment["ZEQ_KEY"] ?? ""
req.setValue("Bearer \(key)", forHTTPHeaderField: "Authorization")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = try JSONSerialization.data(withJSONObject: [
"operators": ["KO42", "QM5", "GR40"],
"domain": "cross",
"inputs": ["t": 0]
])

let (data, _) = try await URLSession.shared.data(for: req)
let out = try JSONSerialization.jsonObject(with: data) as! [String: Any]
print(out["value"] ?? "", out["unit"] ?? "", "±", out["uncertainty"] ?? "")
print("zeqProof:", out["zeqProof"] ?? "")
print("explorer:", out["explorer_url"] ?? "")

Prefer Codable structs for production parsing — the envelope is stable JSON. The public pulse needs no key: GET https://zeqapi.com/api/zeq/pulse.

The response's compliance field is the ZeqCompliance v1 envelope — the 13-standard regulatory record returned on every call. Every result also carries signed — an Ed25519-signed claim (claim + signature + public_key) verifiable offline by anyone, or by POSTing the block to any node's public /api/attest. Or pipe the whole envelope to the CLI: … | zeq verify -.

Why Swift here

  • iOS apps. Drive a SwiftUI view from the envelope; observe the entangled state in real time on a phone.
  • Medical devices on iPad. HIPAA-aligned envelopes paired with on-device biometric attestation; the Embedded C observer agent sits next to the Swift app on a paired peripheral.
  • visionOS spatial workspaces. Compose physics simulations live in 3D with a compute call driving the timeline.

Compose with

Status & source

  • Native Swift package: planned — pending the self-hosted package-registry decision; no package URL is reserved.
  • The wire contract it will wrap is live today and documented in full at HTTP / curl and the API reference.