Skip to main content

kimberlite_crypto/
error.rs

1//! Error types for cryptographic operations.
2
3use ed25519_dalek::SignatureError;
4
5/// Errors that can occur during cryptographic operations.
6#[derive(thiserror::Error, Debug)]
7pub enum CryptoError {
8    /// Ed25519 signature verification failed.
9    #[error(transparent)]
10    SignatureError(#[from] SignatureError),
11
12    /// AES-256-GCM decryption failed.
13    ///
14    /// This occurs when:
15    /// - The key is incorrect
16    /// - The nonce is incorrect
17    /// - The ciphertext has been tampered with
18    /// - The authentication tag is invalid
19    #[error("decryption failed: authentication tag mismatch or corrupted ciphertext")]
20    DecryptionError,
21}