aries-cloudagent-python icon indicating copy to clipboard operation
aries-cloudagent-python copied to clipboard

Unable to set public key from verification method: no publicKeyBase58

Open securedimensions opened this issue 5 months ago • 3 comments

Summary

The verification of a W3C VC return error

Unable to set public key from verification method: no publicKeyBase58

when the public key is resolved via the dev.uniresolver.io. The resolver returns the public key as publicKeyJwk rather publicKeyBase58 as required by aries-cloudagent.

https://dev.uniresolver.io/1.0/identifiers/did%3Aweb%3Aemc.spacebel.be%3Aorganisations%3Ade_dlr returns

{
    "@context": [
        "https://www.w3.org/ns/did/v1",
        {
            "Ed25519VerificationKey2018": "https://w3id.org/security#Ed25519VerificationKey2018",
            "publicKeyJwk": {
                "@id": "https://w3id.org/security#publicKeyJwk",
                "@type": "@json"
            }
        }
    ],
    "assertionMethod": [
        "did:web:emc.spacebel.be:organisations:de_dlr#z6MkwQSWK8dfis9Kp9kWUb4g2pG5iaab92PafzbgL2nN1TS1"
    ],
    "id": "did:web:emc.spacebel.be:organisations:de_dlr",
    "verificationMethod": [
        {
            "id": "did:web:emc.spacebel.be:organisations:de_dlr#z6MkwQSWK8dfis9Kp9kWUb4g2pG5iaab92PafzbgL2nN1TS1",
            "type": "Ed25519VerificationKey2018",
            "controller": "did:web:emc.spacebel.be:organisations:de_dlr",
            "publicKeyJwk": {
                "kty": "OKP",
                "crv": "Ed25519",
                "x": "-93DZ8xtjHPn9VV4eohyXjgE0OWGnQcoJB6y8DEMB4I"
            }
        }
    ],
    "authentication": [
        "did:web:emc.spacebel.be:organisations:de_dlr#z6MkwQSWK8dfis9Kp9kWUb4g2pG5iaab92PafzbgL2nN1TS1"
    ],
    "alsoKnownAs": [
        "https://gcmd.earthdata.nasa.gov/kms/concept/2f9d7c12-c02d-41fb-a168-4d91794187f7",
        "https://dbpedia.org/resource/German_Aerospace_Center",
        "https://ror.org/04bwf3e34",
        "https://yago-knowledge.org/resource/German_Aerospace_Center"
    ]
}

Reproducing the error

First, start aca-py with the parameters --universal-resolver --universal-resolver-regex did:web:.* to enable the universal resolver for external DIDs. Second, send W3C VC verification request to endpoint /vc/credentials/verify:

curl -X 'POST' \
  'http://<host:port>/vc/credentials/verify' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: ...' \
  -H 'Content-Type: application/json' \
  -d '{
      "options": {
         "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
         "created": "2021-12-31T23:59:59Z",
         "proofPurpose": "assertionMethod",
         "proofType": "Ed25519Signature2018",
         "verificationMethod": "did:web:emc.spacebel.be:organisations:de_dlr#z6MkwQSWK8dfis9Kp9kWUb4g2pG5iaab92PafzbgL2nN1TS1"
      },
      "verifiableCredential": {
         "@context": [
            "https://www.w3.org/2018/credentials/v1",
            {
               "gj": "https://purl.org/geojson/vocab#",
               "title": "dct:title",
               "bbox": {
                  "@container": "@list",
                  "@id": "gj:bbox"
               },
               "updated": "dct:modified",
               "Polygon": "gj:Polygon",
               "links": {
                  "@context": {
                     "@vocab": "http://www.iana.org/assignments/relation/",
                     "type": "atom:type"
                  },
                  "@id": "owc:links"
               },
               "geometry": "gj:geometry",
               "previews": "iana:icon",
               "iana": "http://www.iana.org/assignments/relation/",
               "atom": "http://www.w3.org/2005/Atom/",
               "date": "dct:date",
               "Feature": "gj:Feature",
               "data": "iana:enclosure",
               "dct": "http://purl.org/dc/terms/",
               "coordinates": "gj:coordinates",
               "owc": "http://www.opengis.net/ont/owc/1.0/"
            }
         ],
         "id": "did:web:emc.spacebel.be:collections:TropForest:items:KO2_OTPF_KO2_MSC_2F_20091107T041750_20091107T041750_017498_E082_N028",
         "type": [
            "VerifiableCredential",
            "Feature"
         ],
         "credentialSubject": {
            "id": "did:web:emc.spacebel.be:collections:TropForest:items:KO2_OTPF_KO2_MSC_2F_20091107T041750_20091107T041750_017498_E082_N028",
            "bbox": [
               81.91450641,
               27.91026471,
               82.10769379,
               28.08365828
            ],
            "links": {
               "data": [
                  {
                     "href": "https://tpm-ds.eo.esa.int/oads/data/Tropforest/KO2_OTPF_KO2_MSC_2F_20091107T041750_20091107T041750_017498_E082_N028.ZIP",
                     "title": "Download"
                  }
               ]
            }
         },
         "issuer": "did:web:emc.spacebel.be:organisations:de_dlr",
         "issuanceDate": "2020-08-19T21:41:50Z",
         "proof": {
            "type": "Ed25519Signature2018",
            "proofPurpose": "assertionMethod",
            "verificationMethod": "did:web:emc.spacebel.be:organisations:de_dlr#z6MkwQSWK8dfis9Kp9kWUb4g2pG5iaab92PafzbgL2nN1TS1",
            "created": "2024-09-10T14:58:28.764Z",
            "jws": "eyJhbGciOiJFZERTQSIsImNyaXQiOlsiYjY0Il0sImI2NCI6ZmFsc2V9..QrsE8FcdfvFTQmmvLy6EsrPEwMvlW4W7Tv5z8oh1zE1p2i4yhAnbfSbi7OiaTBR8mU930XSfRmqeB0qJiV4XBA"
         }
      }
   }'

This returns the error

{
  "verified": false,
  "document": {
    "@context": [
      "https://www.w3.org/2018/credentials/v1",
      {
        "gj": "https://purl.org/geojson/vocab#",
        "title": "dct:title",
        "bbox": {
          "@container": "@list",
          "@id": "gj:bbox"
        },
        "updated": "dct:modified",
        "Polygon": "gj:Polygon",
        "links": {
          "@context": {
            "@vocab": "http://www.iana.org/assignments/relation/",
            "type": "atom:type"
          },
          "@id": "owc:links"
        },
        "geometry": "gj:geometry",
        "previews": "iana:icon",
        "iana": "http://www.iana.org/assignments/relation/",
        "atom": "http://www.w3.org/2005/Atom/",
        "date": "dct:date",
        "Feature": "gj:Feature",
        "data": "iana:enclosure",
        "dct": "http://purl.org/dc/terms/",
        "coordinates": "gj:coordinates",
        "owc": "http://www.opengis.net/ont/owc/1.0/"
      }
    ],
    "id": "did:web:emc.spacebel.be:collections:TropForest:items:KO2_OTPF_KO2_MSC_2F_20091107T041750_20091107T041750_017498_E082_N028",
    "type": [
      "VerifiableCredential",
      "Feature"
    ],
    "issuer": "did:web:emc.spacebel.be:organisations:de_dlr",
    "issuanceDate": "2020-08-19T21:41:50Z",
    "credentialSubject": {
      "id": "did:web:emc.spacebel.be:collections:TropForest:items:KO2_OTPF_KO2_MSC_2F_20091107T041750_20091107T041750_017498_E082_N028",
      "bbox": [
        81.91450641,
        27.91026471,
        82.10769379,
        28.08365828
      ],
      "links": {
        "data": [
          {
            "href": "https://tpm-ds.eo.esa.int/oads/data/Tropforest/KO2_OTPF_KO2_MSC_2F_20091107T041750_20091107T041750_017498_E082_N028.ZIP",
            "title": "Download"
          }
        ]
      }
    },
    "proof": {
      "type": "Ed25519Signature2018",
      "proofPurpose": "assertionMethod",
      "verificationMethod": "did:web:emc.spacebel.be:organisations:de_dlr#z6MkwQSWK8dfis9Kp9kWUb4g2pG5iaab92PafzbgL2nN1TS1",
      "created": "2024-09-10T14:58:28.764Z",
      "jws": "eyJhbGciOiJFZERTQSIsImNyaXQiOlsiYjY0Il0sImI2NCI6ZmFsc2V9..QrsE8FcdfvFTQmmvLy6EsrPEwMvlW4W7Tv5z8oh1zE1p2i4yhAnbfSbi7OiaTBR8mU930XSfRmqeB0qJiV4XBA"
    }
  },
  "results": [
    {
      "verified": false,
      "proof": {
        "@context": [
          "https://www.w3.org/2018/credentials/v1",
          {
            "gj": "https://purl.org/geojson/vocab#",
            "title": "dct:title",
            "bbox": {
              "@container": "@list",
              "@id": "gj:bbox"
            },
            "updated": "dct:modified",
            "Polygon": "gj:Polygon",
            "links": {
              "@context": {
                "@vocab": "http://www.iana.org/assignments/relation/",
                "type": "atom:type"
              },
              "@id": "owc:links"
            },
            "geometry": "gj:geometry",
            "previews": "iana:icon",
            "iana": "http://www.iana.org/assignments/relation/",
            "atom": "http://www.w3.org/2005/Atom/",
            "date": "dct:date",
            "Feature": "gj:Feature",
            "data": "iana:enclosure",
            "dct": "http://purl.org/dc/terms/",
            "coordinates": "gj:coordinates",
            "owc": "http://www.opengis.net/ont/owc/1.0/"
          }
        ],
        "type": "Ed25519Signature2018",
        "proofPurpose": "assertionMethod",
        "verificationMethod": "did:web:emc.spacebel.be:organisations:de_dlr#z6MkwQSWK8dfis9Kp9kWUb4g2pG5iaab92PafzbgL2nN1TS1",
        "created": "2024-09-10T14:58:28.764Z",
        "jws": "eyJhbGciOiJFZERTQSIsImNyaXQiOlsiYjY0Il0sImI2NCI6ZmFsc2V9..QrsE8FcdfvFTQmmvLy6EsrPEwMvlW4W7Tv5z8oh1zE1p2i4yhAnbfSbi7OiaTBR8mU930XSfRmqeB0qJiV4XBA"
      },
      "error": "Unable to set public key from verification method: no publicKeyBase58"
    }
  ],
  "errors": [
    "Unable to set public key from verification method: no publicKeyBase58"
  ]
}

Question

Can I activate the support for publicKeyJwk somehow?

securedimensions avatar Sep 11 '24 08:09 securedimensions