Skip to content

Commit

Permalink
fix: a few critical tweaks
Browse files Browse the repository at this point in the history
- on 1.1, default to use_did_method=did:peer:4 when not specified
- on use_did, fix bugs with setting the did
- doc updates

Signed-off-by: Daniel Bluhm <[email protected]>
  • Loading branch information
dbluhm committed Apr 8, 2024
1 parent 85f01f0 commit fd73dd6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion aries_cloudagent/protocols/didexchange/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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"
)
Expand Down
5 changes: 4 additions & 1 deletion aries_cloudagent/protocols/didexchange/v1_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion docs/demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions docs/demo/ReusingAConnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit fd73dd6

Please sign in to comment.