Skip to content

feat(core): add W3cCredentialApi #1398

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

Merged

Conversation

karimStekelenburg
Copy link
Contributor

This PR adds a W3cCredentialApi class with methods for storing, removing, getting, and finding credentials and credential records.

Funded by the Ontario Government

@karimStekelenburg karimStekelenburg requested a review from a team March 22, 2023 12:59
@codecov-commenter
Copy link

codecov-commenter commented Mar 22, 2023

Codecov Report

Merging #1398 (41d1588) into main (d9cfc7d) will decrease coverage by 5.97%.
The diff coverage is 71.42%.

@@            Coverage Diff             @@
##             main    #1398      +/-   ##
==========================================
- Coverage   80.46%   74.49%   -5.97%     
==========================================
  Files         834      805      -29     
  Lines       19833    19064     -769     
  Branches     3198     3062     -136     
==========================================
- Hits        15958    14202    -1756     
- Misses       3867     4858     +991     
+ Partials        8        4       -4     
Impacted Files Coverage Δ
packages/core/tests/jsonld.ts 91.66% <ø> (ø)
packages/core/src/modules/vc/W3cCredentialsApi.ts 41.17% <41.17%> (ø)
packages/core/src/agent/AgentModules.ts 100.00% <100.00%> (ø)
...ckages/core/src/modules/vc/W3cCredentialService.ts 79.41% <100.00%> (ø)
...ckages/core/src/modules/vc/W3cCredentialsModule.ts 100.00% <100.00%> (ø)
.../core/src/modules/vc/W3cCredentialsModuleConfig.ts 100.00% <100.00%> (ø)
packages/core/src/modules/vc/index.ts 100.00% <100.00%> (ø)
packages/core/src/modules/vc/models/index.ts 100.00% <100.00%> (ø)

... and 136 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@TimoGlastra
Copy link
Contributor

Also, should we call it W3cCredentialsApi (plural). as we have CredentialsApi, ProofsApi, AnonCredsApi, etc..

@karimStekelenburg
Copy link
Contributor Author

Also, should we call it W3cCredentialsApi (plural). as we have CredentialsApi, ProofsApi, AnonCreds

I noticed the service was renamed to W3cVcService, so I did the same for the API.

@TimoGlastra
Copy link
Contributor

In main it's still W3cCredentialService? https://github.com/hyperledger/aries-framework-javascript/blob/main/packages/core/src/modules/vc/W3cCredentialService.ts

I think I like W3cCredentialsApi more I think, and it aligns with the credentials module naming more maybe?

@karimStekelenburg
Copy link
Contributor Author

In main it's still W3cCredentialService? https://github.com/hyperledger/aries-framework-javascript/blob/main/packages/core/src/modules/vc/W3cCredentialService.ts

I think I like W3cCredentialsApi more I think, and it aligns with the credentials module naming more maybe?

Yes but it looks like you renamed the module to W3cVcModule? I don't really mind, but I do think it's nice to stay consistent across the services and modules :)

@TimoGlastra
Copy link
Contributor

Ah yes, the module is called W3cVcModule. What do you prefer? I think we can change the name of the module if we want

@karimStekelenburg
Copy link
Contributor Author

Ah yes, the module is called W3cVcModule. What do you prefer? I think we can change the name of the module if we want

Haha, this is an interesting one. I like W3cVc because it's nice and short. However, the current CredentialsModule implies that the CredentialsModule deals with non-verifiable credentials.

I'd suggest we rename everything to W3cCredentialsFoo for now and change it later if needed. That way we at least stay consistent.

Note: I do think this rename should make it plural (e.g. W3cCredentialsModule), as this is also the case for the ProofsModule and CredentialsModule.

Copy link
Contributor

@TimoGlastra TimoGlastra left a comment

Choose a reason for hiding this comment

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

It seems CI is failing.

Add W3cCredentialApi class with methods for storing, removing, getting, and finding credentials and credential records.

feat(W3cVcModule): add W3cCredentialApi to the module
test(W3cVcModule): expect W3cCredentialApi to be registered with dependencyManager

Signed-off-by: Karim Stekelenburg <karim@animo.id>
…lRecordsByQuery

Signed-off-by: Karim Stekelenburg <karim@animo.id>
…om W3cCredentialApi class

Signed-off-by: Karim Stekelenburg <karim@animo.id>
refactor(vc): rename W3cCredentialApi to W3cVcApi
feat(vc): register W3cVcApi in dependency manager

test(W3cVcApi.test.ts): add test for storing a credential record using W3cVcModule

refactor(W3cVcModule.test.ts): rename W3cCredentialApi to W3cVcApi
fix(openid4vc-client.e2e.test.ts): remove unnecessary whitespace and add missing semicolon

Signed-off-by: Karim Stekelenburg <karim@animo.id>
Signed-off-by: Karim Stekelenburg <karim@animo.id>
Signed-off-by: Karim Stekelenburg <karim@animo.id>
Signed-off-by: Karim Stekelenburg <karim@animo.id>
Signed-off-by: Karim Stekelenburg <karim@animo.id>
Signed-off-by: Karim Stekelenburg <karim@animo.id>
Signed-off-by: Karim Stekelenburg <karim@animo.id>
Signed-off-by: Karim Stekelenburg <karim@animo.id>
@karimStekelenburg karimStekelenburg enabled auto-merge (squash) April 4, 2023 13:10
@karimStekelenburg karimStekelenburg merged commit c888736 into openwallet-foundation:main Apr 4, 2023
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.

3 participants