π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Clean up Rust workspace docs and lint workflow
Manav Rathi5f83cf331c21
diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.ymlindex 84cc640bc4..652c6e1363 100644--- a/.github/workflows/rust-lint.yml+++ b/.github/workflows/rust-lint.yml@@ -3,8 +3,8 @@ name: "Lint (rust)"on:pull_request:paths:- - "rust/**"- ".github/workflows/rust-lint.yml"+ - "rust/**"permissions:contents: read@@ -26,21 +26,17 @@ jobs:run:working-directory: ruststeps:- - name: Checkout code- uses: actions/checkout@v6+ - uses: actions/checkout@v6- name: Install Linux dependenciesrun: |sudo apt-get updatesudo apt-get install -y g++-12 libwebkit2gtk-4.0-dev libsoup2.4-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev- - name: Prepare Ensu desktop distDir- run: mkdir -p ../web/apps/ensu/out-- - run: cargo fmt --all --check+ - run: cargo fmt --check- - run: cargo clippy --workspace --all-targets --locked+ - run: cargo clippy --all-targets --locked# ORT rc.12's Linux test binary links glibc 2.38 symbols that are# unavailable on the Ubuntu 22.04 runner required by Tauri v1.- - run: cargo test --workspace --locked --exclude transcription --exclude ensu-transcription+ - run: cargo test --locked --workspace --exclude transcription --exclude ensu-transcriptiondiff --git a/rust/README.md b/rust/README.mdindex b8401a5d0b..702928303b 100644--- a/rust/README.md+++ b/rust/README.md@@ -1,214 +1,27 @@-# Rust in Ente+# Rust-```- βββββββββββββββββββββββββββββββββββββββββ- β rust/crates/core/ β- β (ente-core crate) β- β β- β Pure Rust - NO FFI annotations β- β Stateless business logic β- β Fully testable with cargo test β- βββββββββββββββββββββββββββββββββββββββββ- β- ββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ- β β β- βΌ βΌ βΌ-βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ ββββββββββββββββββββββββββ-β rust/bindings/frb/ β β rust/bindings/wasm/ β β rust/apps/cli/ β-β ente-rust/ β β ente-wasm/ β β β-β (ente_rust crate) β β (ente-wasm crate) β β β-β β β β β CLI binary, depends β-β Shared #[frb] wrappers β β #[wasm_bindgen] wrappers β β on ente-core β-β for all mobile apps β β for all web apps β β β-βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ ββββββββββββββββββββββββββ- β β β- β ββββββββββββββββ β- βΌ βΌ βΌ-βββββββββββββββββββ ββββββββββββββ βββββββββββββββββββββββββββββ-β Photos App β β Other apps β β Web Apps β-β β β (Auth ...) β β (Photos, Auth, etc.) β-βββββββββββββββββββ ββββββββββββββ βββββββββββββββββββββββββββββ- β²- β-βββββββββββββββββββββββββββββ-β rust/bindings/frb/photos/ β-β (ente_photos_rust crate) β-β β-β Thin app-specific #[frb] β-β wrappers for crates/photos β-βββββββββββββββββββββββββββββ-```--## Contents (this repo)--- `rust/crates/core/` (`ente-core`) - shared, pure Rust code used by clients (crypto + auth, plus small HTTP/URL helpers).-- `rust/crates/photos/` (`ente_photos`) - shared Photos Rust logic (motion photo, ML, image processing, vector DB).-- `rust/apps/cli/` (`ente-rs`) - Rust CLI.-- `rust/bindings/frb/ente-rust/` (`ente_rust`) - shared Flutter Rust Bridge bindings for mobile.-- `rust/bindings/frb/photos/` (`ente_photos_rust`) - Photos app-specific Flutter Rust Bridge bindings.-- `rust/bindings/wasm/ente-wasm/` (`ente-wasm`) - wasm-bindgen bindings for web.-- `rust/e2e/` (`ente-e2e`) - live Museum-backed Rust end-to-end tests.-- `rust/crates/ensu/` - LLM chat stack (see `rust/crates/ensu/README.md`).--## Directory Structure--```-rust/-βββ apps/-β βββ cli/ # CLI package (ente-rs)-β β βββ src/-β β β βββ main.rs-β β βββ Cargo.toml-β β-β βββ codegen/ # Cargo-powered repo codegen helper-β βββ src/-β βββ Cargo.toml-β-βββ crates/-β βββ accounts/ # Shared account helpers-β βββ contacts/ # Shared contacts logic-β βββ core/ # Pure Rust shared logic (ente-core)-β βββ ensu/ # LLM chat stack-β βββ image/ # Shared image crate-β βββ photos/ # Shared Photos Rust logic-β-βββ e2e/ # Rust e2e tests requiring live Museum-β βββ src/-β β βββ lib.rs-β βββ tests/-β βββ Cargo.toml-β-βββ Cargo.toml # Rust workspace manifest--rust/bindings/uniffi/ # UniFFI bindings for core crypto/auth + ensu-βββ core/-βββ ensu/--rust/bindings/frb/ # Flutter Rust Bridge binding crates-βββ ente-rust/-β βββ src/-β β βββ api/ # #[frb] wrappers around ente-core-β βββ Cargo.toml # crate name: ente_rust-βββ photos/- βββ src/- β βββ api/ # #[frb] thin wrappers over rust/crates/photos- βββ Cargo.toml # crate name: ente_photos_rust--rust/bindings/wasm/ente-wasm/ # WASM bindings Rust crate-βββ src/-β βββ lib.rs # #[wasm_bindgen] wrappers around ente-core-βββ Cargo.toml # crate name: ente-wasm--web/packages/wasm/ # JS package surface for ente-wasm-βββ package.json # includes wasm-pack as devDependency-βββ pkg/ # generated output (gitignored)--mobile/packages/rust/ # Shared FRB bindings for all mobile apps-βββ lib/ # Generated Dart bindings-βββ pubspec.yaml # Flutter plugin package-```--**Crates:**--- `ente-core` - shared business logic (pure Rust, no FFI)- - Docs: `rust/crates/core/docs/crypto.md`, `rust/crates/core/docs/auth.md`-- `ente_photos` - shared Photos Rust logic-- `ente-rs` - Rust CLI package (`ente-cli` binary)-- `ente-e2e` - ignored Rust integration tests that run against a live Museum-- `ente-wasm` - wasm-bindgen wrappers for web-- `ente_rust` - shared FRB wrappers for mobile (Dart class: `EnteRust`)-- `ente_photos_rust` - Photos app-specific FRB (Dart class: `EntePhotosRust`)--## Tooling--### [wasm-bindgen](https://github.com/wasm-bindgen/wasm-bindgen)--A Rust library that provides the `#[wasm_bindgen]` attribute macro. When you annotate a function with `#[wasm_bindgen]`, it:--1. Marks the function for export to JavaScript-2. Handles type conversions between Rust and JS (e.g., `String` β JS string, `i64` β `BigInt`)-3. Generates metadata that the wasm-bindgen CLI uses to create JS/TS glue code--### [wasm-pack](https://github.com/drager/wasm-pack)--A CLI tool that orchestrates the WASM build process:--1. Runs `cargo build --target wasm32-unknown-unknown`-2. Invokes `wasm-bindgen` CLI to generate JS/TS bindings from the compiled WASM-3. Outputs everything to a `pkg/` directory ready for npm/bundlers--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 is used on two crates:--- **`ente_rust`** (`rust/bindings/frb/ente-rust/`) - Shared wrappers around `ente-core`, used by multiple mobile apps (Photos, Auth, etc.)-- **`ente_photos_rust`** (`rust/bindings/frb/photos/`) - Thin Photos-specific wrappers around `rust/crates/photos`--Both depend on `ente-core` and use `#[frb]` annotations to generate Dart bindings.+Cargo workspace for Ente's Rust code.## Development-### Commands--**ente-core (rust/crates/core/):**--```sh-cargo fmt # format-cargo clippy # lint-cargo build # build-cargo test # test-```--**ente-cli (rust/apps/cli/):**-```sh-cargo fmt # format-cargo clippy # lint-cargo build # build-cargo test # test-cargo run --bin ente-cli -- --help-```--**ente-e2e (rust/e2e/):**+cargo fmt # Format+cargo clippy # Lint+cargo build # Build+cargo test # Test-```sh-cargo test --manifest-path rust/Cargo.toml -p ente-e2e # compile-only sanity check-rust/e2e/scripts/run.sh # starts Docker + runs ignored live suite-cargo test --manifest-path rust/Cargo.toml -p ente-e2e -- --ignored --nocapture+cargo run --bin ente-cli -- --help # Run the Ente Rust CLI```-**ente-wasm (Rust source in rust/bindings/wasm/ente-wasm/, JS package in web/packages/wasm/):**--```sh-yarn install # installs wasm-pack-yarn build # runs wasm-pack against the Rust crate-```+CI runs with `RUSTFLAGS="-D warnings"` so warnings will cause checks to fail.-Or from web/ root:+Other useful commands:```sh-yarn build:wasm # builds the WASM package-```--> [!TIP]->-> For active Rust development, use watch mode in a separate terminal:->-> ```sh-> cargo install cargo-watch-> cd web/-> cargo watch -w ../rust/crates/core -w ../rust/bindings/wasm/ente-wasm/src -s "yarn build:wasm"-> ```--**Generated bindings:**+cargo codegen native # Regenerate bindings used by native apps+cargo codegen frb # Regenerate bindings used by Flutter apps-```sh-cd rust-cargo codegen native-cargo codegen frb+# Starts Docker + runs the E2E tests (ignored by default)+./e2e/scripts/run.sh+cargo test -p ente-e2e -- --ignored --nocapture```--`native` regenerates the UniFFI bindings used by native mobile apps.-`frb` regenerates both `ente_rust` and `ente_photos_rust`.diff --git a/rust/apps/cli/README.md b/rust/apps/cli/README.mdindex d5e51e68e9..69da9729aa 100644--- a/rust/apps/cli/README.md+++ b/rust/apps/cli/README.md@@ -3,9 +3,5 @@ WIP Ente Rust CLI.## Development```sh-cargo fmt # format-cargo clippy # lint-cargo build # build-cargo test # testcargo run --bin ente-cli -- --help```diff --git a/rust/bindings/frb/README.md b/rust/bindings/frb/README.mdnew file mode 100644index 0000000000..c5e26ddf1d--- /dev/null+++ b/rust/bindings/frb/README.md@@ -0,0 +1,3 @@+# Flutter Rust Bridge++[Flutter Rust Bridge (FRB)](https://github.com/fzyzcjy/flutter_rust_bridge) generates Dart bindings from Rust APIs annotated with `#[frb]`. This is used for Flutter integration of Rust code.diff --git a/rust/bindings/wasm/README.md b/rust/bindings/wasm/README.mdnew file mode 100644index 0000000000..9a38c7b2f7--- /dev/null+++ b/rust/bindings/wasm/README.md@@ -0,0 +1,19 @@+# Wasm bindings for Rust code++## [wasm-bindgen](https://github.com/wasm-bindgen/wasm-bindgen)++A Rust library that provides the `#[wasm_bindgen]` attribute macro. When you annotate a function with `#[wasm_bindgen]`, it:++1. Marks the function for export to JavaScript+2. Handles type conversions between Rust and JS (e.g., `String` β JS string, `i64` β `BigInt`)+3. Generates metadata that the wasm-bindgen CLI uses to create JS/TS glue code++## [wasm-pack](https://github.com/drager/wasm-pack)++A CLI tool that orchestrates the WASM build process:++1. Runs `cargo build --target wasm32-unknown-unknown`+2. Invokes `wasm-bindgen` CLI to generate JS/TS bindings from the compiled WASM+3. Outputs everything to a `pkg/` directory ready for npm/bundlers++wasm-pack is installed via npm as a devDependency, so `yarn install` handles it.diff --git a/rust/crates/core/README.md b/rust/crates/core/README.mdindex dd05a7dc10..854cc47873 100644--- a/rust/crates/core/README.md+++ b/rust/crates/core/README.md@@ -50,12 +50,3 @@ let decrypted = crypto::secretbox::decrypt_box(&encrypted, &key).unwrap();```π **[Full Crypto Docs](docs/crypto.md)**--## Development--```sh-cargo fmt # format-cargo clippy # lint-cargo build # build-cargo test # test-```