Skip to content
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

Credential and Presentation attributes mime-type adjustments #820

Open
bobozaur opened this issue May 2, 2023 · 4 comments
Open

Credential and Presentation attributes mime-type adjustments #820

bobozaur opened this issue May 2, 2023 · 4 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@bobozaur
Copy link
Contributor

bobozaur commented May 2, 2023

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:

  • Plain { value: String }
  • Encoded { value: String, mime_type: MaybeKnown<MimeType> }

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:

  • if it's Plain, it's just a string,
  • if it's Encoded, it's a base64 encoded string that then has to be processed according to the MimeType.

Steps:
- [ ] Wrap MimeType in MaybeKnown
- [ ] Create and use the AttrValue enum in both attribute types.

@bobozaur bobozaur added the good first issue Good for newcomers label May 2, 2023
@SumantxD
Copy link

SumantxD commented May 5, 2023

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

@bobozaur bobozaur assigned bobozaur and SumantxD and unassigned bobozaur May 6, 2023
@SumantxD
Copy link

SumantxD commented May 6, 2023

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

@bobozaur
Copy link
Contributor Author

bobozaur commented May 6, 2023

@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 added a commit to SumantxD/aries-vcx that referenced this issue May 7, 2023
@SumantxD
Copy link

SumantxD commented May 7, 2023

@bobozaur I have tried solving the issue here is the PR #831

SumantxD added a commit to SumantxD/aries-vcx that referenced this issue May 7, 2023
Signed-off-by: SumantxD <st72365@gmail.com>
SumantxD added a commit to SumantxD/aries-vcx that referenced this issue May 9, 2023
Signed-off-by: SumantxD <st72365@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants