Swift end-to-end
This guide uses the Verity Swift SDK, which wraps the shared Verity dispatcher and the ProveKit backend for iOS.
Package declaration
Section titled “Package declaration”dependencies: [ .package(url: "https://github.com/atheonxyz/verity", from: "0.3.2")],targets: [ .target(name: "MyApp", dependencies: [ .product(name: "Verity", package: "verity") ])]The from: "0.3.2" resolution uses the SDK’s published binary xcframework — no local build required.
Minimal flow
Section titled “Minimal flow”import Verity
let verity = try Verity(backend: .provekit)
let prover = try verity.loadProver(from: "scheme.pkp")let verifier = try verity.loadVerifier(from: "scheme.pkv")
let witness = Witness(values: ["age": "25", "threshold": "18"])let proof = try prover.prove(witness: witness)
let valid = try verifier.verify(proof: proof)precondition(valid, "proof did not verify")
prover.close()verifier.close()Use loadProver(data:) and loadVerifier(data:) when the app downloads or bundles artifacts as Data. Witness accepts a [String: String] of field-element strings, a TOML path, or a JSON string, whichever shape your inputs already have.
Integration notes
Section titled “Integration notes”- Call ProveKit’s memory configuration before constructing
Veritywhen the app needs mobile RAM limits or file-backed memory. prover.close()andverifier.close()release the underlying native handles. Always call them on cleanup paths (defer { … }or scope-bound wrappers); the wrappingVerityinstance does not auto-release them.