aescrypt_rs/aliases/mod.rs
1// src/aliases/mod.rs
2
3//! Global secure type aliases — secure-gate v0.5.5+
4//! Maximum overkill, minimal duplication, audit-perfect
5
6use secure_gate::{dynamic_alias, fixed_alias, random_alias};
7
8// ─────────────────────────────────────────────────────────────────────────────
9// Core secrets — must stay separate
10// ─────────────────────────────────────────────────────────────────────────────
11fixed_alias!(Aes256Key, 32); // Used: session key, HMAC key, encryption
12fixed_alias!(Iv16, 16); // Used: public IV, session IV
13fixed_alias!(PlainTextBlock16, 16); // Used: decrypted blocks in stream
14fixed_alias!(Salt16, 16); // Used: PBKDF2/ACKDF salt
15
16// ─────────────────────────────────────────────────────────────────────────────
17// Random aliases
18// ─────────────────────────────────────────────────────────────────────────────
19random_alias!(RandomAes256Key, 32);
20random_alias!(RandomIv16, 16);
21
22// ─────────────────────────────────────────────────────────────────────────────
23// Overkill public-but-sensitive — auto-zeroed on drop
24// ─────────────────────────────────────────────────────────────────────────────
25fixed_alias!(EncryptedSessionBlock48, 48); // Perfect name — used in session.rs + decrypt_cbc_loop
26fixed_alias!(PrevCiphertextBlock16, 16); // Used in session.rs + stream/context.rs
27fixed_alias!(RingBuffer64, 64); // Used in stream/context.rs
28fixed_alias!(SessionHmacTag32, 32); // Used in session.rs + stream/utils.rs
29
30// ─────────────────────────────────────────────────────────────────────────────
31// Dynamic secrets
32// ─────────────────────────────────────────────────────────────────────────────
33dynamic_alias!(MasterKey, Vec<u8>);
34dynamic_alias!(Password, String);
35dynamic_alias!(Token, String);
36
37// Re-exported crypto primitives — users get them from the same `aliases::*` import
38pub use crate::crypto::hmac::{HmacSha256, HmacSha512};