Support for the OpenID4VCI Batch Credential : credential
Notable changes:
support for batch credential request for both Wallet and CredentialIssuer (Server).
Regarding the OpenID4VCI extension points: CredentialFormats now needs a generic type (default is WithParameters:
pub enum CredentialFormats<C = WithParameters>
where
C: FormatExtension + DeserializeOwned,
This ensure that any datatype that has a format field, also includes a credentialformat-specific field(s). E.g. for jwt_vc_json there need to be a credential_definition field.
However, in the (batch) credential response, instead of this additional credentialformat-specific field(s) there needs to be a credential field with a credentialformat-specific Credential. In this case the additional generic type for CredentialFormats needs to be CredentialFormats<WithCredential>. At the moment this type is still defaulted to serde_json::Value for all credential formats, but this will change in the future.
Links to any relevant issues
fixes #50
How the change has been tested
The Batch Credential Flow is tested in oid4vc-manager/tests/oid4vci/pre_authorized_code.rs.
By using:
#[rstest::rstest]
#[case(false)]
#[case(true)]
oid4vc-manager/tests/oid4vci/pre_authorized_code.rs now test both single credential flow and batch credential flow.
Serializing is tested in: oid4vci/src/credential_response.rs
Definition of Done checklist
Add an x to the boxes that are relevant to your changes.
[x] I have followed the contribution guidelines for this project
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] I have added tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass locally with my changes
Description of change
Support for the OpenID4VCI Batch Credential : credential
Notable changes:
CredentialFormats
now needs a generic type (default isWithParameters
:This ensure that any datatype that has a
format
field, also includes a credentialformat-specific field(s). E.g. forjwt_vc_json
there need to be acredential_definition
field.However, in the (batch) credential response, instead of this additional credentialformat-specific field(s) there needs to be a
credential
field with a credentialformat-specific Credential. In this case the additional generic type forCredentialFormats
needs to beCredentialFormats<WithCredential>
. At the moment this type is still defaulted toserde_json::Value
for all credential formats, but this will change in the future.Links to any relevant issues
fixes #50
How the change has been tested
The Batch Credential Flow is tested in
oid4vc-manager/tests/oid4vci/pre_authorized_code.rs
. By using:oid4vc-manager/tests/oid4vci/pre_authorized_code.rs
now test both single credential flow and batch credential flow.Serializing is tested in:
oid4vci/src/credential_response.rs
Definition of Done checklist
Add an
x
to the boxes that are relevant to your changes.