pub enum CrabError {
InvalidInput(String),
CryptoError(String),
KeyError(String),
AuthenticationFailed,
SignatureVerificationFailed,
InvalidNonce(String),
InvalidCiphertext(String),
EncodingError(String),
RandomError(String),
SerializationError(String),
FeatureNotEnabled(String),
Internal(String),
}Expand description
Unified error type for all CrabGraph operations.
This enum covers encryption, key derivation, signing, and other cryptographic operations. Error messages are designed to be safe for logging and never expose sensitive data like keys or plaintexts.
Variants§
InvalidInput(String)
Invalid input parameter (e.g., wrong key size, empty data)
CryptoError(String)
Cryptographic operation failed (e.g., decryption, verification)
KeyError(String)
Key generation or derivation failed
AuthenticationFailed
Authentication tag verification failed
SignatureVerificationFailed
Signature verification failed
InvalidNonce(String)
Invalid nonce or IV
InvalidCiphertext(String)
Invalid ciphertext format or encoding
EncodingError(String)
Encoding/decoding error (base64, hex, etc.)
RandomError(String)
Random number generation failed
SerializationError(String)
Serialization/deserialization error
FeatureNotEnabled(String)
Feature not enabled (requires feature flag)
Internal(String)
Internal error (should not happen in normal operation)
Implementations§
Source§impl CrabError
impl CrabError
Sourcepub fn invalid_input(msg: impl Into<String>) -> Self
pub fn invalid_input(msg: impl Into<String>) -> Self
Creates an InvalidInput error with a formatted message.
Sourcepub fn crypto_error(msg: impl Into<String>) -> Self
pub fn crypto_error(msg: impl Into<String>) -> Self
Creates a CryptoError with a formatted message.
Sourcepub fn encoding_error(msg: impl Into<String>) -> Self
pub fn encoding_error(msg: impl Into<String>) -> Self
Creates an EncodingError with a formatted message.
Sourcepub fn random_error(msg: impl Into<String>) -> Self
pub fn random_error(msg: impl Into<String>) -> Self
Creates a RandomError with a formatted message.