Home

Awesome

Swoir

Version Noir Swift 5 License: Apache-2.0

Swoir is a Swift package for creating and verifying Noir zero-knowledge proofs.

Getting Started

Swift Package Manager

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"])
    ]
)

Usage

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.

Architectures

Authors

Contributing

Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.

License

Licensed under the Apache-2.0 License. See LICENSE for more information.