Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

rename

Manav Rathid7f53a0b0600
diff --git a/rust/CLAUDE.md b/rust/CLAUDE.md
deleted file mode 100644
index fe6a85228e..0000000000
--- a/rust/CLAUDE.md
+++ /dev/null
@@ -1,166 +0,0 @@
-# CLAUDE.md
-
-## Commit & PR Guidelines
-
-⚠️ **CRITICAL: From the default template, use ONLY: Co-Authored-By: Claude <[email protected]>** ⚠️
-
-### Pre-commit/PR Checklist (RUN BEFORE EVERY COMMIT OR PR!)
-
-**CRITICAL: CI will fail if ANY of these checks fail. Run ALL commands and ensure they ALL pass.**
-
-```bash
-# 1. Format code
-cargo fmt
-
-# 2. Check for clippy warnings (THIS MUST PASS - CI fails on any warning)
-cargo clippy --all-targets --all-features -- -D warnings
-# If this fails, fix the warnings manually (not all can be auto-fixed)
-
-# 3. Build with warnings as errors (THIS MUST PASS - matches CI environment)
-RUSTFLAGS="-D warnings" cargo build
-
-# 4. Verify formatting is correct (THIS MUST PASS - CI checks this)
-cargo fmt --check
-```
-
-**Why CI might fail even after running these:**
-
-- Skipping any command above
-- Assuming auto-fix tools handle everything (they don't)
-- Not fixing warnings that clippy reports
-- Making changes after running the checks
-
-### Commit & PR Message Rules
-
-**These rules apply to BOTH commit messages AND pull request descriptions**
-
-- Keep messages CONCISE (no walls of text)
-- Subject line under 72 chars (no body text unless critical)
-- NO emojis
-- NO promotional text or links (except Co-Authored-By line)
-
-### Additional Guidelines
-
-- Check `git status` before committing to avoid adding temporary/binary files
-- Never commit to main branch
-- All CI checks must pass - run the checklist commands above before committing or creating PR
-
-## Development Commands
-
-### Build and Test
-
-```bash
-# Format code (required before commits)
-cargo fmt
-
-# Run linter (must pass for CI)
-cargo clippy --all-targets --all-features
-
-# Build the project
-cargo build
-
-# Run in development
-cargo run -- <command>
-
-# Build release version
-cargo build --release
-```
-
-### CI Requirements
-
-The codebase must pass the GitHub Actions workflow at `../.github/workflows/rust-lint.yml` which runs:
-
-1. `cargo fmt --check` - Code formatting check
-2. `cargo clippy --all-targets --all-features` - Linting with all warnings as errors (RUSTFLAGS: -D warnings)
-3. `cargo build` - Build verification
-
-**Important FFI Note**: When working with libsodium FFI bindings, always use `std::ffi::c_char` for C char pointer casts (e.g., `as *const std::ffi::c_char`), NOT raw `i8` casts. The CI environment may have different type expectations than local development.
-
-## Architecture Overview
-
-CLI for ente.io with end-to-end encryption, multi-account and multi-app support.
-
-### Core Modules
-
-**`api/`** - HTTP client for ente.io API
-
-- `client.rs`: Base HTTP client with auth token management
-- `auth.rs`: SRP (Secure Remote Password) authentication implementation
-- `methods.rs`: API method implementations (collections, files, user info)
-- `models.rs`: API request/response data structures
-- `retry.rs`: Retry logic with exponential backoff for rate limiting
-
-**`crypto/`** - Cryptographic operations using libsodium
-
-- `argon.rs`: Argon2id key derivation
-- `chacha.rs`: ChaCha20-Poly1305 encryption/decryption
-- `stream.rs`: XChaCha20-Poly1305 streaming decryption for large files
-- `kdf.rs`: Blake2b key derivation
-- All crypto MUST use `libsodium-sys-stable` (statically linked)
-
-**`storage/`** - SQLite persistence layer
-
-- `schema.rs`: Database schema for accounts, files, collections
-- `account.rs`: Account CRUD operations with multi-app support
-- `sync.rs`: Sync state management (last sync times, file tracking)
-- `config.rs`: Key-value configuration store
-- Uses `rusqlite` with bundled SQLite for portability
-
-**`cli/`** - Command-line argument parsing
-
-- `account.rs`: Account command argument structures
-- `export.rs`: Export command argument structures
-- `version.rs`: Version information constants
-- Uses `clap` for argument parsing
-
-**`commands/`** - Command implementation logic
-
-- `account.rs`: Account management implementation (add, list, update, get-token)
-- `export.rs`: Photo export orchestration with filtering support
-- `sync.rs`: Synchronization logic execution
-
-**`models/`** - Data structures
-
-- `account.rs`: Account model with encrypted credentials
-- `file.rs`: File metadata and encryption info
-- `collection.rs`: Albums/collections with sharing support
-- `metadata.rs`: Decrypted file metadata (title, timestamps, location)
-- `filter.rs`: Export filtering options (shared/hidden albums, emails)
-- `error.rs`: Error types using `thiserror`
-
-**`sync/`** - Synchronization engine
-
-- `engine.rs`: Core sync orchestration and state management
-- `files.rs`: File synchronization logic
-- `download.rs`: File download and decryption implementation
-
-**`utils/`** - Utility functions
-
-- `mod.rs`: Config directory management with platform-specific defaults
-
-### Key Implementation Details
-
-1. **Authentication Flow**: SRP-based authentication storing tokens in SQLite, supports multiple apps (photos, locker, auth)
-2. **Multi-Account Support**: SQLite-based storage with per-account/per-app token management
-3. **File Organization**: Export to `export_dir/AlbumName/filename` structure (files in "Uncategorized" if no album)
-4. **Export Filtering**: Support for filtering by shared/hidden albums and specific user emails
-5. **Encryption**: Files encrypted with ChaCha20-Poly1305, streaming decryption for large files, keys derived via Argon2/Blake2b
-6. **Async Runtime**: Uses tokio with full features for concurrent operations
-7. **Error Handling**: Propagate errors with `?` operator, use `anyhow` for context
-8. **Configuration**: Platform-specific config directories (Linux: ~/.config/ente-cli, macOS: ~/Library/Application Support/ente-cli, Windows: %APPDATA%/ente-cli)
-
-## Security Guidelines
-
-**NEVER commit sensitive information:**
-
-- No real email addresses, usernames, or account IDs in code or documentation
-- No authentication tokens, API keys, or passwords (even for test accounts)
-- No debug logs that output credentials, keys, or personal information
-- Use generic examples like "[email protected]" in documentation
-- Remove all `log::debug!` statements that print sensitive data before committing
-- Avoid logging encrypted keys, nonces, or tokens even in encrypted form
-
-## Environment Variables
-
-- `ENTE_CLI_CONFIG_DIR`: Override default config directory
-- `RUST_LOG`: Set log level (debug, info, warn, error, trace)
diff --git a/rust/Cargo.lock b/rust/cli/Cargo.lock
similarity index 100%
rename from rust/Cargo.lock
rename to rust/cli/Cargo.lock
diff --git a/rust/Cargo.toml b/rust/cli/Cargo.toml
similarity index 100%
rename from rust/Cargo.toml
rename to rust/cli/Cargo.toml
diff --git a/rust/src/api/auth.rs b/rust/cli/src/api/auth.rs
similarity index 100%
rename from rust/src/api/auth.rs
rename to rust/cli/src/api/auth.rs
diff --git a/rust/src/api/client.rs b/rust/cli/src/api/client.rs
similarity index 100%
rename from rust/src/api/client.rs
rename to rust/cli/src/api/client.rs
diff --git a/rust/src/api/methods.rs b/rust/cli/src/api/methods.rs
similarity index 100%
rename from rust/src/api/methods.rs
rename to rust/cli/src/api/methods.rs
diff --git a/rust/src/api/mod.rs b/rust/cli/src/api/mod.rs
similarity index 100%
rename from rust/src/api/mod.rs
rename to rust/cli/src/api/mod.rs
diff --git a/rust/src/api/models.rs b/rust/cli/src/api/models.rs
similarity index 100%
rename from rust/src/api/models.rs
rename to rust/cli/src/api/models.rs
diff --git a/rust/src/api/retry.rs b/rust/cli/src/api/retry.rs
similarity index 100%
rename from rust/src/api/retry.rs
rename to rust/cli/src/api/retry.rs
diff --git a/rust/src/cli/account.rs b/rust/cli/src/cli/account.rs
similarity index 100%
rename from rust/src/cli/account.rs
rename to rust/cli/src/cli/account.rs
diff --git a/rust/src/cli/export.rs b/rust/cli/src/cli/export.rs
similarity index 100%
rename from rust/src/cli/export.rs
rename to rust/cli/src/cli/export.rs
diff --git a/rust/src/cli/mod.rs b/rust/cli/src/cli/mod.rs
similarity index 100%
rename from rust/src/cli/mod.rs
rename to rust/cli/src/cli/mod.rs
diff --git a/rust/src/cli/version.rs b/rust/cli/src/cli/version.rs
similarity index 100%
rename from rust/src/cli/version.rs
rename to rust/cli/src/cli/version.rs
diff --git a/rust/src/commands/account.rs b/rust/cli/src/commands/account.rs
similarity index 100%
rename from rust/src/commands/account.rs
rename to rust/cli/src/commands/account.rs
diff --git a/rust/src/commands/export.rs b/rust/cli/src/commands/export.rs
similarity index 100%
rename from rust/src/commands/export.rs
rename to rust/cli/src/commands/export.rs
diff --git a/rust/src/commands/mod.rs b/rust/cli/src/commands/mod.rs
similarity index 100%
rename from rust/src/commands/mod.rs
rename to rust/cli/src/commands/mod.rs
diff --git a/rust/src/commands/sync.rs b/rust/cli/src/commands/sync.rs
similarity index 100%
rename from rust/src/commands/sync.rs
rename to rust/cli/src/commands/sync.rs
diff --git a/rust/src/crypto/argon.rs b/rust/cli/src/crypto/argon.rs
similarity index 100%
rename from rust/src/crypto/argon.rs
rename to rust/cli/src/crypto/argon.rs
diff --git a/rust/src/crypto/chacha.rs b/rust/cli/src/crypto/chacha.rs
similarity index 100%
rename from rust/src/crypto/chacha.rs
rename to rust/cli/src/crypto/chacha.rs
diff --git a/rust/src/crypto/kdf.rs b/rust/cli/src/crypto/kdf.rs
similarity index 100%
rename from rust/src/crypto/kdf.rs
rename to rust/cli/src/crypto/kdf.rs
diff --git a/rust/src/crypto/mod.rs b/rust/cli/src/crypto/mod.rs
similarity index 100%
rename from rust/src/crypto/mod.rs
rename to rust/cli/src/crypto/mod.rs
diff --git a/rust/src/crypto/stream.rs b/rust/cli/src/crypto/stream.rs
similarity index 100%
rename from rust/src/crypto/stream.rs
rename to rust/cli/src/crypto/stream.rs
diff --git a/rust/src/lib.rs b/rust/cli/src/lib.rs
similarity index 100%
rename from rust/src/lib.rs
rename to rust/cli/src/lib.rs
diff --git a/rust/src/main.rs b/rust/cli/src/main.rs
similarity index 100%
rename from rust/src/main.rs
rename to rust/cli/src/main.rs
diff --git a/rust/src/models/account.rs b/rust/cli/src/models/account.rs
similarity index 100%
rename from rust/src/models/account.rs
rename to rust/cli/src/models/account.rs
diff --git a/rust/src/models/collection.rs b/rust/cli/src/models/collection.rs
similarity index 100%
rename from rust/src/models/collection.rs
rename to rust/cli/src/models/collection.rs
diff --git a/rust/src/models/error.rs b/rust/cli/src/models/error.rs
similarity index 100%
rename from rust/src/models/error.rs
rename to rust/cli/src/models/error.rs
diff --git a/rust/src/models/export_metadata.rs b/rust/cli/src/models/export_metadata.rs
similarity index 100%
rename from rust/src/models/export_metadata.rs
rename to rust/cli/src/models/export_metadata.rs
diff --git a/rust/src/models/file.rs b/rust/cli/src/models/file.rs
similarity index 100%
rename from rust/src/models/file.rs
rename to rust/cli/src/models/file.rs
diff --git a/rust/src/models/filter.rs b/rust/cli/src/models/filter.rs
similarity index 100%
rename from rust/src/models/filter.rs
rename to rust/cli/src/models/filter.rs
diff --git a/rust/src/models/metadata.rs b/rust/cli/src/models/metadata.rs
similarity index 100%
rename from rust/src/models/metadata.rs
rename to rust/cli/src/models/metadata.rs
diff --git a/rust/src/models/mod.rs b/rust/cli/src/models/mod.rs
similarity index 100%
rename from rust/src/models/mod.rs
rename to rust/cli/src/models/mod.rs
diff --git a/rust/src/storage/account.rs b/rust/cli/src/storage/account.rs
similarity index 100%
rename from rust/src/storage/account.rs
rename to rust/cli/src/storage/account.rs
diff --git a/rust/src/storage/config.rs b/rust/cli/src/storage/config.rs
similarity index 100%
rename from rust/src/storage/config.rs
rename to rust/cli/src/storage/config.rs
diff --git a/rust/src/storage/mod.rs b/rust/cli/src/storage/mod.rs
similarity index 100%
rename from rust/src/storage/mod.rs
rename to rust/cli/src/storage/mod.rs
diff --git a/rust/src/storage/schema.rs b/rust/cli/src/storage/schema.rs
similarity index 100%
rename from rust/src/storage/schema.rs
rename to rust/cli/src/storage/schema.rs
diff --git a/rust/src/storage/sync.rs b/rust/cli/src/storage/sync.rs
similarity index 100%
rename from rust/src/storage/sync.rs
rename to rust/cli/src/storage/sync.rs
diff --git a/rust/src/sync/download.rs b/rust/cli/src/sync/download.rs
similarity index 100%
rename from rust/src/sync/download.rs
rename to rust/cli/src/sync/download.rs
diff --git a/rust/src/sync/engine.rs b/rust/cli/src/sync/engine.rs
similarity index 100%
rename from rust/src/sync/engine.rs
rename to rust/cli/src/sync/engine.rs
diff --git a/rust/src/sync/mod.rs b/rust/cli/src/sync/mod.rs
similarity index 100%
rename from rust/src/sync/mod.rs
rename to rust/cli/src/sync/mod.rs
diff --git a/rust/src/utils/mod.rs b/rust/cli/src/utils/mod.rs
similarity index 100%
rename from rust/src/utils/mod.rs
rename to rust/cli/src/utils/mod.rs