diff --git a/aries_cloudagent/protocols/didexchange/v1_0/manager.py b/aries_cloudagent/protocols/didexchange/v1_0/manager.py index cfbe652aa9..0b12931e12 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/manager.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/manager.py @@ -360,7 +360,9 @@ async def create_request( conn_rec, my_endpoints, mediation_records ) else: - if conn_rec.accept == ConnRecord.ACCEPT_AUTO: + if conn_rec.accept == ConnRecord.ACCEPT_AUTO or use_did_method is None: + # If we're auto accepting or engaging in 1.1 without setting a + # use_did_method, default to did:peer:4 use_did_method = "did:peer:4" try: did, attach = await self._qualified_did_with_fallback( @@ -432,6 +434,7 @@ async def _qualified_did_with_fallback( my_info = await self.create_did_peer_2(my_endpoints, mediation_records) conn_rec.my_did = my_info.did else: + # We shouldn't hit this condition in practice raise LegacyHandlingFallback( "Use of qualified DIDs not set according to settings" ) diff --git a/aries_cloudagent/protocols/didexchange/v1_0/routes.py b/aries_cloudagent/protocols/didexchange/v1_0/routes.py index 4cbdc1f4a5..075089366b 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/routes.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/routes.py @@ -269,9 +269,12 @@ async def didx_accept_invitation(request: web.Request): async with profile.session() as session: conn_rec = await ConnRecord.retrieve_by_id(session, connection_id) if use_did: - wallet = profile.inject(BaseWallet) + wallet = session.inject(BaseWallet) did_info = await wallet.get_local_did(use_did) conn_rec.my_did = did_info.did + await conn_rec.save( + session, reason="Set my_did from use_did on invite accept" + ) didx_request = await didx_mgr.create_request( conn_rec=conn_rec, diff --git a/docs/demo/README.md b/docs/demo/README.md index 2764ffa14c..5aa0b86601 100644 --- a/docs/demo/README.md +++ b/docs/demo/README.md @@ -265,11 +265,13 @@ You can enable DID Exchange using the `--did-exchange` parameter for the `alice` This will use the new DID Exchange protocol when establishing connections between the agents, rather than the older Connection protocol. There is no other affect on the operation of the agents. -With DID Exchange, you can also enable use of the inviter's public DID for invitations, multi-use invitations, and connection re-use: +With DID Exchange, you can also enable use of the inviter's public DID for invitations, multi-use invitations, connection re-use, and use of qualified DIDs: - `--public-did-connections` - use the inviter's public DID in invitations, and allow use of implicit invitations - `--reuse-connections` - support connection re-use (invitee will reuse an existing connection if it uses the same DID as in the new invitation) - `--multi-use-invitations` - inviter will issue multi-use invitations +- `--emit-did-peer-4` - participants will prefer use of did:peer:4 for their pairwise connection DIDs +- `--emit-did-peer-2` - participants will prefer use of did:peer:2 for their pairwise connection DIDs ### Endorser diff --git a/docs/demo/ReusingAConnection.md b/docs/demo/ReusingAConnection.md index 2c7e94dfd6..497075e7aa 100644 --- a/docs/demo/ReusingAConnection.md +++ b/docs/demo/ReusingAConnection.md @@ -134,14 +134,14 @@ For example, to run faber with connection reuse using a non-public DID: ./run_demo faber --reuse-connections --events ``` -To run faber using a `did_peer` and reusable connections: +To run faber using a `did:peer` and reusable connections: ``` bash -DEMO_EXTRA_AGENT_ARGS="[\"--emit-did-peer-2\"]" ./run_demo faber --reuse-connections --events +./run_demo faber --reuse-connections --emit-did-peer-2 --events ``` To run this demo using a multi-use invitation (from Faber): ``` bash -DEMO_EXTRA_AGENT_ARGS="[\"--emit-did-peer-2\"]" ./run_demo faber --reuse-connections --multi-use-invitations --events +./run_demo faber --reuse-connections --emit-did-peer-2 --multi-use-invitations --events ```