open-standards/smart-byte/smart-byte-rs/crates/smart-byte-oidc4vc/src/error.rs
Transaction Science 0155cbea85 ingest wave G (final): smart-byte-oidc4vc · OpenID for Verifiable Credentials
Smart Byte (1 crate, ~4370 LOC, 82 tests)
  smart-byte-oidc4vc   OID4VCI 13 (issuer/AS metadata, pre-auth + auth-code
                       offers, deep-link encode/decode, token endpoint,
                       c_nonce + nonce endpoint, credential endpoint with
                       single + batch proofs + deferred + encryption hooks,
                       notification endpoint). OID4VP 23 (VpAuthRequest/
                       VpAuthResponse with DCQL + PE 2.0 +
                       presentation_definition_uri, client_id_scheme
                       constants, response_mode constants). SIOPv2 (request
                       + ID-token with sub_jwk). DCQL (path walker, value
                       constraints, claim_sets, credential_sets).
                       Presentation Exchange 2.0 (definition + submission
                       validation). DPoP (RFC 9449 with htm/htu/iat/ath/
                       nonce + skew validator). Bitstring Status List 2021
                       + IETF Token Status List (1/2/4/8-bit slots,
                       GZIP+base64url). HAIP + EUDI Wallet ARF profile
                       evaluators (PID + mDL vct/doctype constants).

This closes the planned ingest run for batches 4-7. The open-standards
monorepo now contains 22 net-new crates from this session across the
three workspaces.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 17:45:05 -04:00

81 lines
2.5 KiB
Rust

//! Typed errors for OID4VC issuance, presentation, SIOP, DPoP, DCQL,
//! status lists, and profile validation (HAIP, EUDI ARF).
use thiserror::Error;
/// Single error enum covering every fallible operation in this crate.
#[derive(Debug, Error)]
pub enum OidcError {
/// JSON encode / decode error.
#[error("json error: {0}")]
Json(String),
/// Base64 / base64url codec error.
#[error("base64 error: {0}")]
Base64(String),
/// URL parse error.
#[error("url error: {0}")]
Url(String),
/// Authorisation-server metadata invalid.
#[error("authorization server metadata: {0}")]
AsMetadata(String),
/// Credential-issuer metadata invalid.
#[error("credential issuer metadata: {0}")]
IssuerMetadata(String),
/// Credential offer malformed or expired.
#[error("credential offer: {0}")]
Offer(String),
/// Token endpoint error (`invalid_request`, `invalid_grant`, …).
#[error("token endpoint: {0}")]
Token(String),
/// Credential endpoint error (`invalid_credential_request`, …).
#[error("credential endpoint: {0}")]
Credential(String),
/// Notification endpoint error (`invalid_notification_id`, …).
#[error("notification endpoint: {0}")]
Notification(String),
/// DPoP proof error (RFC 9449).
#[error("dpop: {0}")]
Dpop(String),
/// DCQL query / match error.
#[error("dcql: {0}")]
Dcql(String),
/// Presentation Exchange definition / submission error.
#[error("presentation: {0}")]
Presentation(String),
/// SIOPv2 self-issued ID-token error.
#[error("siop: {0}")]
Siop(String),
/// Status list (Bitstring / Token Status List) error.
#[error("status list: {0}")]
StatusList(String),
/// HAIP profile constraint violation.
#[error("haip: {0}")]
Haip(String),
/// EUDI ARF profile constraint violation.
#[error("eudi: {0}")]
Eudi(String),
/// Cryptographic verification failed.
#[error("signature: {0}")]
Signature(String),
/// Generic invalid input.
#[error("invalid input: {0}")]
Invalid(String),
}
impl From<serde_json::Error> for OidcError {
fn from(e: serde_json::Error) -> Self {
OidcError::Json(e.to_string())
}
}
impl From<base64::DecodeError> for OidcError {
fn from(e: base64::DecodeError) -> Self {
OidcError::Base64(e.to_string())
}
}
impl From<url::ParseError> for OidcError {
fn from(e: url::ParseError) -> Self {
OidcError::Url(e.to_string())
}
}