docs: add comprehensive doc comments to all Rust source files
Document every public function, struct, field, constant, and non-trivial private function across idfoto-core and idfoto-cli. Module-level docs explain each module's role in the architecture. Comments explain the "why" (crypto choices, algorithm design, data model rationale) not just the "what". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,37 @@
|
||||
//! # idfoto-core
|
||||
//!
|
||||
//! Platform-agnostic core library for the idfoto password manager.
|
||||
//!
|
||||
//! This crate is intentionally **bytes-in/bytes-out** -- it performs no filesystem
|
||||
//! access, no network I/O, and no git operations. All inputs arrive as byte slices
|
||||
//! or typed structs, and all outputs are returned as byte vectors or typed structs.
|
||||
//! This design makes the crate portable to WASM, Android (via JNI/UniFFI), and iOS
|
||||
//! without any conditional compilation or platform shims.
|
||||
//!
|
||||
//! ## Modules
|
||||
//!
|
||||
//! - [`error`] -- The unified error type ([`IdfotoError`]) used across the crate.
|
||||
//! - [`crypto`] -- Argon2id key derivation and XChaCha20-Poly1305 authenticated
|
||||
//! encryption. This is the low-level "encrypt bytes / decrypt bytes" layer.
|
||||
//! - [`entry`] -- The vault data model: [`Entry`] (full credential),
|
||||
//! [`ManifestEntry`] (searchable index metadata), and [`Manifest`] (the entry
|
||||
//! index that lets you list/search without decrypting every entry).
|
||||
//! - [`vault`] -- Typed wrappers around [`crypto`] that serialize structs to JSON
|
||||
//! before encrypting, and deserialize after decrypting.
|
||||
//! - [`imgsecret`] -- DCT-based steganography for embedding and extracting a
|
||||
//! 256-bit secret in a JPEG image. This is the novel component that provides the
|
||||
//! second authentication factor.
|
||||
//!
|
||||
//! ## Crypto pipeline
|
||||
//!
|
||||
//! ```text
|
||||
//! passphrase (UTF-8 bytes) || image_secret (32 bytes from reference JPEG)
|
||||
//! -> Argon2id(salt=vault_salt, m=64MiB, t=3, p=4)
|
||||
//! -> master_key (32 bytes)
|
||||
//! -> XChaCha20-Poly1305(nonce=random 24 bytes)
|
||||
//! -> encrypted entry/manifest
|
||||
//! ```
|
||||
|
||||
pub mod error;
|
||||
pub use error::{IdfotoError, Result};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user