rustywallet_signer/
error.rs

1//! Error types for rustywallet-signer
2
3use thiserror::Error;
4
5/// Errors that can occur during signing and verification operations
6#[derive(Debug, Error)]
7pub enum SignerError {
8    /// Invalid signature format or length
9    #[error("Invalid signature format")]
10    InvalidSignature,
11
12    /// Invalid recovery id (must be 0-3)
13    #[error("Invalid recovery id: {0}")]
14    InvalidRecoveryId(u8),
15
16    /// Failed to recover public key from signature
17    #[error("Failed to recover public key")]
18    RecoveryFailed,
19
20    /// Signature verification failed
21    #[error("Signature verification failed")]
22    VerificationFailed,
23
24    /// Invalid message hash length (must be 32 bytes)
25    #[error("Invalid message hash length: expected 32, got {0}")]
26    InvalidHashLength(usize),
27
28    /// Signing operation failed
29    #[error("Signing failed: {0}")]
30    SigningFailed(String),
31
32    /// Invalid hex string
33    #[error("Invalid hex: {0}")]
34    InvalidHex(String),
35
36    /// Invalid base64 string
37    #[error("Invalid base64: {0}")]
38    InvalidBase64(String),
39
40    /// Invalid address format
41    #[error("Invalid address format")]
42    InvalidAddress,
43}