rose-squared-sdk 0.1.0

Privacy-preserving encrypted search SDK implementing the SWiSSSE protocol with forward/backward security and volume-hiding, compilable to WebAssembly
Documentation
//! Error types for the Rose Squared SDK.

use thiserror::Error;

/// The primary error type for all Rose Squared operations.
#[derive(Error, Debug)]
pub enum VaultError {
    /// Error during key derivation (Argon2id or HKDF).
    #[error("KDF error: {0}")]
    Kdf(String),

    /// Error during cryptographic operations (AES-GCM).
    #[error("Crypto error: {0}")]
    Crypto(String),

    /// A ciphertext was tampered with or corrupted on the server.
    #[error("Tampered entry detected (GCM MAC mismatch)")]
    Tampered,

    /// A SWiSSSE volume limit was exceeded.
    #[error("Volume limit exceeded: {max}")]
    VolumeLimitExceeded {
        /// The maximum number of entries allowed.
        max: usize
    },

    /// The requested document could not be found in the state table.
    #[error("Document not found: {0}")]
    DocNotFound(String),

    /// Standard I/O error.
    #[error("I/O error: {0}")]
    Io(#[from] std::io::Error),

    /// Error from the underlying storage backend.
    #[error("Storage error: {0}")]
    StorageError(String),

    /// Error during bincode serialization/deserialization.
    #[error("Serialization error: {0}")]
    Serialization(#[from] bincode::Error),
}