hyperledger / aries-vcx

aries-vcx is set of crates to work with DIDs, DID Documents, DIDComm, Verifiable Credentials and Hyperledger Aries.
https://didcomm.org
Apache License 2.0
124 stars 83 forks source link

Credential and Presentation attributes mime-type adjustments #820

Open bobozaur opened 1 year ago

bobozaur commented 1 year ago

The attributes (CredentialAttr and PresentationAttr) could benefit from handling the value and mime-type pair in a different manner. Right now both fields are deserialized and handling would have to be done based on whether a MimeType is present or not.

A better idea would be to use an AttrValue #[serde(flatten)] enum with two variants:

Note the MaybeKnown enum use, which would also be a beneficial addition in case we get a mime_type we don't recognize.

Having the attribute value deserialized this way would make handling it easier since we can match and deduce that:

Steps:

SumantxD commented 1 year ago

@bobozaur I would like to work on this issue could you assign it to me plz.

SumantxD commented 1 year ago

@bobozaur can you help me locate Attribute struct inside the file structure, i'am struggling to find it

bobozaur commented 1 year ago

@SumantxD My bad, the struct rename was already done but I was looking at an older branch when drafting this issue. I updated the issue description to match the main branch.

SumantxD commented 1 year ago

@bobozaur I have tried solving the issue here is the PR https://github.com/hyperledger/aries-vcx/pull/831