Skip to main content

hyde_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum HydeError {
5    #[error("Backend error: {0}")]
6    Backend(Box<dyn std::error::Error + Send + Sync>),
7
8    #[error("No TEE hardware available")]
9    NoHardware,
10
11    #[error("Seal failed: PCR mismatch")]
12    SealMismatch,
13
14    #[error("Recovery failed: {0}")]
15    RecoveryFailed(String),
16
17    #[error("Invalid key material")]
18    InvalidKey,
19
20    #[error("Primary key not initialized")]
21    PrimaryKeyNotFound,
22
23    #[error("Serialization error: {0}")]
24    Serialization(String),
25}
26
27pub type Result<T> = std::result::Result<T, HydeError>;