Skip to main content

auths_sdk/domains/federation/
error.rs

1//! Typed errors for federation-as-attestor.
2
3use thiserror::Error;
4
5/// A federation attestation failure.
6#[derive(Debug, Error)]
7pub enum FederationError {
8    /// The OIDC token failed signature/issuer/audience/expiry validation.
9    #[error("OIDC token invalid: {0}")]
10    TokenInvalid(String),
11    /// The token carried no `nonce` claim to bind against the challenge.
12    #[error("token is missing the nonce claim")]
13    NonceMissing,
14    /// The token's `nonce` did not match the expected challenge nonce (replay).
15    #[error("token nonce does not match the expected challenge nonce")]
16    NonceMismatch,
17    /// The token carried no `iss` claim to identify the attestor.
18    #[error("token is missing the issuer (iss) claim")]
19    IssuerMissing,
20    /// The attested lifecycle fact is not supported by the token's claims.
21    #[error("attested claim not supported by the token: {0}")]
22    ClaimNotInToken(String),
23    /// A typed identifier (idp / group / nonce) was empty or malformed.
24    #[error("invalid identifier: {0}")]
25    InvalidId(String),
26    /// The subject DID could not be parsed into a KEL prefix.
27    #[error("invalid subject DID: {0}")]
28    InvalidSubject(String),
29    /// Anchoring the attestation into the subject's KEL failed.
30    #[error("failed to anchor attestation into subject KEL: {0}")]
31    AnchorFailed(String),
32}