use thiserror::Error;
#[derive(Debug, Error)]
pub enum AttestationError {
#[error("failed to canonicalise input: {0}")]
Canonical(#[from] serde_json::Error),
#[error("attestation hash mismatch: expected {expected}, got {actual}")]
HashMismatch {
expected: String,
actual: String,
},
#[error("ed25519 signature is invalid")]
BadSignature,
#[error("signature is not valid base64: {0}")]
InvalidBase64(#[from] base64::DecodeError),
#[error("signature must be 64 bytes after base64-decode; got {0}")]
WrongSignatureLength(usize),
#[error("unsupported algorithm: {0}")]
UnsupportedAlgorithm(String),
#[error("untrusted key URL: {0}")]
UntrustedKey(String),
}