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

fix: handle stored afgo and findy docs in corrections #2450

Merged
merged 3 commits into from
Aug 28, 2023

Conversation

dbluhm
Copy link
Contributor

@dbluhm dbluhm commented Aug 26, 2023

This PR should fix ACA-Py <-> AFGo interop by correcting a case where the LegacyPeerDIDResolver was not properly dereferencing the recipient keys for the DIDComm service.

Specifically, it should fix this error:

2023-08-26 14:17:42,082 aries_cloudagent.connections.base_manager ERROR Failed to resolve service details while determining connection targets; skipping service
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aries_cloudagent/resolver/did_resolver.py", line 142, in dereference
    return document.dereference(parsed)
  File "/usr/local/lib/python3.9/site-packages/pydid/doc/doc.py", line 145, in dereference
    raise IDNotFoundError("ID {} not found in document".format(reference))
pydid.doc.doc.IDNotFoundError: ID did:sov:1H6d1WS29Bcfr7Bb9tZxA#1 not found in document

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aries_cloudagent/connections/base_manager.py", line 368, in resolve_connection_targets
    recips, routing = await self.verification_methods_for_service(
  File "/usr/local/lib/python3.9/site-packages/aries_cloudagent/connections/base_manager.py", line 296, in verification_methods_for_service
    recipient_keys: List[VerificationMethod] = [
  File "/usr/local/lib/python3.9/site-packages/aries_cloudagent/connections/base_manager.py", line 297, in <listcomp>
    await resolver.dereference_verification_method(
  File "/usr/local/lib/python3.9/site-packages/aries_cloudagent/resolver/did_resolver.py", line 156, in dereference_verification_method
    dereferenced = await self.dereference(profile, did_url, document=document)
  File "/usr/local/lib/python3.9/site-packages/aries_cloudagent/resolver/did_resolver.py", line 144, in dereference
    raise ResolverError(
aries_cloudagent.resolver.base.ResolverError: Failed to dereference DID URL: ID did:sov:1H6d1WS29Bcfr7Bb9tZxA#1 not found in document

This PR also fixes an error where docs that didn't have a proper did url for the ID of the service (like those received from findy) are corrected before used. For example:

{
  "@context": "https://w3id.org/did/v1",
  "id": "did:sov:5qXMeLdyWEQhieFUBNw5ux",
  "publicKey": [
    {
      "id": "did:sov:5qXMeLdyWEQhieFUBNw5ux#1",
      "type": "Ed25519VerificationKey2018",
      "controller": "did:sov:5qXMeLdyWEQhieFUBNw5ux",
      "publicKeyBase58": "3dtu2WWtd5ELwRTJEPzmEJUYEp8Qq36N2QA24g9tFXK9"
    }
  ],
  "authentication": [
    {
      "type": "Ed25519SignatureAuthentication2018",
      "publicKey": "did:sov:5qXMeLdyWEQhieFUBNw5ux#1"
    }
  ],
  "service": [
    {
      "id": "did:sov:5qXMeLdyWEQhieFUBNw5ux",  // <--- Missing #some-fragment
      "type": "IndyAgent",
      "priority": null,
      "recipientKeys": [
        "3dtu2WWtd5ELwRTJEPzmEJUYEp8Qq36N2QA24g9tFXK9"
      ],
      "serviceEndpoint": "http://172.17.0.1:9031/a2a/5b6dyY6PndLaCnWxZbeEYW/5b6dyY6PndLaCnWxZbeEYW/2f6aae0c-6b04-40ff-a25e-faecaea39f83"
    }
  ]
}

Fixes #2449

@dbluhm dbluhm changed the title fix: handle stored afgo docs in corrections fix: handle stored afgo and findy docs in corrections Aug 26, 2023
@dbluhm dbluhm requested a review from swcurran August 26, 2023 19:05
@swcurran
Copy link
Contributor

Ran through with AATH and the AF-Go test now runs (yay!), but the Findy Agent test still hangs on the test ping. Not sure if the behaviour has changed. Attached are the logs from the run.

acapy-findy-logs.zip

Signed-off-by: Daniel Bluhm <[email protected]>
@sonarqubecloud
Copy link

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
Copy link
Contributor Author

dbluhm commented Aug 28, 2023

@swcurran most recent commit should take care of that. Issue was caused by receiving a "priority": null in the received doc. I adjusted the tests to make sure this kind of error doesn't slip past again as well.

@swcurran
Copy link
Contributor

Worked! Nice — thanks.

@swcurran swcurran merged commit 416057c into openwallet-foundation:main Aug 28, 2023
@swcurran
Copy link
Contributor

Nightly artifact generated that can be used for testing if anyone has time. @WadeBarnes , if you have time to deploy for IDIM, that would be good. I can do a final 0.10.0 tag later today/tonight. Any other tests would be appreciated!

@WadeBarnes
Copy link
Contributor

The new Nightly image has been deployed to IDIM dev.

@dbluhm dbluhm deleted the fix/acapy-afgo-interop branch January 30, 2024 21:32
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.

New AATH Connection Issues between ACA-Py and AF-Go and Findy Agent
3 participants