#[derive(Debug, thiserror::Error)]
pub enum PasskeyError {
#[error("malformed clientDataJSON: {0}")]
ClientData(String),
#[error("unexpected clientData type: expected `{expected}`, got `{got}`")]
WrongType { expected: &'static str, got: String },
#[error("challenge mismatch")]
ChallengeMismatch,
#[error("origin `{0}` is not allowed")]
BadOrigin(String),
#[error("rpIdHash does not match the configured rp_id")]
RpIdMismatch,
#[error("user-present flag not set")]
UserNotPresent,
#[error("malformed authenticator data: {0}")]
AuthData(String),
#[error("unsupported or malformed COSE key: {0}")]
CoseKey(String),
#[error("signature verification failed")]
BadSignature,
#[error("signature counter did not increase (possible cloned authenticator)")]
CounterRegression,
#[error("CBOR decode error: {0}")]
Cbor(String),
}