Skip to content

Conversation

@nanderstabel
Copy link
Collaborator

Description of change

This pull request introduces two major improvements: it makes CredentialIssuerMetadata deserialization more robust and simplifies the crate's overall design by removing a complex generic abstraction.

  1. Robust Deserialization
    Previously, if a credential issuer's metadata contained even a single invalid entry within the credential_configurations_supported map, the entire deserialization process would fail. This made the system brittle and unable to handle minor inconsistencies in an issuer's published metadata.

This has been fixed by implementing a custom deserializer deserialize_credential_configurations_supported which:

  • Attempts to deserialize each entry in the map individually.
  • Filters out and ignores any malformed entries instead of failing.
  • Ensures that all valid credential configurations are loaded successfully.

A new unit test, test_deserialize_with_invalid_entry has been added to verify this new, more resilient behavior.

  1. Generic Simplification
    The generic CredentialFormatCollection trait has been removed from Wallet, CredentialIssuer, AuthorizationDetailsObject and other related structs throughout the oid4vci and oid4vc-manager crates.

This refactoring significantly simplifies the codebase, and makes the types easier to work with by removing a layer of generic complexity that was no longer necessary. All related structs now use concrete types for credential formats.

Links to any relevant issues

n/a

How the change has been tested

Added unit test test_deserialize_with_invalid_entry

Definition of Done checklist

Add an x to the boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@nanderstabel nanderstabel self-assigned this Oct 10, 2025
@nanderstabel nanderstabel added the Enhancement New feature or improvement to an existing feature label Oct 10, 2025
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
oid4vc-core/src/test_utils.rs 65.00% <ø> (ø)
oid4vc-manager/src/managers/credential_issuer.rs 100.00% <ø> (ø)
oid4vc-manager/src/servers/credential_issuer.rs 91.12% <100.00%> (ø)
oid4vci/src/authorization_details.rs 97.12% <100.00%> (ø)
oid4vci/src/credential_format_profiles/mod.rs 75.00% <ø> (+15.00%) ⬆️
...tial_issuer/credential_configurations_supported.rs 100.00% <ø> (ø)
...rc/credential_issuer/credential_issuer_metadata.rs 100.00% <100.00%> (ø)
oid4vci/src/credential_issuer/mod.rs 100.00% <ø> (ø)
oid4vci/src/errors.rs 28.45% <100.00%> (-2.26%) ⬇️
oid4vci/src/wallet/mod.rs 95.67% <100.00%> (-0.06%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nanderstabel nanderstabel changed the title fix: Improve deserialization robustness and simplify generics fix: improve deserialization robustness and simplify generics Oct 10, 2025
@nanderstabel nanderstabel requested a review from Copilot October 10, 2025 12:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request makes credential issuer metadata deserialization more robust and simplifies the codebase by removing generic abstractions. The changes improve system resilience when handling malformed credential configurations and reduce code complexity by eliminating the CredentialFormatCollection trait.

  • Implements custom deserialization that filters out invalid credential configuration entries instead of failing entirely
  • Removes generic CredentialFormatCollection trait from Wallet, CredentialIssuer, and related structs
  • Adds robust error handling with fallback logic for subject syntax type selection

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
oid4vci/src/wallet/mod.rs Removes generics from Wallet struct and adds fallback logic for subject syntax types
oid4vci/src/errors.rs Simplifies Content-Type header assertion logic
oid4vci/src/credential_issuer/mod.rs Removes generics from CredentialIssuer struct
oid4vci/src/credential_issuer/credential_issuer_metadata.rs Adds custom deserializer and test for robust credential configuration handling
oid4vci/src/credential_issuer/credential_configurations_supported.rs Uses concrete type instead of generic for credential format
oid4vci/src/credential_format_profiles/mod.rs Removes CredentialFormatCollection trait and related generic abstractions
oid4vci/src/authorization_request.rs Removes generics from AuthorizationRequest struct
oid4vci/src/authorization_details.rs Removes generics from AuthorizationDetailsObject struct
oid4vc-manager/tests/oid4vci/pre_authorized_code.rs Updates test to use simplified Server type
oid4vc-manager/tests/oid4vci/authorization_code.rs Updates test to use simplified Server and Manager types
oid4vc-manager/tests/common/memory_storage.rs Updates Storage trait implementation
oid4vc-manager/src/storage.rs Removes generics from Storage trait
oid4vc-manager/src/servers/credential_issuer.rs Removes generics from Server struct and handler functions
oid4vc-manager/src/managers/credential_issuer.rs Removes generics from CredentialIssuerManager struct
oid4vc-core/src/test_utils.rs Adds Default derive to MockVerifier

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nanderstabel nanderstabel marked this pull request as ready for review October 10, 2025 12:53
Copy link
Contributor

@daniel-mader daniel-mader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean. Much awesome. Merge plz. 🤩

@nanderstabel nanderstabel merged commit 4cbf854 into dev Oct 10, 2025
3 checks passed
@nanderstabel nanderstabel deleted the fix/strict-deserialization branch October 10, 2025 14:06
@nanderstabel nanderstabel restored the fix/strict-deserialization branch December 17, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants