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

CredentialTypeRepository implementation in VerifierApp #436

Merged

Conversation

keesgeluk
Copy link
Contributor

  • RequestDocument obtains content from the CredentialTypeRepository
  • Display names/values from the CredentialTypeRepository when showing the document added methods to get specific MdocCredentialTypes and MdocDataElements

Fixes #401

  • [ x] Tests pass

RequestDocument obtains content from the CredentialTypeRepository
Display names/values from the CredentialTypeRepository when showing the document
added methods to get specific MdocCredentialTypes and MdocDataElements

Signed-off-by: Kees Geluk <[email protected]>
it.dataElements.associateBy { el -> el.attribute.identifier }.toMap()
)
}.toMap()
}
Copy link
Contributor

@davidz25 davidz25 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we're keeping an extra set of data elements in this class, in addition to each type? This seems wrong.

But more, importantly, I don't think getMdocDataElement() should be on the repository in the first place. Why not put it on MdocCredentialType and then add a lookup function for mDL doctype so the code becomes:

val mdocCredentialType = repo.getMdocCredentialType(docType)
val mdocDataElement = mdocCredentialType?.getMdocDataElement(namespaceName, dataElementName)

(Also, would like both get*() functions to be O(1) .. that is, use a hashtable, not a list)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the Lists to Map in the context of the MdocCredentialType. In the context of the overall CredentialType the usage of a Map is arbitrary. The key could be the mdoc doctype , but also a VC Credential Type, so I kept a here a List and added a method to lookup the VC Credential Type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By changing the Lists to Maps, a separate method getMdocElements is not needed anymore

- changes in documentation
- refactoring Lists to Maps

Signed-off-by: Kees Geluk <[email protected]>
Copy link
Contributor

@davidz25 davidz25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@davidz25 davidz25 merged commit 20861f4 into openwallet-foundation-labs:main Dec 20, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document type repository
2 participants