chore: reconcile Plan 1A branch with idfoto→relicario rename
Renames crate directories and sweeps identifiers so Plan 1B can reference
the post-rename names throughout.
- git mv crates/idfoto-{core,cli,wasm} → crates/relicario-{core,cli,wasm}
- sed sweep: idfoto_core/idfoto-core/IdfotoError/IDFOTO_IMAGE/.idfoto/ etc.
- All 128 relicario-core tests pass post-sweep
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
79
crates/relicario-core/src/lib.rs
Normal file
79
crates/relicario-core/src/lib.rs
Normal file
@@ -0,0 +1,79 @@
|
||||
//! # relicario-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 ([`RelicarioError`]).
|
||||
//! - [`crypto`] — Argon2id KDF (length-prefixed inputs, Zeroizing output) and
|
||||
//! XChaCha20-Poly1305 AEAD with VERSION_BYTE 0x02.
|
||||
//! - [`ids`] — `ItemId`, `FieldId`, and content-addressed `AttachmentId`.
|
||||
//! - [`time`] — unix-seconds + `MonthYear` for card expiries.
|
||||
//! - [`item_types`] — Per-type cores (`LoginCore`, `SecureNoteCore`, etc.) and the
|
||||
//! `ItemCore`/`ItemType` enums.
|
||||
//! - [`item`] — `Item` envelope, `Field`, `FieldKind`, `FieldValue`, `Section`,
|
||||
//! `FieldHistoryEntry`.
|
||||
//! - [`attachment`] — `AttachmentRef`, `AttachmentSummary`, encrypt/decrypt helpers.
|
||||
//! - [`manifest`] — Browse-without-decrypt index (schema_version 2).
|
||||
//! - [`settings`] — Vault-level retention, generator defaults, attachment caps.
|
||||
//! - [`generators`] — CSPRNG password + BIP39 passphrase generators; zxcvbn
|
||||
//! strength gate.
|
||||
//! - [`vault`] — Typed encrypt/decrypt wrappers (Item, Manifest, VaultSettings).
|
||||
//! - [`imgsecret`] — DCT-based steganography for the second auth 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::{RelicarioError, Result};
|
||||
|
||||
pub mod crypto;
|
||||
pub use crypto::{decrypt, derive_master_key, encrypt, KdfParams, VERSION_BYTE};
|
||||
|
||||
pub mod ids;
|
||||
pub use ids::{AttachmentId, FieldId, ItemId};
|
||||
|
||||
pub mod time;
|
||||
pub use time::{now_unix, MonthYear};
|
||||
|
||||
pub mod item_types;
|
||||
pub use item_types::{ItemCore, ItemType};
|
||||
|
||||
pub mod item;
|
||||
pub use item::{Field, FieldHistoryEntry, FieldKind, FieldValue, Item, Section};
|
||||
|
||||
pub mod attachment;
|
||||
pub use attachment::{decrypt_attachment, encrypt_attachment, AttachmentRef, AttachmentSummary, EncryptedAttachment};
|
||||
|
||||
pub mod manifest;
|
||||
pub use manifest::{Manifest, ManifestEntry, MANIFEST_SCHEMA_VERSION};
|
||||
|
||||
pub mod settings;
|
||||
pub use settings::{
|
||||
AttachmentCaps, Capitalization, CharClasses, GeneratorRequest, HistoryRetention,
|
||||
SymbolCharset, TrashRetention, VaultSettings,
|
||||
};
|
||||
|
||||
pub mod generators;
|
||||
pub use generators::{generate_passphrase, generate_password, rate_passphrase, validate_passphrase_strength, StrengthEstimate};
|
||||
|
||||
pub mod vault;
|
||||
pub use vault::{
|
||||
decrypt_item, decrypt_manifest, decrypt_settings,
|
||||
encrypt_item, encrypt_manifest, encrypt_settings,
|
||||
};
|
||||
|
||||
pub mod imgsecret;
|
||||
Reference in New Issue
Block a user