Crate amaters_core

Crate amaters_core 

Source
Expand description

§AmateRS Core - Fully Homomorphic Encrypted Database Engine

amaters-core is the kernel of the AmateRS distributed database, providing Encryption-in-Use capabilities via TFHE (Fully Homomorphic Encryption).

§Core Principles

  • Encryption in Use: All data remains encrypted during computation
  • Zero Trust: Servers never see plaintext data
  • Deterministic: Reproducible results with cryptographic proofs
  • High Performance: GPU-accelerated FHE operations

§Architecture

AmateRS consists of four core components inspired by Japanese mythology:

ComponentOriginRole
Iwato (岩戸)Heavenly Rock CaveStorage Engine
Yata (八咫鏡)Eight-Span MirrorCompute Engine
Ukehi (宇気比)Sacred PledgeConsensus Layer
Musubi (結び)The KnotNetwork Layer

§Modules

  • error - Comprehensive error types and recovery strategies
  • types - Core types (CipherBlob, Key, Query)
  • traits - Storage engine trait definitions
  • storage - Iwato storage engine (LSM-Tree with WiscKey)
  • compute - Yata FHE execution engine
  • validation - Input validation helpers

§Quick Start

use amaters_core::{
    storage::MemoryStorage,
    traits::StorageEngine,
    types::{CipherBlob, Key},
};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let storage = MemoryStorage::new();

    let key = Key::from_str("secret_data");
    let encrypted = CipherBlob::new(vec![/* encrypted bytes */]);

    storage.put(&key, &encrypted).await?;
    let retrieved = storage.get(&key).await?;

    Ok(())
}

§Feature Flags

  • storage - Enable storage engine (Iwato)
  • compute - Enable FHE compute engine (Yata)
  • parallel - Enable parallel operations with Rayon
  • mmap - Enable memory-mapped storage
  • gpu - Enable GPU acceleration
  • cuda - Enable CUDA backend (requires gpu)
  • metal - Enable Metal backend (requires gpu)

§Security Model

See the technical whitepaper for details on:

  • Threat model and countermeasures
  • Post-quantum security guarantees
  • Key management best practices

§Development Status

Phase 1 (MVP): Basic storage and compute stubs ✅ Phase 2: Full LSM-Tree and FHE integration 🚧 Phase 3: Distributed consensus and GPU acceleration 📋

Re-exports§

pub use error::AmateRSError;
pub use error::ErrorContext;
pub use error::Result;
pub use traits::StorageEngine;
pub use types::CipherBlob;
pub use types::ColumnRef;
pub use types::Key;
pub use types::Predicate;
pub use types::Query;
pub use types::QueryBuilder;
pub use types::Update;
pub use types::col;

Modules§

compute
Compute engine module (Yata - The Eight-Span Mirror)
error
Error handling module for AmateRS
storage
Storage engine module (Iwato - The Rock Cave)
traits
Core trait definitions for AmateRS
types
Core type definitions for AmateRS
utils
Utility functions and helpers for AmateRS
validation
Input validation helpers

Macros§

error_context
Convenience macro for creating error context with automatic location tracking

Constants§

NAME
Library name
VERSION
Library version