Skip to main content

darkpool_crypto/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Clone, PartialEq, Eq, Error)]
4pub enum CryptoError {
5    #[error("Invalid key format")]
6    InvalidKey,
7    #[error("Point not on curve")]
8    InvalidPoint,
9    #[error("Point not in prime-order subgroup")]
10    SubgroupCheckFailed,
11    #[error("Invalid field operation")]
12    InvalidOperation,
13    #[error("Encryption failed: {0}")]
14    EncryptionFailed(String),
15    #[error("Decryption failed: {0}")]
16    DecryptionFailed(String),
17    #[error("Field conversion error")]
18    FieldConversion,
19    #[error("Input exceeds maximum length of {max} bytes (got {got})")]
20    InputTooLong { max: usize, got: usize },
21}