-
Notifications
You must be signed in to change notification settings - Fork 204
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
feat: add credential info to access attributes #254
feat: add credential info to access attributes #254
Conversation
This is dependant on #253, so once that's merged I'll rebase |
Codecov Report
@@ Coverage Diff @@
## main #254 +/- ##
==========================================
+ Coverage 88.96% 89.01% +0.04%
==========================================
Files 178 179 +1
Lines 3381 3422 +41
Branches 389 403 +14
==========================================
+ Hits 3008 3046 +38
- Misses 373 376 +3
Continue to review full report at Codecov.
|
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.
I like the addition of credential preview and metadata but to be honest I don't think it's necessary to do the transformation from the array or the formatting operations. That should be the responsibility of the UI layer and not the framework. I realize that you put some effort into the implementation of these functions but maybe we could rather move them to Aries Bifold. What do you think?
From my experience from UI, you do the iteration through attributes over an array anyway:
Object.keys(attributes).map(key => <Item label={key} value={attributes[key]} />
Then it's more convenient to write:
attributes.map(attr => <Item label={attr.key} value={attr.value} />
I'm fine with removing the formatting stuff, not so making it an array. An array works well for one level of nesting, not so for multiple levels (IMO). Besides the natural structure of a credential is dict like, not an array. Making it an array would tailor the structure to the UI (which is the responsibility of the UI layer as you said) Are you okay with that? |
Yeah, of course, my point wasn't about making it array because of convenience for UI. But it makes sense to have the claims as a dict because it aligns more with the W3C spec 👍 (if I understand the spec correctly 🤷♂️ 😄 ) |
Thanks for your efforts here @TimoGlastra! I agree with you that keeping the existing dictionary structure allows for more flexibility with claim formats. |
Signed-off-by: Timo Glastra <[email protected]>
Signed-off-by: Timo Glastra <[email protected]>
Signed-off-by: Timo Glastra <[email protected]>
as discussed this is the responsiblity of the UI layer, not the framework Signed-off-by: Timo Glastra <[email protected]>
50c922d
to
25f7163
Compare
OK. Thanks for the feedback both. Updated and ready to merge now |
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.
Sorry I wanted to go through that yet again after rebase. Overall good, just one non-blocking note about the naming.
// TODO: Ideally we don't throw here, but instead store that it's not equal. | ||
// the credential may still have value, and we could just respond with an ack | ||
// status of fail | ||
if (credentialRecord.credentialAttributesValues) { |
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.
It seems we could shorten credentialAttributesValues
just to credentialAttributes
. Does it contain a list of CredentialPreviewAttribute
right? I thought that it contains just values from credential preview attributes but the call convertAttributesToValues(attributesValues)
confused me a little bit. But maybe I'm missing something 🤷♂️
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.
If we only store the values we lose the mime-types. These are not stored by indy. So you'd need to extract them from one of the exchanged messages.
I think it's a burden the mime-types are not encoded in the values itself like data:image/png;base64,xxxxxxxx
, but until that's the case (which is the pattern I've seen for W3C credentials) we need to store the preview attributes.
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.
But credentialAttributes
sounds fine. Will update
Signed-off-by: Timo Glastra <[email protected]>
Fixes #190
Fixes #187
Example: