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

refactor(proofs)!: make nonce optional and add missing exports #1073

Merged
merged 10 commits into from
Oct 31, 2022

Conversation

genaris
Copy link
Contributor

@genaris genaris commented Oct 26, 2022

Some refactoring to solve minor issues found during migration to 0.3.0 on AATH:

  • Expose several classes and interfaces from proofs module that were missing (especially for Present Proof V1) and are useful for API usage. This impacts a bit both credentials and discover-features, as there were a few clashes in types and interfaces which needed to be renamed.
  • Make name, version and nonce optional for Indy format in Proofs API (e.g. proposeProof and requestProof methods). If not provided, the framework will generate a nonce by calling the underlying wallet's generateNonce method. This is the same behaviour we had in 0.2.x
  • Remove generateProofRequestNonce method from V1ProofService and ProofService as it is Indy/AnonCreds-specific. It will call directly wallet's generateNonce method

After @TimoGlastra's precise and appropriate suggestion, I moved logic from IndyProofUtils to IndyProofFormatService, resulting in a cleaner V2ProofService (less Indy-specific stuff there).

It's marked as breaking change mainly because of the renaming of some types and interfaces. However it does not change any field besides the aforementioned 'nonce'.

Signed-off-by: Ariel Gentile gentilester@gmail.com

Signed-off-by: Ariel Gentile <gentilester@gmail.com>
@genaris genaris requested a review from a team as a code owner October 26, 2022 02:12
@codecov-commenter
Copy link

codecov-commenter commented Oct 26, 2022

Codecov Report

Merging #1073 (8027f89) into main (a635565) will increase coverage by 0.03%.
The diff coverage is 94.50%.

@@            Coverage Diff             @@
##             main    #1073      +/-   ##
==========================================
+ Coverage   88.22%   88.25%   +0.03%     
==========================================
  Files         679      685       +6     
  Lines       15901    15918      +17     
  Branches     2571     2571              
==========================================
+ Hits        14028    14049      +21     
+ Misses       1865     1862       -3     
+ Partials        8        7       -1     
Impacted Files Coverage Δ
...les/credentials/formats/CredentialFormatService.ts 100.00% <ø> (ø)
...ntials/formats/indy/IndyCredentialFormatService.ts 87.43% <0.00%> (ø)
...les/credentials/protocol/v2/V2CredentialService.ts 90.07% <ø> (ø)
...c/modules/discover-features/DiscoverFeaturesApi.ts 96.29% <ø> (ø)
packages/core/src/modules/proofs/ProofService.ts 68.96% <ø> (+4.44%) ⬆️
...otocol/v1/handlers/V1ProposePresentationHandler.ts 84.61% <ø> (ø)
packages/core/src/wallet/WalletApi.ts 90.74% <0.00%> (-3.50%) ⬇️
...ges/core/src/modules/credentials/CredentialsApi.ts 86.91% <88.88%> (ø)
...ules/proofs/formats/indy/IndyProofFormatService.ts 85.76% <96.96%> (+1.34%) ⬆️
packages/core/src/modules/proofs/ProofsApi.ts 85.26% <100.00%> (ø)
... and 15 more

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

Discussed in AFJ WG call 27-10: make nonce optional in proof request, and generate it if not present in the indy proof format service.

Signed-off-by: Ariel Gentile <gentilester@gmail.com>
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
@genaris genaris force-pushed the fix/proofs-exports branch from d11a692 to 7f54248 Compare October 27, 2022 19:18
@genaris genaris changed the title fix(proofs): add missing exports refactor(proofs)!: make nonce optional and add missing exports Oct 27, 2022
@genaris
Copy link
Contributor Author

genaris commented Oct 27, 2022

Discussed in AFJ WG call 27-10: make nonce optional in proof request, and generate it if not present in the indy proof format service.

So I've finally converted this PR from a mere 'expose types PR' (the ones that @blu3beri likes the most 😛 ) to a refactoring that impacts three modules 😅. Not completely sure about the naming conventions I've selected, but happy to hear any feedback about it!

@genaris genaris requested review from berendsliedrecht and a team October 27, 2022 22:49
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
@genaris genaris requested a review from TimoGlastra October 28, 2022 13:02
…ame and version also optional

Signed-off-by: Ariel Gentile <gentilester@gmail.com>
@genaris genaris enabled auto-merge (squash) October 31, 2022 11:47
@genaris genaris merged commit 7850a27 into openwallet-foundation:main Oct 31, 2022
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.

4 participants