This document provides instructions for developers who want to build, run, or contribute to the SEN (Secure Encrypted Notepad) project.
To develop SEN, you need the following installed on your system:
- Rust Toolchain: Install via rustup.rs.
- Recommended version: Stable (Rust 1.75+).
- Git: To clone the repository.
- Platform Dependencies:
- Windows: No extra dependencies (uses MSVC or GNU toolchain).
- Linux: Requires development headers for
libsecretand GUI libraries.- Ubuntu/Debian:
sudo apt install libsecret-1-dev libssl-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- Ubuntu/Debian:
- macOS: No extra dependencies (uses internal Keychain and AppKit).
- Android Development (Optional):
- Android Studio: Jellyfish or newer recommended.
- Android SDK & NDK: Installed via Android Studio (NDK version 26.x recommended).
- cargo-ndk: Install via
cargo install cargo-ndk. - Rust Targets: Add Android targets for your emulator/device:
rustup target add aarch64-linux-android x86_64-linux-android
- Bun: Required for running utility scripts (i18n synchronization and cleanup). Install via bun.sh.
git clone https://github.com/Avaray/secure-encrypted-notepad.git
cd secure-encrypted-notepadThis uses the dev profile with incremental compilation for a better experience.
cargo runThere are two ways to build a release binary:
- Standard Release: Balanced build with Thin LTO.
cargo build --release
- Final Release (Optimized): Full LTO and size optimizations (used for public releases).
cargo build --profile release-final
The Android version is a wrapper around the core Rust library using GameActivity.
- Open Android Studio and points to the
crates/sen-android/androiddirectory. - Wait for Gradle Sync to finish.
- Build/Run: Click Run (▶) or run from CLI:
cd crates/sen-android/android ./gradlew assembleDebug
Tip
The Android project is configured to automatically run cargo-ndk during the preBuild phase. If you encounter errors, ensure cargo-ndk is in your PATH and your ANDROID_NDK_HOME environment variable is set to your NDK location.
- Fast Check: Always run this before a full build to catch syntax and type errors.
cargo check
- Testing: Run unit tests (especially for theme resolution and crypto logic).
cargo test - Linting: Keep the code clean and follow Rust best practices.
cargo clippy
- Formatting: Ensure consistent code style.
cargo fmt
SEN uses a custom zero-latency i18n parser for multi-language support (extracted to the sen-i18n workspace crate for near-instant compilation).
- Translation files are located in
crates/sen-i18n/locales/*.yml. - To add a new language:
- Create
crates/sen-i18n/locales/XX.yml. - Register the file in
crates/sen-i18n/src/lib.rsby adding aload_lang!("xx", "../locales/xx.yml");entry. - Add the SVG flag icon in
crates/sen-desktop/assets/flags/(Emojione style recommended). - Register the new flag in
crates/sen-desktop/src/icons.rs(Iconsstruct andload()method). - Update
crates/sen-desktop/src/settings.rs(default_languagedetection). - Update
crates/sen-desktop/src/ui_panels.rs(Language Selector UI).
- Create
The project includes several helper scripts in the /scripts directory to automate common development tasks. These scripts are written in TypeScript and run using Bun.
This script ensures that all translation files stay in sync with English (the source language).
- Purpose: Automatically identifies missing keys in non-English
.ymlfiles and translates them using the Gemini AI API. - Requirement: Requires a
GEMINI_API_KEYset in your environment variables (or provided in a.envfile in thescripts/directory). - Usage:
# Sync all languages bun scripts/locales-sync.ts # Sync a specific language (e.g., Polish) bun scripts/locales-sync.ts pl # Dry run (check for missing keys without translating/writing) bun scripts/locales-sync.ts --dry-run
This script helps maintain a clean en.yml file by removing keys that are no longer referenced in the Rust codebase.
- Purpose: Scans all
.rsfiles in thecrates/directory to check for usage of translation keys. - Usage:
# Perform cleanup bun scripts/locales-cleanup.ts # Dry run bun scripts/locales-cleanup.ts --dry-run
SEN is organized as a Cargo Workspace to support code sharing across multiple platforms (e.g., Desktop, Android).
crates/sen-core/: Core headless library containing the engine logic.crypto.rs: XChaCha20-Poly1305 encryption logic for.senfiles.config_crypto.rs: AES-256 encryption for protecting sensitive paths insettings.toml.history.rs: Management of document snapshots and metadata.
crates/sen-i18n/: Custom internationalization engine and localization resources.locales/: YAML translation files for all supported languages.
crates/sen-desktop/: The main GUI application (Windows, Linux, macOS).src/main.rs: Application entry point.src/app.rs: Main application logic, event loop, and state management.src/app_actions.rs: Implementation of high-level actions (Open, Save, Export, etc.).src/app_helpers.rs: Logging, background task management, and UI utilities.src/settings.rs: Persistence and management of user preferences.src/theme.rs: Custom theme engine (TOML) and color resolution logic.src/fonts.rs: Dynamic font discovery and system font handling.src/single_instance.rs: Windows-specific single instance enforcement.src/ui_*.rs: Modular GUI components (ui_editor,ui_panels,ui_toolbar,ui_batch, etc.).assets/: UI icons and branding resources.
crates/sen-android/: The Android port of SEN.src/lib.rs: Entry point for the Android library (android_main).android/: The native Android Studio / Gradle project.android/app/src/main/java/com/sen/android/MainActivity.kt: The Kotlin wrapper.
docs/: Technical documentation and design notes.scripts/: Bun utility scripts for i18n synchronization and automated maintenance..github/: CI/CD automation workflows for testing and automated releases.
SEN stores its settings and encryption keys in standard OS directories:
- Windows:
%APPDATA%\sen - Linux:
~/.config/sen - macOS:
~/Library/Application Support/sen
Important
The .keyfile_key file in these directories is essential for decrypting paths in your settings.toml. Do not delete it if you have a global keyfile configured!