π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update
Manav Rathid2d1e5a2bc2c
diff --git a/rust/README.md b/rust/README.mdindex af589b21c5..f5d744a423 100644--- a/rust/README.md+++ b/rust/README.md@@ -14,18 +14,28 @@β β ββΌ βΌ βΌβββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ ββββββββββββββββββββββββββ-β mobile/apps/photos/rust/ β β web/packages/ente-wasm/ β β rust/cli/ β-β β β (ente-wasm crate) β β β-β Depends on ente-core β β β β (future: when CLI β-β #[frb] wrappers inline β β Rust crate + wasm-pack β β uses ente-core) β-β + app-specific (usearch) β β #[wasm_bindgen] wrappers β β β+β mobile/packages/rust/ β β web/packages/wasm/ β β rust/cli/ β+β (ente-rust crate) β β (ente-wasm crate) β β β+β β β β β (future: when CLI β+β Shared #[frb] wrappers β β #[wasm_bindgen] wrappers β β uses ente-core) β+β for all mobile apps β β for all web apps β β ββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ ββββββββββββββββββββββββββ- β β- βΌ βΌ-βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ-β Flutter Photos App β β Web Apps β-β β β (Photos, Auth, etc.) β-βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ+ β β β+ β ββββββββββββββββ β+ βΌ βΌ βΌ+βββββββββββββββββββ ββββββββββββββ βββββββββββββββββββββββββββββ+β Photos App β β Other apps β β Web Apps β+β β β (Auth ...) β β (Photos, Auth, etc.) β+βββββββββββββββββββ ββββββββββββββ βββββββββββββββββββββββββββββ+ β²+ β+βββββββββββββββββββββββββββββ+β mobile/apps/photos/rust/ β+β (ente-photos-rust crate) β+β β+β App-specific #[frb]: β+β usearch, ML, etc. β+βββββββββββββββββββββββββββββ```## Directory Structure@@ -42,26 +52,35 @@ rust/β βββ urls.rsβββ Cargo.toml # crate name: ente-core-web/packages/ente-wasm/ # WASM bindings (lives in web workspace)+web/packages/wasm/ # WASM bindings (lives in web workspace)βββ src/β βββ lib.rs # #[wasm_bindgen] wrappers around ente-coreβββ Cargo.toml # crate name: ente-wasmβββ package.json # includes wasm-pack as devDependencyβββ pkg/ # generated output (gitignored)-mobile/apps/photos/rust/ # FRB bindings (lives in mobile app)+mobile/packages/rust/ # Shared FRB bindings for all mobile apps+βββ rust/+β βββ src/+β β βββ api/ # #[frb] wrappers around ente-core+β βββ Cargo.toml # crate name: ente-rust+βββ lib/ # Generated Dart bindings+βββ pubspec.yaml # Flutter plugin package++mobile/apps/photos/rust/ # Photos app-specific FRB bindingsβββ src/β βββ lib.rs-β βββ api/ # #[frb] wrappers around ente-core+β βββ api/ # #[frb] app-specific code (usearch, ML)β βββ *.rs-βββ Cargo.toml # crate name: rust_lib_photos+βββ Cargo.toml # crate name: ente-photos-rust```**Crates:**- `ente-core` - shared business logic (pure Rust, no FFI)- `ente-wasm` - wasm-bindgen wrappers for web-- `rust_lib_photos` - FRB wrappers for mobile+- `ente-rust` - shared FRB wrappers for mobile (Dart class: `EnteRust`)+- `ente-photos-rust` - Photos app-specific FRB (Dart class: `EntePhotosRust`)## Tooling@@ -87,9 +106,12 @@ wasm-pack is installed via npm as a devDependency, so `yarn install` handles it.### [Flutter Rust Bridge (FRB)](https://github.com/fzyzcjy/flutter_rust_bridge)-Used for Flutter integration. FRB wrappers (annotated with `#[frb]`) live in `mobile/apps/photos/rust/` and depend on `ente-core`.+Used for Flutter integration. FRB is used on two crates:++- **`ente-rust`** (`mobile/packages/rust/`) - Shared wrappers around `ente-core`, used by multiple mobile apps (Photos, Auth, etc.)+- **`ente-photos-rust`** (`mobile/apps/photos/rust/`) - Photos app-specific functionality (usearch, ML)-Currently, App-specific functionality (usearch, ML) stays alongside in the same crate. In the future, if another one of Ente's Flutter apps needs the same wrappers, we can extract a shared crate.+Both depend on `ente-core` and use `#[frb]` annotations to generate Dart bindings.## Development@@ -127,25 +149,21 @@ yarn build:wasm # builds the WASM package> cargo watch -w ../rust/core -w packages/wasm/src -s "yarn build:wasm"> ```-**rust_lib_photos (mobile/apps/photos/rust/):**--One time:+**ente-rust (mobile/packages/rust/):**```shcargo install flutter_rust_bridge_codegen-```--From `mobile/apps/photos`:--```sh-flutter pub getflutter_rust_bridge_codegen generate+flutter test```-Then `mobile/apps/photos/rust/`+`flutter_rust_bridge_codegen generate` needs to be run either manually (or in watch mode, `flutter_rust_bridge_codegen generate --watch`) whenever the Rust source changes to get the bindings to update.++**ente-photos-rust (mobile/apps/photos/rust/):**```sh-cargo build+flutter_rust_bridge_codegen generate+flutter test```## Future@@ -188,6 +206,7 @@ wasm = ["getrandom/js"]## Tests- **ente-core:** Standard `cargo test` - comprehensive unit tests-- **rust_lib_photos:** Minimal FRB smoke test in Dart to catch binding drift+- **ente-rust:** Minimal FRB smoke test in Dart to catch binding drift+- **ente-photos-rust:** Integration tests for app-specific functionality- **ente-wasm:** Vitest tests in web package- **Golden fixtures:** Share test vectors across native/FRB/WASM for crypto parity