#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum KeychainError {
#[error("data too short at offset {offset}: need {needed} more bytes, have {available}")]
TooShort {
offset: usize,
needed: usize,
available: usize,
},
#[error("not a keychain: signature {found:#010x} != 'kych' (0x6b796368)")]
BadSignature { found: u32 },
#[error("DbBlob (schema metadata) table not found or malformed")]
DbBlobMissing,
#[error("bad blob magic {found:#010x} at offset {offset}: expected 0xFADE0711")]
BadBlobMagic { found: u32, offset: usize },
#[error("keychain schema has no table of type {table_type:#010x}")]
MissingTable { table_type: u32 },
#[error("decryption failed: invalid padding (wrong password or corrupt blob)")]
DecryptionFailed,
#[error("invalid key/IV length")]
InvalidKeyLength,
#[error("keychain is LOCKED: the DBKey did not unwrap (wrong or missing login password)")]
Locked,
}