Back to Ente

ente-core

rust/core/README.md

2.0.341.6 KB
Original Source

ente-core

Common Rust code for Ente apps.

Modules

ModuleDescription
authAuthentication helpers (signup/login/recovery, SRP credentials)
cryptoCryptographic utilities (pure Rust, libsodium-wire-compatible)
httpHTTP client for Ente API
urlsURL construction utilities

Auth

High-level authentication helpers for Ente clients:

  • Derive KEK/login key from password (SRP)
  • Decrypt master key, secret key and token after authentication
  • Signup key generation
  • Account recovery

šŸ“– Full Auth Docs

Crypto

Pure Rust cryptography, byte-compatible with JS/Dart clients.

SubmoduleAlgorithmUse Case
secretboxXSalsa20-Poly1305Encrypt keys, small data
blobXChaCha20-Poly1305Encrypt metadata
streamXChaCha20-Poly1305Encrypt large files (4MB chunks)
sealedX25519 + XSalsa20-Poly1305Anonymous public-key encryption
argonArgon2idPassword-based key derivation
kdfBLAKE2bSubkey derivation
hashBLAKE2bCryptographic hashing
keys-Key generation

Quick Start

rust
use ente_core::crypto;

crypto::init().unwrap();

let key = crypto::keys::generate_key();
let encrypted = crypto::secretbox::encrypt(b"Hello", &key).unwrap();
let decrypted = crypto::secretbox::decrypt_box(&encrypted, &key).unwrap();

šŸ“– Full Crypto Docs

Development

bash
cargo fmt      # format
cargo clippy   # lint
cargo build    # build
cargo test     # test