rustywallet_hd/
error.rs

1//! Error types for HD wallet operations.
2
3use thiserror::Error;
4
5/// Errors that can occur during HD wallet operations.
6#[derive(Debug, Clone, PartialEq, Eq, Error)]
7pub enum HdError {
8    /// Invalid seed length
9    #[error("Invalid seed length: expected 64 bytes, got {0}")]
10    InvalidSeedLength(usize),
11
12    /// Invalid derived key (zero or >= curve order)
13    #[error("Invalid derived key (zero or >= curve order)")]
14    InvalidDerivedKey,
15
16    /// Invalid derivation path
17    #[error("Invalid derivation path: {0}")]
18    InvalidPath(String),
19
20    /// Hardened derivation requires private key
21    #[error("Hardened derivation requires private key")]
22    HardenedFromPublic,
23
24    /// Invalid extended key format
25    #[error("Invalid extended key format")]
26    InvalidExtendedKey,
27
28    /// Invalid checksum
29    #[error("Invalid checksum")]
30    InvalidChecksum,
31
32    /// Invalid child number
33    #[error("Invalid child number: {0}")]
34    InvalidChildNumber(u32),
35
36    /// Key derivation failed
37    #[error("Key derivation failed")]
38    DerivationFailed,
39
40    /// Invalid version bytes
41    #[error("Invalid version bytes")]
42    InvalidVersion,
43}