Skip to main content

bsv/compat/
error.rs

1//! Error types for the compatibility layer.
2
3use crate::primitives::error::PrimitivesError;
4use thiserror::Error;
5
6/// Error type for all compatibility layer operations.
7#[derive(Debug, Error)]
8pub enum CompatError {
9    #[error("invalid mnemonic: {0}")]
10    InvalidMnemonic(String),
11
12    #[error("invalid entropy: {0}")]
13    InvalidEntropy(String),
14
15    #[error("invalid extended key: {0}")]
16    InvalidExtendedKey(String),
17
18    #[error("cannot derive hardened child from public key")]
19    HardenedFromPublic,
20
21    #[error("derivation depth exceeded (max 255)")]
22    DepthExceeded,
23
24    #[error("invalid derivation path: {0}")]
25    InvalidPath(String),
26
27    #[error("invalid child key")]
28    InvalidChild,
29
30    #[error("unusable seed")]
31    UnusableSeed,
32
33    #[error("checksum mismatch")]
34    ChecksumMismatch,
35
36    #[error("invalid magic bytes")]
37    InvalidMagic,
38
39    #[error("HMAC verification failed")]
40    HmacMismatch,
41
42    #[error("invalid ciphertext: {0}")]
43    InvalidCiphertext(String),
44
45    #[error("sender public key required")]
46    SenderKeyRequired,
47
48    #[error("recovery failed: {0}")]
49    RecoveryFailed(String),
50
51    #[error("primitives error: {0}")]
52    Primitives(#[from] PrimitivesError),
53}