Picolab / aries-cloudagent-pico

Aries Cloud Agent - Pico
MIT License
4 stars 1 forks source link

For interoperation code needs to be less specific in identifying a service #26

Closed b1conrad closed 2 years ago

b1conrad commented 2 years ago

Attended "Hyperledger Aries Interoperability Event" this morning. Failed to complete connections with Animo (AFJ) agent. Found the problem!

Their DIDDocument has a service entry that looks like this

        "service": [
          {
            "id": "NY8Dp1KXqrqJamuA1xvz5v#IndyAgentService",
            "serviceEndpoint": "https://http.mediator.community.animo.id/",
            "type": "IndyAgent",
            "priority": 0,
            "recipientKeys": [
              "CjpHhS5s82mfrr3YZQ4PVpX4W1Xv8djPAhY7HdCTNpFs"
            ],
            "routingKeys": [
              "6rLehkp1tgWnVGznFBuWaKccH5De1F56BzXP4dKEYV58"
            ]
          }
        ],

And, the KRL code that selects the appropriate service is too restrictive:

      service = connection{["DIDDoc","service"]}
        .filter(function(x){
          x{"type"}=="IndyAgent"
          && x{"id"}.match(their_did+";indy")
        }).head()
      se = service{"serviceEndpoint"}

So, I get a null serviceEndpoint not to mention no keys!

I based this code off of the sample shown in the connections spec. But now notice that there are external links and conflicting information. For example, this spec is very different, but does imply that the id would start with the DID and end with a # and the same value as the type. Animo uses a type of "IndyAgent" but a different delimiter and suffix on its id. Need to figure out how to handle this. In any case, there is no point in going on with a null serviceEndpoint!

b1conrad commented 2 years ago

In the meeting where @mhailstone issued the pull request, I promised to show the complete Map of the proposed connection:

{
  "message": {
    "@type": "https://didcomm.org/connections/1.0/request",
    "@id": "e8143215-50d1-44b8-a219-d97e26f4926b",
    "label": "wallet-demo-id",
    "connection": {
      "DID": "NY8Dp1KXqrqJamuA1xvz5v",
      "DIDDoc": {
        "@context": "https://w3id.org/did/v1",
        "publicKey": [
          {
            "id": "NY8Dp1KXqrqJamuA1xvz5v#1",
            "controller": "NY8Dp1KXqrqJamuA1xvz5v",
            "type": "Ed25519VerificationKey2018",
            "publicKeyBase58": "CjpHhS5s82mfrr3YZQ4PVpX4W1Xv8djPAhY7HdCTNpFs"
          }
        ],
        "service": [
          {
            "id": "NY8Dp1KXqrqJamuA1xvz5v#IndyAgentService",
            "serviceEndpoint": "https://http.mediator.community.animo.id",
            "type": "IndyAgent",
            "priority": 0,
            "recipientKeys": [
              "CjpHhS5s82mfrr3YZQ4PVpX4W1Xv8djPAhY7HdCTNpFs"
            ],
            "routingKeys": [
              "6rLehkp1tgWnVGznFBuWaKccH5De1F56BzXP4dKEYV58"
            ]
          }
        ],
        "authentication": [
          {
            "publicKey": "NY8Dp1KXqrqJamuA1xvz5v#1",
            "type": "Ed25519SignatureAuthentication2018"
          }
        ],
        "id": "NY8Dp1KXqrqJamuA1xvz5v"
      }
    },
    "~thread": {
      "thid": "e8143215-50d1-44b8-a219-d97e26f4926b",
      "pthid": "cl7hriwig00tmmzpb3f2g1e3e"
    }
  },
  "sender_key": "CjpHhS5s82mfrr3YZQ4PVpX4W1Xv8djPAhY7HdCTNpFs",
  "recipient_key": "4TnoCdHWzeirmsPQcaS1sc3XXzGL4ZN35SrPessKZ1sm"
}
b1conrad commented 2 years ago

The same change was also made in the ruleset for version 0 of the pico engine, with this commit.

b1conrad commented 2 years ago

From the operations side, flushed the ruleset in both the byname instance and the Manifold instance. Need now to try interoperation again.