use thiserror::Error;
#[derive(Error, Debug)]
pub enum DecodingError {
#[error("the decoded QR code is missing the Matrix header")]
Header,
#[error(transparent)]
Utf8(#[from] std::string::FromUtf8Error),
#[error("the QR code contains an invalid verification mode: {0}")]
Mode(u8),
#[error(transparent)]
Read(#[from] std::io::Error),
#[error("the QR code contains a too short shared secret, length: {0}")]
SharedSecret(usize),
#[error("the QR code contains an invalid or unsupported version: {0}")]
Version(u8),
#[error("the QR code contains invalid ed25519 keys: {0}")]
Keys(#[from] vodozemac::KeyError),
}
#[derive(Error, Debug)]
pub enum EncodingError {
#[error(transparent)]
Qr(#[from] qrcode::types::QrError),
#[error("The verification flow id length can't be converted into a u16: {0}")]
FlowId(#[from] std::num::TryFromIntError),
}