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

fix: miscellaneous issue credential v2 fixes #769

Merged

Conversation

NB-MikeRichardson
Copy link
Contributor

Changes from ICV2 PR review comments which were left to do after the merge

@NB-MikeRichardson NB-MikeRichardson requested a review from a team as a code owner May 12, 2022 07:38
@codecov-commenter
Copy link

codecov-commenter commented May 12, 2022

Codecov Report

Merging #769 (c2bf770) into main (0c3cc49) will decrease coverage by 0.04%.
The diff coverage is 78.57%.

@@            Coverage Diff             @@
##             main     #769      +/-   ##
==========================================
- Coverage   87.53%   87.48%   -0.05%     
==========================================
  Files         435      435              
  Lines       10666    10678      +12     
  Branches     1891     1897       +6     
==========================================
+ Hits         9336     9342       +6     
- Misses       1268     1274       +6     
  Partials       62       62              
Impacted Files Coverage Δ
...rc/modules/credentials/CredentialsModuleOptions.ts 100.00% <ø> (ø)
packages/core/src/modules/credentials/index.ts 100.00% <ø> (ø)
...redentials/protocol/v2/CredentialMessageBuilder.ts 87.40% <ø> (+0.57%) ⬆️
...les/credentials/protocol/v2/V2CredentialService.ts 93.83% <ø> (-0.02%) ⬇️
...s/protocol/v2/messages/V2IssueCredentialMessage.ts 100.00% <ø> (ø)
...s/protocol/v2/messages/V2OfferCredentialMessage.ts 100.00% <ø> (ø)
...protocol/v2/messages/V2RequestCredentialMessage.ts 100.00% <ø> (ø)
.../modules/credentials/services/CredentialService.ts 100.00% <ø> (ø)
...s/protocol/v1/handlers/V1OfferCredentialHandler.ts 71.05% <50.00%> (ø)
...s/protocol/v2/handlers/V2OfferCredentialHandler.ts 71.79% <50.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c3cc49...c2bf770. Read the comment docs.

@TimoGlastra TimoGlastra changed the title Fix: Miscellaneous Fixes from Review Comments fix: credential fixes from review comments May 12, 2022
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.

Nice improvements @NB-MikeRichardson!

Left some notes

attachId: this.generateId(),
format: 'hlindy/[email protected]',
}
format: 'hlindy/[email protected]',
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Contributor

Choose a reason for hiding this comment

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

This also doesn't seem resolved

@NB-MikeRichardson NB-MikeRichardson changed the title fix: credential fixes from review comments fix: issue credential v2 - fixes from review comments May 12, 2022
@@ -41,7 +39,7 @@ interface NegotiateProposalOptions extends BaseOptions {
interface OfferCredentialOptions extends BaseOptions {
credentialRecordId?: string
connectionId?: string
protocolVersion: CredentialProtocolVersion
protocolVersion?: CredentialProtocolVersion
Copy link
Contributor

Choose a reason for hiding this comment

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

protocolVersion shouldn't be optional for offerCredential, as it's the start of the protocol in this case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That change breaks loads of stuff. I suggest leaving this for now

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for this? It is required in the current main branch.

Not keen on merging this change as it's now not clear you're required to pass the protocolVersion

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 have reverted it back to being mandatory for now.

As stated I would like to allot a PR just for this one Protocol Version field as I find it bewilderingly confusing and I want to fully understand it and do it properly.

attachId: this.generateId(),
format: 'hlindy/[email protected]',
}
format: 'hlindy/[email protected]',
Copy link
Contributor

Choose a reason for hiding this comment

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

This also doesn't seem resolved

Comment on lines 98 to -105
const metadata = this.metadata.get(CredentialMetadataKeys.IndyCredential)
let credentialIds: string[] = []

let ids: string[] = []
if (this.credentials) {
credentialIds = this.credentials.map((c) => c.credentialRecordId)
ids = this.credentials.map((c) => c.credentialRecordId)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

With the change to || [] I think we can just do:

const credentialIds = this.credentials.map(c => c.credentialRecordId)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That change doesn't work
Test fails

Copy link
Contributor

Choose a reason for hiding this comment

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

Then we should look at why it is failing. The types indicate the array is always defined, so somewhere it's assigning an undefined value where it should be an empty array I think. Please investigate.

packages/core/src/utils/composeAutoAccept.ts Outdated Show resolved Hide resolved
@@ -221,6 +221,7 @@ export class V2CredentialService extends CredentialService {
const options: ServiceOfferCredentialOptions = {
credentialFormats: proposal.credentialFormats,
comment: proposal.comment,
protocolVersion: credentialRecord.protocolVersion,
}
const message = await this.createOfferAsResponse(credentialRecord, options)
Copy link
Contributor

Choose a reason for hiding this comment

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

When creating an offer as response we can take the protocol version from the credential record

Copy link
Contributor

Choose a reason for hiding this comment

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

This also seems unresolved @NB-MikeRichardson

@TimoGlastra TimoGlastra added this to the v0.2.0 milestone May 19, 2022
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.

I think only the issue with credentials being undefined is worth looking at, but otherwise looks good

@TimoGlastra TimoGlastra changed the title fix: issue credential v2 - fixes from review comments fix: miscellaneous issue credential v2 fixes May 25, 2022
@TimoGlastra TimoGlastra merged commit 537b51e into openwallet-foundation:main May 25, 2022
@NB-MikeRichardson NB-MikeRichardson deleted the fix/icv2comments branch May 27, 2022 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants