-
Notifications
You must be signed in to change notification settings - Fork 3
fix: improve deserialization robustness and simplify generics #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
There was a problem hiding this 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
CredentialFormatCollectiontrait fromWallet,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.
daniel-mader
left a comment
There was a problem hiding this 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. 🤩
Description of change
This pull request introduces two major improvements: it makes
CredentialIssuerMetadatadeserialization more robust and simplifies the crate's overall design by removing a complex generic abstraction.Previously, if a credential issuer's metadata contained even a single invalid entry within the
credential_configurations_supportedmap, 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_supportedwhich:A new unit test,
test_deserialize_with_invalid_entryhas been added to verify this new, more resilient behavior.The generic
CredentialFormatCollectiontrait has been removed fromWallet,CredentialIssuer,AuthorizationDetailsObjectand other related structs throughout theoid4vciandoid4vc-managercrates.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_entryDefinition of Done checklist
Add an
xto the boxes that are relevant to your changes.