Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica
Skip to main content

eidetica/account/
mod.rs

1//! Account system for Eidetica.
2//!
3//! Provides AccountSession access with per-account key storage, database tracking,
4//! and sync preferences.
5//!
6//! An [`Account`] is the private root database of a person, group or app, reached
7//! through [`AccountSession::account`]. Its root ID is distinct from the
8//! instance-local login UUID. Applications store and open direct database
9//! references through the session ([`AccountSession::set_reference`],
10//! [`AccountSession::open_reference`]); there is no mandatory catalog.
11//!
12//! Credentials, key mappings and activation preferences are installation-local;
13//! Account Entries carry references and public Auth. Enrollment remains separate.
14//!
15//! # Architecture
16//!
17//! - **[`Instance`](crate::Instance)**: Manages infrastructure (local login records, system databases, backends)
18//! - **[`AccountSession`]**: Handles contextual operations (database access, key management) via sessions
19//!
20//! Native local records hold authenticated [`CredentialBundle`] credentials and
21//! per-installation tracking. They are not Entries or inputs to Account sync.
22//! The Account's private database stores application references and public Auth;
23//! the existing device-Read grant is retained without redesigning device authority.
24//!
25//! # Key Management
26//!
27//! Keys are Ed25519 keypairs. The root key is encrypted at rest using the account's password
28//! (Argon2id key derivation + AES-256-GCM). Decryption failure IS password verification —
29//! no separate password hash is stored. Each key can authenticate with multiple databases
30//! via SigKey mappings, which are auto-discovered when tracking a database.
31//!
32//! # Sync Settings
33//!
34//! Per-database sync preferences ([`types::SyncSettings`]):
35//! - `sync_enabled`: Master switch
36//! - `sync_on_commit`: Trigger sync on each commit
37//! - `interval_seconds`: Periodic sync interval
38//!
39//! When multiple accounts track the same database, settings are merged to use the most aggressive settings.
40
41pub mod admin;
42mod credentials;
43pub mod crypto;
44mod signer;
45pub use credentials::{CredentialBundle, UnlockedCredentials};
46pub use signer::AccountSigner;
47pub mod errors;
48pub mod key_manager;
49pub(crate) mod local_logins;
50pub(crate) mod local_state;
51mod root;
52pub mod session;
53mod sharing;
54pub mod system_databases;
55pub mod types;
56
57pub use admin::InstanceAdmin;
58pub use errors::AccountError;
59pub use key_manager::AccountKeyManager;
60pub use root::Account;
61pub use session::{AccountSession, DatabaseBuilder};
62pub(crate) use sharing::ticket_locator;
63pub use types::*;