diff --git a/anon-aadhaar-react-native.podspec b/anon-aadhaar-react-native.podspec index 15e8e76..9c05dfa 100644 --- a/anon-aadhaar-react-native.podspec +++ b/anon-aadhaar-react-native.podspec @@ -18,6 +18,7 @@ Pod::Spec.new do |s| s.public_header_files = 'ios/*.h' s.vendored_libraries = "ios/libmopro_ffi.a" s.preserve_paths = 'ios/moproFFI.modulemap' + s.resource = 'ios/anonAadhaar.dylib' # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0. # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79. diff --git a/example/ios/ReactNativeExample.xcodeproj/project.pbxproj b/example/ios/ReactNativeExample.xcodeproj/project.pbxproj index 50c8a2c..bd81031 100644 --- a/example/ios/ReactNativeExample.xcodeproj/project.pbxproj +++ b/example/ios/ReactNativeExample.xcodeproj/project.pbxproj @@ -8,14 +8,12 @@ /* Begin PBXBuildFile section */ 00E356F31AD99517003FC87E /* ReactNativeExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNativeExampleTests.m */; }; + 08F8029BF4CCDB71FE4E05C2 /* libPods-ReactNativeExample-ReactNativeExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 95C513C94EFE9B2A8E4E7231 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */; }; 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 5CBE2F9E5A3A40A198E144D6 /* libPods-ReactNativeExample-ReactNativeExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3244D48D6B5A8E71CD5521F /* libPods-ReactNativeExample-ReactNativeExampleTests.a */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; - AF89FCDE3CDA74F44CA75B94 /* libPods-ReactNativeExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AC4316F0237B2E324D7EFA1 /* libPods-ReactNativeExample.a */; }; - E6814FEE2B8D003C00899640 /* aadhaar-verifier.wasm in Resources */ = {isa = PBXBuildFile; fileRef = E6814FED2B8D003C00899640 /* aadhaar-verifier.wasm */; }; - E6814FF02B8D005F00899640 /* aadhaar-verifier.r1cs in Resources */ = {isa = PBXBuildFile; fileRef = E6814FEF2B8D005F00899640 /* aadhaar-verifier.r1cs */; }; + 91E1787BCDE8E86417A34746 /* libPods-ReactNativeExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 812A16FF5323627D56542DA9 /* libPods-ReactNativeExample.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -28,6 +26,19 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + E625A2F02B98A58E00B5A0EF /* Embed Libraries */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Libraries"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 00E356EE1AD99517003FC87E /* ReactNativeExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactNativeExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -38,16 +49,15 @@ 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ReactNativeExample/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNativeExample/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ReactNativeExample/main.m; sourceTree = ""; }; - 2920AC50B410D4C2F83798F1 /* Pods-ReactNativeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample.release.xcconfig"; sourceTree = ""; }; - 2AC4316F0237B2E324D7EFA1 /* libPods-ReactNativeExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 4F6CC4A53DDFD68F6254DB3C /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig"; sourceTree = ""; }; + 36EA9A4F17E2B653FCCD3577 /* Pods-ReactNativeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample.debug.xcconfig"; sourceTree = ""; }; + 3C5642208B9987584639C712 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig"; sourceTree = ""; }; + 78B2221A54921C64162B7B49 /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig"; sourceTree = ""; }; + 812A16FF5323627D56542DA9 /* libPods-ReactNativeExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ReactNativeExample/LaunchScreen.storyboard; sourceTree = ""; }; - A55AEA2AE1BA5A4D7F3E761D /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig"; sourceTree = ""; }; - C3244D48D6B5A8E71CD5521F /* libPods-ReactNativeExample-ReactNativeExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeExample-ReactNativeExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - E6814FED2B8D003C00899640 /* aadhaar-verifier.wasm */ = {isa = PBXFileReference; lastKnownFileType = file; name = "aadhaar-verifier.wasm"; path = "../../../../mopro/mopro-core/examples/circom/anonAadhaar/target/aadhaar-verifier_js/aadhaar-verifier.wasm"; sourceTree = ""; }; - E6814FEF2B8D005F00899640 /* aadhaar-verifier.r1cs */ = {isa = PBXFileReference; lastKnownFileType = file; name = "aadhaar-verifier.r1cs"; path = "../../../../mopro/mopro-core/examples/circom/anonAadhaar/target/aadhaar-verifier.r1cs"; sourceTree = ""; }; + 95C513C94EFE9B2A8E4E7231 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeExample-ReactNativeExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + DA4B1BB8E4374D3F68C96DCF /* Pods-ReactNativeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample.release.xcconfig"; sourceTree = ""; }; + E625A2E42B98A11600B5A0EF /* libanon-aadhaar-react-native.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libanon-aadhaar-react-native.a"; sourceTree = BUILT_PRODUCTS_DIR; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - FA7FA5E42D55FA84143DC84C /* Pods-ReactNativeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -55,7 +65,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5CBE2F9E5A3A40A198E144D6 /* libPods-ReactNativeExample-ReactNativeExampleTests.a in Frameworks */, + 08F8029BF4CCDB71FE4E05C2 /* libPods-ReactNativeExample-ReactNativeExampleTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -63,7 +73,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AF89FCDE3CDA74F44CA75B94 /* libPods-ReactNativeExample.a in Frameworks */, + 91E1787BCDE8E86417A34746 /* libPods-ReactNativeExample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -103,9 +113,10 @@ 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { isa = PBXGroup; children = ( + E625A2E42B98A11600B5A0EF /* libanon-aadhaar-react-native.a */, ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - 2AC4316F0237B2E324D7EFA1 /* libPods-ReactNativeExample.a */, - C3244D48D6B5A8E71CD5521F /* libPods-ReactNativeExample-ReactNativeExampleTests.a */, + 812A16FF5323627D56542DA9 /* libPods-ReactNativeExample.a */, + 95C513C94EFE9B2A8E4E7231 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */, ); name = Frameworks; sourceTree = ""; @@ -120,8 +131,6 @@ 83CBB9F61A601CBA00E9B192 = { isa = PBXGroup; children = ( - E6814FEF2B8D005F00899640 /* aadhaar-verifier.r1cs */, - E6814FED2B8D003C00899640 /* aadhaar-verifier.wasm */, 13B07FAE1A68108700A75B9A /* ReactNativeExample */, 832341AE1AAA6A7D00B99B32 /* Libraries */, 00E356EF1AD99517003FC87E /* ReactNativeExampleTests */, @@ -146,10 +155,10 @@ BBD78D7AC51CEA395F1C20DB /* Pods */ = { isa = PBXGroup; children = ( - FA7FA5E42D55FA84143DC84C /* Pods-ReactNativeExample.debug.xcconfig */, - 2920AC50B410D4C2F83798F1 /* Pods-ReactNativeExample.release.xcconfig */, - 4F6CC4A53DDFD68F6254DB3C /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */, - A55AEA2AE1BA5A4D7F3E761D /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */, + 36EA9A4F17E2B653FCCD3577 /* Pods-ReactNativeExample.debug.xcconfig */, + DA4B1BB8E4374D3F68C96DCF /* Pods-ReactNativeExample.release.xcconfig */, + 3C5642208B9987584639C712 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */, + 78B2221A54921C64162B7B49 /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -161,12 +170,12 @@ isa = PBXNativeTarget; buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNativeExampleTests" */; buildPhases = ( - F14F8926D14072803857FA92 /* [CP] Check Pods Manifest.lock */, + 65E9D36A4722E476691F1EA7 /* [CP] Check Pods Manifest.lock */, 00E356EA1AD99517003FC87E /* Sources */, 00E356EB1AD99517003FC87E /* Frameworks */, 00E356EC1AD99517003FC87E /* Resources */, - D21ECC0418064810A840A8B1 /* [CP] Embed Pods Frameworks */, - AE98FAE663E09650DABAAE06 /* [CP] Copy Pods Resources */, + 3644794F8BD1C75DF0D6DF30 /* [CP] Embed Pods Frameworks */, + 2991A7A68412CA649982F81E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -182,13 +191,14 @@ isa = PBXNativeTarget; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeExample" */; buildPhases = ( - DFB94E4BCC5DFCD13B4BB097 /* [CP] Check Pods Manifest.lock */, + ED04D11263FDD66A593C3D25 /* [CP] Check Pods Manifest.lock */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - 71A9E10DE6676E96B3D3EDF1 /* [CP] Embed Pods Frameworks */, - 6012FBC683FC8D2E4D0F0F95 /* [CP] Copy Pods Resources */, + E625A2F02B98A58E00B5A0EF /* Embed Libraries */, + A1696DB46DCA13DBE247AFDB /* [CP] Embed Pods Frameworks */, + 245F01F6DA4EF26EC41FF96D /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -249,8 +259,6 @@ files = ( 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - E6814FEE2B8D003C00899640 /* aadhaar-verifier.wasm in Resources */, - E6814FF02B8D005F00899640 /* aadhaar-verifier.r1cs in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -273,7 +281,7 @@ shellPath = /bin/sh; shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; }; - 6012FBC683FC8D2E4D0F0F95 /* [CP] Copy Pods Resources */ = { + 245F01F6DA4EF26EC41FF96D /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -290,24 +298,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 71A9E10DE6676E96B3D3EDF1 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - AE98FAE663E09650DABAAE06 /* [CP] Copy Pods Resources */ = { + 2991A7A68412CA649982F81E /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -324,7 +315,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - D21ECC0418064810A840A8B1 /* [CP] Embed Pods Frameworks */ = { + 3644794F8BD1C75DF0D6DF30 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -341,7 +332,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - DFB94E4BCC5DFCD13B4BB097 /* [CP] Check Pods Manifest.lock */ = { + 65E9D36A4722E476691F1EA7 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -356,14 +347,31 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ReactNativeExample-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-ReactNativeExample-ReactNativeExampleTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - F14F8926D14072803857FA92 /* [CP] Check Pods Manifest.lock */ = { + A1696DB46DCA13DBE247AFDB /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + ED04D11263FDD66A593C3D25 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -378,7 +386,7 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ReactNativeExample-ReactNativeExampleTests-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-ReactNativeExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -418,7 +426,7 @@ /* Begin XCBuildConfiguration section */ 00E356F61AD99517003FC87E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4F6CC4A53DDFD68F6254DB3C /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */; + baseConfigurationReference = 3C5642208B9987584639C712 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -445,7 +453,7 @@ }; 00E356F71AD99517003FC87E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A55AEA2AE1BA5A4D7F3E761D /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */; + baseConfigurationReference = 78B2221A54921C64162B7B49 /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; @@ -469,7 +477,7 @@ }; 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FA7FA5E42D55FA84143DC84C /* Pods-ReactNativeExample.debug.xcconfig */; + baseConfigurationReference = 36EA9A4F17E2B653FCCD3577 /* Pods-ReactNativeExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; @@ -498,7 +506,7 @@ }; 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2920AC50B410D4C2F83798F1 /* Pods-ReactNativeExample.release.xcconfig */; + baseConfigurationReference = DA4B1BB8E4374D3F68C96DCF /* Pods-ReactNativeExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; diff --git a/example/src/App.tsx b/example/src/App.tsx index 3e648eb..74dfb85 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -129,7 +129,7 @@ export default function App() { /> {isQrScanned && sigVerified && ( - QR Code Scanned and signature verified ✅. + QR Code Scanned and signature verified ✅ )} Void { -// guard let wasmPath = Bundle.main.path(forResource: "aadhaar-verifier", ofType: "wasm"), -// let r1csPath = Bundle.main.path(forResource: "aadhaar-verifier", ofType: "r1cs") else { -// reject("E_FILE_NOT_FOUND", "Could not find files in bundle.", nil) -// return -// } - -// do { -// let _ = try moproCircom.setup(wasmPath: wasmPath, r1csPath: r1csPath) -// resolve(true) -// } catch let error { -// reject("E_SETUP", "Setup failed: \(error.localizedDescription)", error) -// } -// } - -// @objc(generateProof:resolver:rejecter:) -// func generateProof(circuitInputs: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { -// do { -// let inputs = circuitInputs as! [String: [String]] -// let result = try moproCircom.generateProof(circuitInputs: inputs) - -// let proofBase64 = result.proof.base64EncodedString() -// let inputsBase64 = result.inputs.base64EncodedString() - -// let resultDict = ["proof": proofBase64, "inputs": inputsBase64] - -// resolve(resultDict) -// } catch let error { -// reject("E_GENERATE_PROOF", "Proof generation failed: \(error.localizedDescription)", error) -// } -// } - -// @objc(verifyProof:publicInput:resolver:rejecter:) -// func verifyProof(proof: String, publicInput: String, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { -// do { -// guard let proofData = Data(base64Encoded: proof), -// let inputData = Data(base64Encoded: publicInput) else { -// reject("E_INVALID_ARGS", "Invalid argument format for proof or publicInput", nil) -// return -// } - -// let isValid = try moproCircom.verifyProof(proof: proofData, publicInput: inputData) -// resolve(isValid) -// } catch let error { -// reject("E_VERIFY_PROOF", "Proof verification failed: \(error.localizedDescription)", error) -// } -// } - - -// @objc static func requiresMainQueueSetup() -> Bool { -// return false -// } -// } - @objc(MoproCircomBridge) class MoproCircomBridge: NSObject { @objc(initialize:rejecter:) func initialize(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { do { - try initializeMopro() + // Search for the dylib in all bundles (main bundle and all frameworks) + let allBundles = Bundle.allFrameworks + [Bundle.main] + guard let dylibPath = allBundles.first(where: { $0.path(forResource: "anonAadhaar", ofType: "dylib") != nil })?.path(forResource: "anonAadhaar", ofType: "dylib") else { + reject("E_NO_DYLIB", "Could not find anonAadhaar.dylib in any bundle.", nil) + return + } + + // Now that we have the path, initialize the dylib with it + try initializeMoproDylib(dylibPath: dylibPath) resolve(true) } catch let error { reject("E_INITIALIZE", "Initialization failed: \(error.localizedDescription)", error) } } + @objc(generateProof:resolver:rejecter:) func generateProof(circuitInputs: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { @@ -513,9 +458,11 @@ class MoproCircomBridge: NSObject { } } + + public protocol MoproCircomProtocol { func generateProof(circuitInputs: [String: [String]]) throws -> GenerateProofResult - func setup(wasmPath: String, r1csPath: String) throws -> SetupResult + func initialize(arkzkeyPath: String, wasmPath: String) throws func verifyProof(proof: Data, publicInput: Data) throws -> Bool } @@ -555,16 +502,14 @@ public class MoproCircom: MoproCircomProtocol { ) } - public func setup(wasmPath: String, r1csPath: String) throws -> SetupResult { - return try FfiConverterTypeSetupResult.lift( - try + public func initialize(arkzkeyPath: String, wasmPath: String) throws { + try rustCallWithError(FfiConverterTypeMoproError.lift) { - uniffi_mopro_ffi_fn_method_moprocircom_setup(self.pointer, - FfiConverterString.lower(wasmPath), - FfiConverterString.lower(r1csPath),$0 + uniffi_mopro_ffi_fn_method_moprocircom_initialize(self.pointer, + FfiConverterString.lower(arkzkeyPath), + FfiConverterString.lower(wasmPath),$0 ) } - ) } public func verifyProof(proof: Data, publicInput: Data) throws -> Bool { @@ -624,15 +569,13 @@ public struct BenchmarkResult { public var numMsm: UInt32 public var avgProcessingTime: Double public var totalProcessingTime: Double - public var allocatedMemory: UInt32 // Default memberwise initializers are never public by default, so we // declare one manually. - public init(numMsm: UInt32, avgProcessingTime: Double, totalProcessingTime: Double, allocatedMemory: UInt32) { + public init(numMsm: UInt32, avgProcessingTime: Double, totalProcessingTime: Double) { self.numMsm = numMsm self.avgProcessingTime = avgProcessingTime self.totalProcessingTime = totalProcessingTime - self.allocatedMemory = allocatedMemory } } @@ -648,9 +591,6 @@ extension BenchmarkResult: Equatable, Hashable { if lhs.totalProcessingTime != rhs.totalProcessingTime { return false } - if lhs.allocatedMemory != rhs.allocatedMemory { - return false - } return true } @@ -658,7 +598,6 @@ extension BenchmarkResult: Equatable, Hashable { hasher.combine(numMsm) hasher.combine(avgProcessingTime) hasher.combine(totalProcessingTime) - hasher.combine(allocatedMemory) } } @@ -668,8 +607,7 @@ public struct FfiConverterTypeBenchmarkResult: FfiConverterRustBuffer { return try BenchmarkResult( numMsm: FfiConverterUInt32.read(from: &buf), avgProcessingTime: FfiConverterDouble.read(from: &buf), - totalProcessingTime: FfiConverterDouble.read(from: &buf), - allocatedMemory: FfiConverterUInt32.read(from: &buf) + totalProcessingTime: FfiConverterDouble.read(from: &buf) ) } @@ -677,7 +615,6 @@ public struct FfiConverterTypeBenchmarkResult: FfiConverterRustBuffer { FfiConverterUInt32.write(value.numMsm, into: &buf) FfiConverterDouble.write(value.avgProcessingTime, into: &buf) FfiConverterDouble.write(value.totalProcessingTime, into: &buf) - FfiConverterUInt32.write(value.allocatedMemory, into: &buf) } } @@ -918,53 +855,6 @@ public func FfiConverterTypeProofCalldata_lower(_ value: ProofCalldata) -> RustB return FfiConverterTypeProofCalldata.lower(value) } - -public struct SetupResult { - public var provingKey: Data - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(provingKey: Data) { - self.provingKey = provingKey - } -} - - -extension SetupResult: Equatable, Hashable { - public static func ==(lhs: SetupResult, rhs: SetupResult) -> Bool { - if lhs.provingKey != rhs.provingKey { - return false - } - return true - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(provingKey) - } -} - - -public struct FfiConverterTypeSetupResult: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SetupResult { - return try SetupResult( - provingKey: FfiConverterData.read(from: &buf) - ) - } - - public static func write(_ value: SetupResult, into buf: inout [UInt8]) { - FfiConverterData.write(value.provingKey, into: &buf) - } -} - - -public func FfiConverterTypeSetupResult_lift(_ buf: RustBuffer) throws -> SetupResult { - return try FfiConverterTypeSetupResult.lift(buf) -} - -public func FfiConverterTypeSetupResult_lower(_ value: SetupResult) -> RustBuffer { - return FfiConverterTypeSetupResult.lower(value) -} - public enum MoproError { @@ -1209,7 +1099,7 @@ private var initializationResult: InitializationResult { if (uniffi_mopro_ffi_checksum_method_moprocircom_generate_proof() != 64602) { return InitializationResult.apiChecksumMismatch } - if (uniffi_mopro_ffi_checksum_method_moprocircom_setup() != 57700) { + if (uniffi_mopro_ffi_checksum_method_moprocircom_initialize() != 36559) { return InitializationResult.apiChecksumMismatch } if (uniffi_mopro_ffi_checksum_method_moprocircom_verify_proof() != 61522) { @@ -1231,4 +1121,4 @@ private func uniffiEnsureInitialized() { case .apiChecksumMismatch: fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } -} +} \ No newline at end of file diff --git a/ios/moproFFI.h b/ios/moproFFI.h index 9bf1b1f..1804bb9 100644 --- a/ios/moproFFI.h +++ b/ios/moproFFI.h @@ -70,7 +70,7 @@ void*_Nonnull uniffi_mopro_ffi_fn_constructor_moprocircom_new(RustCallStatus *_N ); RustBuffer uniffi_mopro_ffi_fn_method_moprocircom_generate_proof(void*_Nonnull ptr, RustBuffer circuit_inputs, RustCallStatus *_Nonnull out_status ); -RustBuffer uniffi_mopro_ffi_fn_method_moprocircom_setup(void*_Nonnull ptr, RustBuffer wasm_path, RustBuffer r1cs_path, RustCallStatus *_Nonnull out_status +void uniffi_mopro_ffi_fn_method_moprocircom_initialize(void*_Nonnull ptr, RustBuffer arkzkey_path, RustBuffer wasm_path, RustCallStatus *_Nonnull out_status ); int8_t uniffi_mopro_ffi_fn_method_moprocircom_verify_proof(void*_Nonnull ptr, RustBuffer proof, RustBuffer public_input, RustCallStatus *_Nonnull out_status ); @@ -238,7 +238,7 @@ uint16_t uniffi_mopro_ffi_checksum_func_verify_proof2(void uint16_t uniffi_mopro_ffi_checksum_method_moprocircom_generate_proof(void ); -uint16_t uniffi_mopro_ffi_checksum_method_moprocircom_setup(void +uint16_t uniffi_mopro_ffi_checksum_method_moprocircom_initialize(void ); uint16_t uniffi_mopro_ffi_checksum_method_moprocircom_verify_proof(void