use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum FileVaultError {
#[error("i/o error: {0}")]
Io(#[from] std::io::Error),
#[error("not a CoreStorage volume: signature at offset 88 was {found:#06x}, expected 0x5343 (\"CS\")")]
NotCoreStorage {
found: u16,
},
#[error("unsupported encryption method {found}: only 2 (AES-XTS-128) is supported")]
UnsupportedEncryptionMethod {
found: u32,
},
#[error("required metadata structure not found: {what}")]
MetadataStructureMissing {
what: &'static str,
},
#[error("base64 decode failed for {what}")]
Base64 {
what: &'static str,
},
#[error("key unwrap failed for {what}: wrong password or corrupt wrapped key")]
KeyUnwrap {
what: &'static str,
},
#[error("value out of range: {what}")]
OutOfRange {
what: &'static str,
},
}