-
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
feat: add support for new out-of-band protocol #531
Conversation
Codecov Report
@@ Coverage Diff @@
## main #531 +/- ##
==========================================
+ Coverage 86.88% 87.38% +0.49%
==========================================
Files 308 316 +8
Lines 6513 6755 +242
Branches 965 1067 +102
==========================================
+ Hits 5659 5903 +244
+ Misses 850 848 -2
Partials 4 4
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 work @jakubkoci! Glad to see the OOB protocol finally being added to AFJ.
I'm not so sure on splitting the createInvitation
from createOobMessage
. Both create an OOB
invitation. And I think we're missing some of the nice combinations here. handshake_protocols
and requests~attach
are not exclusive, so I think it may be easier to just create a single createInvitation
and a single receiveInvitation
method that allows to specify what should be done with handshake protocols / attached messages.
Second point is that I'd rather not merge this PR as is. It feels like we are leaving a lot of TODOs out there, while I would rather just add OOB as a whole, where we have really thought about all implementation details. There are still a lot of unknowns with connection reuse, connectionless, did-exchange and an OOB record that I would rather keep it in a separate OOB branch for now. What do you think?
public readonly goal?: string | ||
|
||
// TODO what type is it, is there any enum or should we create a new one | ||
public readonly accept: string[] = [] |
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.
No enum yet, need to create a new one
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.
Not sure if the enum is the best solution. It could prevent the framework from being dynamically enhanced. I've been thinking about where the information about accepted mime types should reside. Maybe inside the EnvelopeService
🤔
@IsInstance(Attachment, { each: true }) | ||
private requests?: Attachment[] | ||
|
||
public readonly services: DidCommService[] = [] |
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 also be plain dids (strings)
const invitation = new ConnectionInvitationMessage({ label: 'connection label', ...outOfBandMessage.services[0] }) | ||
|
||
let connectionRecord = await this.connectionService.processInvitation(invitation, { routing }) | ||
if (config.autoAccept) { |
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.
Do we want this to take into account agent config autoAcceptConnection?
outOfBandMessage.services.push(message.service.toDidCommService()) | ||
message.service = undefined |
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 the advantage of using OOB is that the AgentMessage
itself doesn't need the ~service
anymore.
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 is just a workaround for now. It allows us to pass the AgentMessage
into receiveMessage
and still be able to process it with the current implementation.
*/ | ||
public async receiveOobMessage(outOfBandMessage: OutOfBandMessage): Promise<void> { | ||
if (outOfBandMessage.handshakeProtocols) { | ||
throw new AriesFrameworkError('OOB message contains unsupported `handshake_protocols` attribute.') |
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 feels a bit misleading, handshake_protocols
is definitely supported, just not in this method.
Also, does this mean handshake_protocols
and requests~attach
can't be combined in AFJ?
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'll definitely look at the unification of those methods as you suggested in another comment.
But the combination of handshake_protocols
and requests~attach
is not allowed according to Step 1 in Aries RFC 0496: Transition to the Out of Band and DID Exchange Protocols
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.
Updated. It supports both handshake_protocols
and requests~attach
.
const mediationRecord = await this.mediationRecipientService.discoverMediation() | ||
const routing = await this.mediationRecipientService.getRouting(mediationRecord) | ||
const { connectionRecord: connectionRecord } = await this.connectionService.createInvitation({ |
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.
Maybe it would be good to allow modules to call modules as it can prevent some duplication here
Hi @TimoGlastra. Thanks for the suggestions and feedback. I unified it into just two methods I'm good with not merging it right now. I wasn't sure if we want to do it according to that transition spec or not. If we don't we can wait and merge as a whole, I guess. |
It's still not polished as I wished, but it's working according to Step 1 at least. It actually does more than Step 1. I wrote a brief overview of what's done and what's missing: Done
Todo
|
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.
Overall structure LGTM 👍 , but have left a lot of quibbles
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
…ssage receiver Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
Signed-off-by: Jakub Koci <[email protected]>
I consider the code in here approved. I moved it to the |
This is the first step in the implementation of #344.
It corresponds approximately to Step 1 defined in Aries RFC 0496: Transition to the Out of Band and DID Exchange Protocols.
As you can see I decided to create an Out-of-band module and keep the implementation there. I realized that putting it into the Connection module could cause more issues than benefits right now. It has only two drawbacks: