sicpa-dlab / openid4vc-rs

OpenID4VCI and OpenID4VP implementations in Rust as services.
Apache License 2.0
7 stars 1 forks source link

Credential response type is incorrect #38

Open TimoGlastra opened 1 year ago

TimoGlastra commented 1 year ago

What

The credential property in the credential response is typed as CredentialFormatProfileOrEncoded, where it can be either an encoded string, or a CredentialFormatProfile. However, the CredentialFormatProfile type is the type used for the credentials_supported and credentials from the credential offer / credential issuer metadata, which is not the same structure that is being used in the credential response (that should contain the actual credential.

For the types the credential response can be, we should look at the defined credential format profiles and what their return type should be.

It seems that for the two JWT formats it's a JWT string (so not just base64url, as there's . in it), for JSON-LD it's the json of a credential. For iso mdl, it is indeed a base64-url encoded string.

I think we should extend the credential respnose to also have credential format specific properties

berendsliedrecht commented 1 year ago

Working on this now, and if we want to add this the user must supply the credential as well to the evaluate function, along with everything else, which might be a bit odd. Two alternatives that I can think of:

  1. Remove the credential return value and jus return subject_id and proof_of_posession.
  2. Do step 1 and add a method that takes a credential and returns its representation according to the specification.