-
Notifications
You must be signed in to change notification settings - Fork 207
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
refactor(credentials): generic credentials module #841
refactor(credentials): generic credentials module #841
Conversation
Awesome! |
Signed-off-by: Timo Glastra <[email protected]>
7bb0f13
to
5261292
Compare
Codecov Report
@@ Coverage Diff @@
## main #841 +/- ##
==========================================
- Coverage 87.59% 87.55% -0.05%
==========================================
Files 458 463 +5
Lines 11176 11064 -112
Branches 1897 1820 -77
==========================================
- Hits 9790 9687 -103
+ Misses 1324 1315 -9
Partials 62 62
Continue to review full report at Codecov.
|
I did not do a code review yet, but would this not be the point to rename some stuff to anoncreds instead of indy? Or will that happen in another PR? |
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.
These changes look very good but I wonder if we should not merge this PR until after the w3c/JsonLd issue credentials v2 PR is merged.
Otherwise that is going to create a large number of conflicts.
So I am wondering if this PR should go into 0.3.0-pre rather than main??
With the already large number of changes doing that in a follow up PR would be nicer I think. We can then rename all indy related services/objects etc to anoncreds |
I would rather get this in 0.2.0 mainly because its a lot of changes and keeping that up to date with 0.3.0 branch is a hassle. Also there are numerous improvements here that would be good to have in 0.2.0. I'll be happy to address the merge conflicts in your w3c/jsonld branch @NB-MikeRichardson! I think that will be easier than merging this into 0.3.0. So proposed plan from my side would be:
Does that sound good? |
Yes I'm ok with that, but there is no reason why the jsonld credentials can't go into 0.3.0-pre before you merge these changes across from main. I think that PR is pretty much ready to be merged (I made some changes last week, I think all comments are resolved) |
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.
There's a lot here Timo! Thanks for the hard work
I'm okay with this, but I am a little worried about the increase in complexity added here.
I'm also fairly concerned about the typing that the end user receives, as my code editor was unable to give me a clear indication of what should go in my call, for instance in agent.credentials.acceptOffer()
. In order to figure it out I had to dive into AFJ code to look at the interface.
This shouldn't happen, I'll take a look at this.
That's understandable. It's just really complex to serve both the "I want simplicity" and the "I want modularity" camps. The approach I took is making the internal code a bit complexer so we achieve modularity without sacrificing simplicity in the public API. Happy to look at other paths, but IMO this is a good trade-off to make |
@JamesKEbert could you show me what it looks like for you? I have full auto complete for the credentialFormats |
Signed-off-by: Timo Glastra <[email protected]>
This PR overhauls the credentials module to make it ready for modularization. This PR became a lot bigger than anticipated, but it are mostly consistency and cosmetic changes that don't change the behaviour. It also doesn't change the public api of the agent, except for a few interface fixes (e.g. removing a property that shouldn't have been exposed in the first place)
Main item addressed in this PR:
Dynamic Interfaces for credential formats
Instead of creating interfaces for each method defining the supported credential formats.
We can now dynamically configure the services and credential formats. This will make it possible to extract the formats and services out of core while still keeping a fully typed interface.
You can declare which services and formats you use like this (currently not needed as it has defaults, this will later be automatically detected based on your agent configuration):
Now when I use the agent it will restrict which protocol versions I can use and which credentialFormats
So even though everything is still in core, it's fullly decoupled now.
You define a format like this:
To make sure this won't cause issues with extensions later on I've extended the api a bit to make a bit more generic and less focused on the indy use case (adding interface method we don't need right now).
In addition I made some smaller changes:
CredentialProtocolVersion
. You now need to use string values. Because we can dynamically register new versions, an enum doesn't really work.