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

feat: emit did:peer:2 in DID Exchange #2578

Conversation

dbluhm
Copy link
Contributor

@dbluhm dbluhm commented Oct 31, 2023

This PR implements did:peer:2 support for DID Exchange. If the --emit-did-peer-2 flag is set, ACA-Py will create and send a did:peer:2 DID instead of an unqualified DID and an attached Document in DID Exchange messages.

This PR also implements the did_rotate~attach from the proposed DID Exchange v1.1. It will include the did_rotate~attach attribute on responses when relevant and will expect to receive them on responses as well.

To achieve this, the following changes were made:

  • Add wallet.create_key. create_key is just a more generic create_signing_key. Literally no difference in implementation; it just seemed an inappropriate name for how it was being used. I can be convinced that we should not do this.
  • Add wallet.store_did. This enables us to more easily create DIDs outside of the wallet. The wallet.create_local_did method is starting to get a bit complicated. Rather than shoehorning all DID creation into the wallet interface, I think it makes sense to transition to a system where the wallet creates the primitives (such as keys) but then the creation of the DID itself is performed outside of the wallet. This was especially necessary because, in order to create a did:peer:2, we also need service info which can differ per connection (mediation used or not, for instance) and the wallet is simply not aware of the concept of services nor the context of the connection and associated mediation records. As part of an early pass, I even went as far as to introduce a DID Registration interface (which makes this attempt perhaps my third one in recent memory). I continue to struggle to create an interface that is generic enough to enable registering DIDs using plugged in registrars but still actually be useful. The requirements between methods varies so widely that the interface becomes nearly useless (at least in the context of ACA-Py). I'm finding it more reasonable to simply call a specific "registrar" directly. In these changes for did:peer:2, this is simply calling into the did-peer-2 library's generate method.
  • Add --emit-did-peer-2 flag and associated setting.
  • Add support for easily creating an attachment with text/string mime type, as is used in the did_rotate~attach.
  • Add the PEER2 DID Method definition

Opening as a draft since, at the time of opening, this hasn't been thoroughly exercised by tests yet.

@dbluhm dbluhm force-pushed the feature/did-peer-2-did-exchange branch from 973acb8 to 8dec969 Compare October 31, 2023 03:28
@sonarcloud
Copy link

sonarcloud bot commented Oct 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@dbluhm dbluhm force-pushed the feature/did-peer-2-did-exchange branch 2 times, most recently from 141220c to dafe953 Compare December 7, 2023 20:58
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
@dbluhm dbluhm force-pushed the feature/did-peer-2-did-exchange branch from 89a8c67 to 4d4b505 Compare December 12, 2023 16:07
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
@dbluhm
Copy link
Contributor Author

dbluhm commented Dec 13, 2023

@ianco I made a change to the integration tests to allow me to pass an arbitrary flag down through the layers to the start up of the agent. Thoughts on this approach? It seemed like it would be simpler to do this than to add flags all the way down the stack.

@ianco
Copy link
Contributor

ianco commented Dec 13, 2023

@ianco I made a change to the integration tests to allow me to pass an arbitrary flag down through the layers to the start up of the agent. Thoughts on this approach? It seemed like it would be simpler to do this than to add flags all the way down the stack.

Yes I think this is a good idea. Will this work when running the alice/faber demo as well?

@dbluhm
Copy link
Contributor Author

dbluhm commented Dec 13, 2023

I haven't gotten myself familiar enough with the demo yet to say for sure 😅 So that probably means it's not usable from the demo at this point.

Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
Copy link

sonarcloud bot commented Dec 13, 2023

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@ianco
Copy link
Contributor

ianco commented Dec 13, 2023

I haven't gotten myself familiar enough with the demo yet to say for sure 😅 So that probably means it's not usable from the demo at this point.

No problem ping me when the PR is ready for review and I'll take a look ...

@Jsyro
Copy link
Contributor

Jsyro commented Jan 2, 2024

Merged in #2687.

@Jsyro Jsyro closed this Jan 2, 2024
@dbluhm dbluhm deleted the feature/did-peer-2-did-exchange branch January 30, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants