latticearc 0.6.0

Production-ready post-quantum cryptography. Hybrid ML-KEM+X25519 by default, all 4 NIST standards (FIPS 203–206), post-quantum TLS, and FIPS 140-3 backend — one crate, zero unsafe.
Documentation
//! Error types for pure-Rust type operations.
//!
//! Provides error types for configuration validation, key lifecycle transitions,
//! and other non-FFI error conditions.

use thiserror::Error;

use crate::types::key_lifecycle::KeyLifecycleState;

/// Errors for pure-Rust type operations in the [`types`](crate::types) module.
///
/// These errors cover non-FFI conditions like configuration validation
/// and key lifecycle state transition violations.
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum TypeError {
    /// Invalid key lifecycle state transition attempted.
    #[error("Invalid key state transition: {from:?} -> {to:?}")]
    InvalidStateTransition {
        /// Original key state.
        from: KeyLifecycleState,
        /// Target key state that was rejected.
        to: KeyLifecycleState,
    },

    /// Configuration validation error.
    #[error("Configuration error: {0}")]
    ConfigurationError(String),

    /// Unrecognized encryption scheme string in legacy data.
    #[error("Unknown encryption scheme: {0}")]
    UnknownScheme(String),
}

/// A specialized Result type for [`types`](crate::types) operations.
pub type Result<T> = std::result::Result<T, TypeError>;