snapper_box/crypto.rs
1//! Types and traits serving as the cryptographic primitives of `snapper-box`'s cryptosystem. <span
2//! style="color:red">**HAZMAT**</span>
3//!
4//! This module provides both originating keys ([`RootKey`]) and derived keys ([`DerivedKey`]) as well
5//! as nonce types and other hazardous material.
6//!
7//! Originating keys ([`RootKey`]) are randomly generated, and have methods for their usage in
8//! generating derived keys, as well methods for encrypting the key with a password for safe at-rest
9//! storage.
10//!
11//! Derived keys ([`DerivedKey`]) are generated via a KDF over the originating key's entropy pool and a
12//! context string incorporating both a random nonce and a namespace.
13//!
14//! This module also provides wrapper types for shuffling data back and forth between encrypted and
15//! unencrypted representations, as well as the ability to, optionally, transparently compress plaintext
16//! before encryption.
17//!
18//! # <span style="color:red">**DANGER**</span>
19//!
20//! This module deals in low level cryptographic details, and it can be incredibly dangerous to interact
21//! with directly. It is advisable to not deal with this module directly, and instead use a higher level
22//! API.
23
24mod key;
25mod types;
26
27#[doc(inline)]
28pub use key::{DerivedKey, EncryptedDerivedKey, EncryptedRootKey, Key, Nonce, RootKey};
29#[doc(inline)]
30pub use types::{CipherText, ClearText};