-
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
feat: add oob proof proposal #1370
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1370 +/- ##
==========================================
- Coverage 87.27% 85.43% -1.85%
==========================================
Files 780 780
Lines 18706 18717 +11
Branches 3210 3216 +6
==========================================
- Hits 16326 15991 -335
- Misses 2373 2719 +346
Partials 7 7
... and 9 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. |
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.
Thanks for this PR @Zzocker!
I'm okay with the changes, but we need to make sure to implement it for all protocol versions and make sure we can also receive connectionless proposals in addition to create them.
could you also add some new tests for this?
Yes, I wanted to add test for the changes but I wasn't sure whether to create a new test file or add in an existing test file. When verifier receives the proposal message, the proposal handler function will be invoked and proposal will be proceeded, and if auto accept proof is true, verifier will send the proof request. Do we need to have any aditional logic for reciving the proposal message ? |
d760d9a
to
cb4badf
Compare
I have added oob proof proposal for both ( |
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.
Grest changes @Zzocker. I have some concerns on the connection between oob and proofs. This is something that needs to be fixes across the framework.
@@ -416,6 +416,12 @@ export class V1ProofProtocol extends BaseProofProtocol implements ProofProtocol< | |||
|
|||
let proofRecord = await this.findByThreadAndConnectionId(agentContext, proofRequestMessage.threadId, connection?.id) | |||
|
|||
if (!proofRecord) { | |||
// Proof request not bound to any connection: requests_attach in OOB msg |
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 doesn't mean the proof record is not bound to any connection, and it means if i know the thread id i respond to this exchange even though not involved.
We should update this logic to be fully integrated with the oob module:
- we look for the oob record
- if oob is connectionless/now has a connection afterwards we allow the proof record to not have a connection
I'd like to solve this generically for both connectionless/non-connectionless exchanges with attached messages. Is this needed for this 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.
Sorry for the wrong code comment, connection-less proof requests will also not be linked to a connection.
- In case of connection-less proof request both
findByThreadAndConnectionId
andfindByThread
will return null proofRecord. - In case of oob proof proposal
findByThreadAndConnectionId
will return null since the connection is not linked to any proofRecord, butfindByThread
will return proofRecord atProposalSent
state.
For now, can I replace the comment to?
if (!proofRecord) {
// Proof request bound to a proofRecord by threadId: proof proposal in OOB msg
// TODO integrate with oob module
proofRecord = await this.findByThreadAndConnectionId(messageContext.agentContext, requestMessage.threadId)
if (proofRecord) proofRecord.connectionId = connection?.id
}
}) | ||
await faberAgent.oob.receiveInvitation(outOfBandInvitation) | ||
testLogger.test('Faber waits for proof proposal message from Alice') | ||
let faberProofExchangeRecord = await waitForProofExchangeRecord(faberAgent, { |
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.
Can you use waitForProofExchangeRecordSubject? This method can have timing issues
@@ -38,6 +38,17 @@ export interface ProposeProofOptions<PPs extends ProofProtocol[] = ProofProtocol | |||
parentThreadId?: string | |||
} | |||
|
|||
/** | |||
* Interface for ProofsApi.createProofProposal. Will create an out of band request. |
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.
* Interface for ProofsApi.createProofProposal. Will create an out of band request. | |
* Interface for ProofsApi.createProofProposal. Will create an out of band proposal. |
@@ -396,6 +396,12 @@ export class V2ProofProtocol<PFs extends ProofFormatService[] = ProofFormatServi | |||
connection?.id | |||
) | |||
|
|||
if (!proofRecord) { | |||
// Proof request not bound to any connection: requests_attach in OOB msg | |||
proofRecord = await this.findByThreadAndConnectionId(messageContext.agentContext, requestMessage.threadId) |
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 comments here
}) | ||
}) | ||
|
||
test('Alice start with oob proof proposal for Faber with auto-accept enabled and both agents having a mediator', async () => { |
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.
Specific reason you added this test? We have a lot of tests that do almost the same and it's making updates harder.
So if there's a specific reason for this test great, but otherwise we can maybe remove it?
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.
Right, For the oob proof proposal, we want to test
- After the proof exchange flow is completed,
- The holder should have all three proof messages
proposalMessage
,requestMessage
, andpresentationMessage
- proof exchange record should have
nonNull
connection id.
- The holder should have all three proof messages
I will remove the first and last tests and add the above assertion in 2nd test.
Signed-off-by: Pritam Singh <[email protected]>
Signed-off-by: Pritam Singh <[email protected]>
Signed-off-by: Pritam Singh <[email protected]>
Signed-off-by: Pritam Singh <[email protected]>
cb4badf
to
a822161
Compare
Discussed during WG call. @TimoGlastra will take another look |
No description provided.