Skip to main content

void_core/crypto/
mod.rs

1//! Cryptographic primitives for void.
2//!
3//! Low-level crypto primitives (AEAD, envelope, KDF, KeyVault) are defined in
4//! the `void-crypto` crate. This module re-exports them and adds void-core-specific
5//! extensions:
6//! - `CommitReader` with `decrypt_metadata()`, `decrypt_shard()`, etc.
7//! - `collect_ancestor_content_keys_vault()` (needs ObjectStore + Commit types)
8
9// Local reader module stays in void-core because it needs:
10// - ObjectStore + Commit types for collect_ancestor_content_keys_vault()
11pub mod reader;
12
13// Re-export all void-crypto public API
14pub use void_crypto::{
15    // AEAD
16    decrypt, decrypt_and_parse, decrypt_to_vec, encrypt, unwrap_shard_key, wrap_shard_key,
17    AAD_COMMIT, AAD_INDEX, AAD_MANIFEST, AAD_METADATA, AAD_REPO_MANIFEST, AAD_SHARD,
18    AAD_SHARD_KEY, AAD_STAGED, AAD_STASH,
19    // Envelope
20    decrypt_envelope, encrypt_with_envelope, generate_key_nonce, MAGIC_V1,
21    // KDF
22    derive_key, derive_key_for_purpose, derive_scoped_key, generate_key, ContentKey, KeyNonce,
23    KeyPurpose, KeyRing, Nonce, RepoSecret, SecretKey,
24    // Vault
25    KeyVault,
26    // Encrypted blob newtypes
27    EncryptedBlob, EncryptedCommit, EncryptedIndex, EncryptedManifest, EncryptedMetadata,
28    EncryptedRepoManifest, EncryptedShard, EncryptedStaged, EncryptedStash,
29    // CID newtypes
30    CommitCid, ManifestCid, MetadataCid, RepoManifestCid, ShardCid,
31    // Error types
32    CryptoError, CryptoResult,
33};
34
35
36// Re-export reader types at crate::crypto level for backwards compatibility
37pub use reader::{
38    collect_ancestor_content_keys_vault, decrypt_shard_data, CommitPlaintext, CommitReader,
39    DecryptedShard,
40};