-
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: support invitationDid when creating an invitation #1811
feat: support invitationDid when creating an invitation #1811
Conversation
Signed-off-by: Timo Glastra <[email protected]>
@genaris you're a master on this front, your input is appreciated!! |
I totally agree on this. As you said in your comment, it will be nice to make it easier to create DIDComm-capable Peer DIDs, so we don't need to write several lines of code to achieve that. Maybe an utility method or an optional parameter for |
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 your code is similar to the one I've working on for using public dids (which is working fine, but requires to manually set invitations as multiUse). I like the checks you've added on existing DIDs with the same routing keys and the fact that (if I understood correctly) you can create single use invitations, which is something important for instance if we want to create invitation codes for proof requests or credential proposals using a public DID.
Looking forward to get it merged soon!
Hey @TimoGlastra do you want me to continue the work on this PR? I think we are close to have this ready for merging! |
Yes if you could pick it up that would be great :) |
I think for this what if we do the following (can be in a follow up PR):
|
Let me know if you have time to work on this @genaris, I have a need for this in the near future, so otherwise I might be able to spend some time on it :) |
I think this is the way to go: it is quite straightforward to implement (we just need to update I'll add some commits to this PR following this approach. |
Signed-off-by: Ariel Gentile <[email protected]>
Signed-off-by: Ariel Gentile <[email protected]>
I marked it ready for review, since it already implements the new out of band service calculation and it's doing the intended job of supporting did re-use. ConnectionRecord migration considering the new |
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!!! 👍 some small comments but LGTM either way
const [invitationDid] = [ | ||
...oobRecord.outOfBandInvitation.getDidServices(), | ||
...oobRecord.outOfBandInvitation.getInlineServices().map(outOfBandServiceToInlineKeysNumAlgo2Did), | ||
] |
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.
Will this work when updating from 0.1-0.2?
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 understand now 👍
Signed-off-by: Timo Glastra <[email protected]>
This adds supporting for providing an
invitationDid
when creating an out of band invitation.The idea is that you can provide this invitation did to as many oob invitations, to allow for connection reuse. The did will sitill be rotated in the connection response (so each connection still has a new did, mostly to make this PR simpler, I'm not sure if we should change that behaviour before DIDComm v2 where things will become simpler a lot).
It doesn't work yet sadly, as I use the
invitationDid
from the first connection to create the second OOB invitation, but it will error that theinvitationDid
from the first connection is not a valid did peer did.It's kinda true I think as the did is generated a bit weirdly, it only contains the services, but no key references:
While the Aries RFCS mention (note the endpoint AND key):
So now I'm wondering whether this is the right approach? Should we allow to reuse the invitationDid? What would work is creating a did first (either did:peer or any other method) and also providing that to the first createInvitation call.
But you'd have to make sure that did document contains valid routing config for mediation and didcomm.
Alternative is to allow the same
routing
object to be passed to multiple createInvitation calls, but IMOrouting
objects shouldn't be reused, as it adds a lot of complexities in other places.Using the same service in multiple invitations is tricky as we don't know then if the routing has already been used for a did. We could add checks for this, whether a did already exists, and if so use that, but I don' t like the magic behind it. So maybe next step is making it easy to generate a did beforehand, which you can then pass to all invitations you create?
Because even if we pass the
invitationDid
in the second invitation, in the first invitation we used an inline service so it doesn't really match (it will match for Credo, as the service -> did:peer:2 as invitationDid is EXACTLY the same, but i don't see that being true for any other implementation).I feel like the inline services are great for interop (as you don't have to put a did method in the invitation, so it works with connection protocol and multiple peer did methods), but it makes the reuse flow a lot harder.
So my proposal would be:
What do you think?