-
Notifications
You must be signed in to change notification settings - Fork 85
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
CredentialTypeRepository implementation in VerifierApp #436
Conversation
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]>
identity/src/main/java/com/android/identity/credentialtype/CredentialTypeRepository.kt
Show resolved
Hide resolved
it.dataElements.associateBy { el -> el.attribute.identifier }.toMap() | ||
) | ||
}.toMap() | ||
} |
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.
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)
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 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.
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.
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]>
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.
LGTM, thanks
Fixes #401