#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum CredentialError {
#[error("the first `@context` must be `{expected}`")]
InvalidContext {
expected: &'static str,
},
#[error("`type` must include `{0}`")]
MissingType(&'static str),
#[error("`credentialSubject` is empty")]
NoSubject,
#[error("`{until}` precedes `{from}`")]
InvalidValidity {
from: &'static str,
until: &'static str,
},
#[error("a JWT encodes one subject; the credential has {0}")]
MultipleSubjects(usize),
#[error("JWT claim `{0}` is missing")]
MissingClaim(&'static str),
#[error("JWT claim `{claim}` is invalid: {reason}")]
InvalidClaim {
claim: &'static str,
reason: String,
},
#[error("JWT claim `{claim}` does not match `{property}`")]
ClaimMismatch {
claim: &'static str,
property: &'static str,
},
#[error("enveloped {kind} has media type `{media_type}`, not `{expected}`")]
UnsupportedMediaType {
kind: &'static str,
media_type: String,
expected: &'static str,
},
#[error("`{0}` is not a `data:` URL")]
NotDataUrl(String),
}