#[derive(Debug, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum DisclosureError {
#[error("disclosure is not base64url")]
NotBase64,
#[error("disclosure does not decode to JSON")]
NotJson,
#[error("disclosure is not a [salt, name, value] triple")]
NotATriple,
#[error("disclosure names a reserved claim")]
ReservedClaimName,
}
#[derive(Debug, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum SdJwtError {
#[error("not an SD-JWT: fewer than two segments")]
NotAnSdJwt,
#[error(transparent)]
Disclosure(#[from] DisclosureError),
#[error("issuer-signed JWT is malformed")]
MalformedJwt,
#[error("JWT payload is not a JSON object")]
PayloadNotAnObject,
#[error("unsupported _sd_alg: {0}")]
UnsupportedHashAlg(String),
#[error("{0} disclosure(s) matched nothing in the token")]
UnusedDisclosures(usize),
#[error("digest {0} appears more than once")]
DuplicateDigest(String),
#[error("disclosure for '{0}' collides with a cleartext claim")]
ClaimCollision(String),
}