-
Notifications
You must be signed in to change notification settings - Fork 204
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
fix: miscellaneous issue credential v2 fixes #769
Conversation
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
…N object Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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.
Nice improvements @NB-MikeRichardson!
Left some notes
packages/core/src/modules/credentials/formats/indy/IndyCredentialFormatService.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/credentials/formats/indy/IndyCredentialFormatService.ts
Outdated
Show resolved
Hide resolved
attachId: this.generateId(), | ||
format: 'hlindy/[email protected]', | ||
} | ||
format: 'hlindy/[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.
same
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.
This also doesn't seem resolved
packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
packages/core/src/modules/credentials/protocol/v2/V2CredentialService.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/credentials/repository/CredentialExchangeRecord.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
@@ -41,7 +39,7 @@ interface NegotiateProposalOptions extends BaseOptions { | |||
interface OfferCredentialOptions extends BaseOptions { | |||
credentialRecordId?: string | |||
connectionId?: string | |||
protocolVersion: CredentialProtocolVersion | |||
protocolVersion?: CredentialProtocolVersion |
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.
protocolVersion shouldn't be optional for offerCredential, as it's the start of the protocol in this case
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.
That change breaks loads of stuff. I suggest leaving this for now
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.
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
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 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.
packages/core/src/modules/credentials/formats/indy/IndyCredentialFormatService.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/credentials/formats/indy/IndyCredentialFormatService.ts
Outdated
Show resolved
Hide resolved
attachId: this.generateId(), | ||
format: 'hlindy/[email protected]', | ||
} | ||
format: 'hlindy/[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.
This also doesn't seem resolved
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) | ||
} | ||
|
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.
With the change to || []
I think we can just do:
const credentialIds = this.credentials.map(c => c.credentialRecordId)
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.
That change doesn't work
Test fails
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.
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.
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
Signed-off-by: Mike Richardson <[email protected]>
@@ -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) |
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.
When creating an offer as response we can take the protocol version from the credential record
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.
This also seems unresolved @NB-MikeRichardson
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 think only the issue with credentials being undefined is worth looking at, but otherwise looks good
Changes from ICV2 PR review comments which were left to do after the merge