use thiserror::Error;
use crate::fetcher::ProofFetchError;
#[derive(Debug)]
pub struct Claim {
pub uri: String,
pub claim_type: ClaimType,
}
#[derive(Debug)]
pub enum ClaimType {
PlainUri,
DataUri(ClaimService),
}
#[derive(Debug)]
pub enum ClaimService {
Forgejo,
Gitea,
}
impl Claim {
pub fn new(text: &str) -> Self {
Claim {
uri: text.to_owned(),
claim_type: ClaimType::PlainUri,
}
}
}
#[derive(Default, Debug)]
pub struct ClaimVerificationResult {
pub result: bool,
}
#[derive(Error, Debug)]
pub enum ClaimVerificationError {
#[error("proof fetching error")]
ProofFetch(#[from] ProofFetchError),
#[error("claim and service mismatch error")]
ServiceMismatch,
#[error("proof processing error")]
ProofProcessing,
#[error("claim processing error")]
ClaimProcessing,
#[error("unknown claim verification error")]
Unknown,
}
#[derive(Error, Debug)]
pub enum ClaimMatchingError {
#[error("claim processing error")]
ClaimProcessing,
#[error("unknown claim matching error")]
Unknown,
}