Welcome to Zink! This project is a Minimum Viable Product (MVP) aiming to explore and demonstrate Programmable Credentials.
This project is currently in a very early Work-In-Progress (WIP) state.
- It is not yet fully functional for all intended real-world use cases.
- It has not been audited for security, correctness, or privacy.
- The codebase is subject to significant changes, refactoring, or even complete overhauls without notice.
Please use it for learning, experimentation, or contribution purposes only. Do not use it in production or with sensitive data.
Our primary goal is to build an MVP that showcases the potential of programmable credentials. We aim to combine the power of zero-knowledge proofs with a mobile-first approach to push the frontier for privacy-preserving programmable credentials.
Zink is built with a state-of-the-art, cross-platform, and privacy-focused stack:
- Zero-Knowledge Proofs:
- Noir: A Domain Specific Language for writing zero-knowledge circuits. (Example circuit in
assets/noir/
) - ProveKit (Rust Backend): Utilizes
noir-r1cs
from ProveKit for generating and verifying proofs with Noir circuits.
- Noir: A Domain Specific Language for writing zero-knowledge circuits. (Example circuit in
- Native Integration & Core Logic:
- Rust Library (Nightly Toolchain): For implementing core ZK logic, cryptographic operations, and performance-sensitive components. Reuses Noir & ProveKit libraries.
- UniFFI: For generating seamless, type-safe bindings between Rust and mobile native languages (Kotlin for Android, Swift for iOS).
- Mobile Application:
- React Native: For building the cross-platform user interface.
- Expo (ejected): To streamline development, building, and iteration, specifically utilizing:
- Expo Development Builds: For a robust native development experience allowing custom native code.
- Expo Native Modules: For integrating our Rust/UniFFI powered
zk-bindings
(for ZK operations) as well as native code, e.g.mrz-reader
(for passport scanning) modules.
- Expo Router: For file-based routing within the app.
- @tanstack/react-query: For managing asynchronous state and server interactions.
- Passport MRZ Scanning: Uses the device camera to scan the Machine Readable Zone (MRZ) of passports.
- NFC Passport Reading: Reads data from ePassports using NFC after obtaining MRZ details.
- ZK Proof Generation & Verification: Generating and verifying proofs using the integrated Rust ZK backend. This can be tested via the "Proof Generation" screen.
-
Node.js & npm: Install Node.js (LTS version recommended, e.g., 18.x or later) and npm.
-
Rust (Nightly Toolchain): Install Rust.
- The project uses the nightly toolchain for Rust. The
native_rust/rust-toolchain.toml
file will typically set this up for you automatically when youcd
into thenative_rust
directory or run cargo commands from the root (cargo +nightly <build or run>
).
- The project uses the nightly toolchain for Rust. The
-
Expo CLI: Install the Expo CLI:
npm install -g expo-cli
. -
Platform-Specific Tooling: - Android: Android Studio (for SDK, emulator, and build tools). - iOS: Xcode (for SDK, simulator, and build tools) and CocoaPods (
sudo gem install cocoapods
). CocoaPods recommends not using the MacOS system's version of Ruby, and install it through other means, e.g. homebrew. -
Rust Targets: Install the necessary targets for cross-compilation:
rustup target add aarch64-linux-android rustup target add aarch64-apple-ios rustup target add aarch64-apple-ios-sim
-
cargo-ndk
: For Android Rust builds:cargo install cargo-ndk
-
Clone the repository:
git clone https://github.com/kkrt-labs/zink.git cd zink
-
Install JavaScript dependencies:
npm install
-
Generate Native Bindings: This step compiles the Rust code in
native_rust/
(for ZK bindings) and prepares the native modules (zk-bindings
,mrz-reader
).⚠️ Runningnpm run generate-bindings
will generate ios bindings simulator, not for device. For ios devices, runnode scripts/setup_rust_bindings.mjs --ios-device
npm run generate-bindings # or specifically: # node scripts/setup_rust_bindings.mjs --all
You'll need to re-run this command whenever you make changes to the Rust code in
native_rust/src/lib.rs
. -
Run the app:
- For Android:
npx expo run:android
- For iOS:
npx expo run:ios
- For Web (Native modules like
zk-bindings
andmrz-reader
will have limited or no functionality):npx expo start --web
- For Android:
npx expo run:ios
ornpx expo run:android
may fail for unknown reasons, try runningnpm run generate-bindings
andnpx expo prebuild --clean
before-hand in that case.npx expo prebuild --clean
might fail, in that case, try a local eas build:eas build --platform android --profile development --local
oreas build --platform ios --profile development --local
. Make sure to run the command with the--local
. You'll then have to upload the.apk
or.ipa
resulting files to a mobile device. For that, consider using Expo Orbit.
Notes on Native Builds:
- The
generate-bindings
script (which callssetup_rust_bindings.mjs
) handles compiling Rust, generating Swift/Kotlin bindings, and placing them into themodules/zk-bindings/
directory. It also runspod install
for iOS. - If you encounter issues with native builds for the first time, ensure your Android Studio / Xcode setups are correct. Sometimes, opening the
android/
project in Android Studio or theios/
project in Xcode once can help resolve initial setup or dependency issues. - The
mrz-reader
module contains native code for camera access and MRZ parsing. Thezk-bindings
module is for the Rust-based ZK functionalities.
app/
: Contains the React Native screens and navigation logic (using Expo Router).proof.tsx
: Screen for demonstrating ZK proof generation and verification.
assets/
: Static assets.noir/poseidon-example.json
: A sample compiled Noir circuit.
modules/
: Houses local Expo Native Modules.mrz-reader/
: Native module for MRZ (Machine Readable Zone) scanning from documents.zk-bindings/
: Native module bridging Rust ZK logic to JavaScript via UniFFI.
native_rust/
: The Rust crate containing the core logic for ZK operations and other native utilities.src/lib.rs
: Main Rust library code.Cargo.toml
: Rust project dependencies and configuration (usesedition = "2021"
for compilation, thoughrustfmt.toml
uses2024
for styling).rust-toolchain.toml
: Specifies the Rust nightly toolchain.
scripts/
: Contains helper scripts, includingsetup_rust_bindings.mjs
for building and integrating Rust code.eas-hooks/
: Scripts used during EAS Build to set up the Rust environment.
We welcome contributions! As this is an early-stage project, there are many areas to contribute, from core ZK logic and circuit design to UI/UX improvements and documentation.
Please feel free to:
- Open issues for bugs, feature requests, or questions.
- Submit pull requests with improvements (please discuss significant changes in an issue first, especially for architectural decisions).
More detailed contribution guidelines will be added as the project matures.
This project is licensed under the Apache License 2.0. See the LICENSE file for the full license text.
This README is a living document and will be updated as the project evolves.