diff --git a/.gitignore b/.gitignore index d792139..ca18e8c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb -*.run \ No newline at end of file +*.run +*.a +*.so \ No newline at end of file diff --git a/README.md b/README.md index bc0e6a8..431f4f7 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ Bridge the gap between Swift and the `noir_rs` library, offering Swift developer - ๐ŸŒ‰ Effortless interfacing between Swift and Rust. - ๐Ÿ”’ Secure zkSNARK proof generation and verification. -## ๐Ÿ“ฆ Build +## ๐Ÿ“ฆ Rust Build ```bash cargo build ``` -## ๐Ÿงช Testing +## ๐Ÿงช Rust Testing Ensure the reliability and robustness of your bridge with the provided tests: @@ -27,6 +27,23 @@ Ensure the reliability and robustness of your bridge with the provided tests: cargo test ``` +## ๐Ÿ“ฆ Swift Build + +```bash +# copy barretenberg lib to the swift directory +cp target/debug/build/barretenberg-/out/lib/libbarretenberg.a swift/ +# copy noir_swift lib to the swift directory +cp target/debug/libnoir_swift.a swift/ + +cd swift + +# compile swift project +./build + +# run the program +./main.run +``` + ## ๐ŸŽฏ Quick Usage We provide two main functions for the bridge: @@ -35,8 +52,13 @@ We provide two main functions for the bridge: 2. **verify_swift**: Verifies a given zkSNARK proof against a circuit and its verification key. ```rust -fn prove_swift(circuit_bytecode: String, initial_witness_vec_raw: Vec) -> Result -fn verify_swift(circuit_bytecode: String, proof: Proof) -> Result +pub struct Proof { + pub proof: Vec, + pub verification_key: Vec, +} + +fn prove_swift(circuit_bytecode: String, initial_witness_vec_raw: Vec) -> Option; +fn verify_swift(circuit_bytecode: String, proof: Proof) -> Option; ``` ## ๐Ÿ” Example diff --git a/swift/build.sh b/swift/build.sh index 4d32d3d..f0d91e4 100755 --- a/swift/build.sh +++ b/swift/build.sh @@ -1 +1 @@ -swiftc -L ../target/debug/ -lnoir_swift -lbarretenberg -lstdc++ -lssl -lcrypto -import-objc-header bridging-header.h main.swift ../generated/noir_swift/noir_swift.swift ../generated/SwiftBridgeCore.swift -o main.run \ No newline at end of file +swiftc -L . -lnoir_swift -lbarretenberg -lstdc++ -lssl -lcrypto -import-objc-header bridging-header.h main.swift ../generated/noir_swift/noir_swift.swift ../generated/SwiftBridgeCore.swift -o main.run \ No newline at end of file