rustywallet_import/
error.rs

1//! Error types for import operations.
2
3use thiserror::Error;
4
5/// Errors that can occur during import operations.
6#[derive(Debug, Error)]
7pub enum ImportError {
8    /// Invalid format - cannot parse input
9    #[error("Invalid format: {0}")]
10    InvalidFormat(String),
11
12    /// Invalid checksum in encoded data
13    #[error("Invalid checksum")]
14    InvalidChecksum,
15
16    /// Invalid WIF format
17    #[error("Invalid WIF: {0}")]
18    InvalidWif(String),
19
20    /// Invalid hex format
21    #[error("Invalid hex: {0}")]
22    InvalidHex(String),
23
24    /// Invalid mnemonic phrase
25    #[error("Invalid mnemonic: {0}")]
26    InvalidMnemonic(String),
27
28    /// Invalid mini private key
29    #[error("Invalid mini key: {0}")]
30    InvalidMiniKey(String),
31
32    /// Invalid BIP38 encrypted key
33    #[error("Invalid BIP38: {0}")]
34    InvalidBip38(String),
35
36    /// Wrong password for BIP38 decryption
37    #[error("Wrong password")]
38    WrongPassword,
39
40    /// Decryption failed
41    #[error("Decryption failed: {0}")]
42    DecryptionFailed(String),
43
44    /// Key derivation failed
45    #[error("Key derivation failed: {0}")]
46    KeyDerivationFailed(String),
47
48    /// Unsupported format
49    #[error("Unsupported format: {0}")]
50    UnsupportedFormat(String),
51
52    /// Private key out of valid range
53    #[error("Private key out of range")]
54    KeyOutOfRange,
55}
56
57/// Result type alias for import operations.
58pub type Result<T> = std::result::Result<T, ImportError>;