use thiserror::Error;
#[derive(Error, Debug)]
pub enum TpkSigError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("APK is raw (unsigned)")]
ApkIsRaw,
#[error("No signer found in signature block")]
NoSigner,
#[error("No signature data found")]
NoSignature,
#[error("No digest found for signature")]
NoDigest,
#[error("Invalid signed data format")]
InvalidSignedData,
#[error("Signature scheme v3 is not supported yet")]
V3NotSupported,
#[error("Signature verification failed: {0}")]
VerificationFailed(String),
#[error("Public key parse error: {0}")]
PubKeyError(String),
#[error("Unsupported signature algorithm: 0x{0:x}")]
UnsupportedAlgorithm(u32),
#[error("Digest algorithm mismatch")]
DigestMismatch,
#[error("Invalid APK structure: {0}")]
InvalidApkStructure(&'static str),
}