1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum SignError {
8 #[error("I/O error: {0}")]
10 Io(#[from] std::io::Error),
11
12 #[error("JSON error: {0}")]
14 Json(#[from] serde_json::Error),
15
16 #[error("Base64 decode error: {0}")]
18 Base64(#[from] base64::DecodeError),
19
20 #[error("Signature error: {0}")]
22 Signature(#[from] ed25519_dalek::SignatureError),
23
24 #[error("Invalid key: {0}")]
26 InvalidKey(String),
27
28 #[error("Verification failed: {0}")]
30 VerificationFailed(String),
31
32 #[error("Hash mismatch: expected {expected}, got {actual}")]
34 HashMismatch { expected: String, actual: String },
35
36 #[error("No signatures found in document")]
38 NoSignatures,
39
40 #[error("Invalid signature format: {0}")]
42 InvalidFormat(String),
43}
44
45pub type Result<T> = std::result::Result<T, SignError>;
47