Swoir is a Swift package for creating and verifying Noir zero-knowledge proofs.
To use Swoir
in your project, add the following to your Package.swift
dependencies:
let package = Package(
name: "YourSwiftProject",
platforms: [ .macOS(.v10_15), .iOS(.v15) ],
// ...
dependencies: [
.package(url: "https://github.com/Swoir/Swoir.git", exact: "1.0.0-beta.0-1")
],
// ...
targets: [
.target(name: "YourSwiftProject", dependencies: ["Swoir"])
]
)
import Foundation
import Swoir
import Swoirenberg
let swoir = Swoir(backend: Swoirenberg.self)
let manifest = URL(fileURLWithPath: "x_not_eq_y.json")
let circuit = try swoir.createCircuit(manifest: manifest)
// Setup the SRS for the circuit
// Must be called before proving or verifying
try circuit.setupSrs()
let proof = try circuit.prove([ "x": 1, "y": 2 ])
let verified = try circuit.verify(proof)
print(verified ? "Verified!" : "Failed to verify")
Ensure x_not_eq_y.json exists in the project root.
- iOS with architectures:
arm64
- macOS with architectures:
arm64
Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.
Licensed under the Apache-2.0 License. See LICENSE for more information.