hyperledger-archives / aries-framework-go

Hyperledger Aries Framework Go provides packages for building Agent / DIDComm services.
https://wiki.hyperledger.org/display/ARIES/aries-framework-go
Apache License 2.0
238 stars 159 forks source link

Web VDR Resolver #3094

Open MajdT51 opened 2 years ago

MajdT51 commented 2 years ago

Bug report

What I'm trying to do

resolve web did (did:web:did.actor:alice) which is supported by aries go as far i see: https://github.com/hyperledger/aries-framework-go/tree/main/pkg/vdr/web

Expected result the DID Resolution or Document

{
  "@context": ["https://w3.org/ns/did/v1", "https://w3id.org/security/suites/ed25519-2018/v1"],
  "id": "did:web:did.actor:alice",
  "publicKey": [
    {
      "id": "did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN",
      "controller": "did:web:did.actor:alice",
      "type": "Ed25519VerificationKey2018",
      "publicKeyBase58": "DK7uJiq9PnPnj7AmNZqVBFoLuwTjT1hFPrk6LSjZ2JRz"
    }
  ],
  "authentication": [
    "did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN"
  ],
  "assertionMethod": [
    "did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN"
  ],
  "capabilityDelegation": [
    "did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN"
  ],
  "capabilityInvocation": [
    "did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN"
  ],
  "keyAgreement": [
    {
      "id": "did:web:did.actor:alice#zC8GybikEfyNaausDA4mkT4egP7SNLx2T1d1kujLQbcP6h",
      "type": "X25519KeyAgreementKey2019",
      "controller": "did:web:did.actor:alice",
      "publicKeyBase58": "CaSHXEvLKS6SfN9aBfkVGBpp15jSnaHazqHgLHp8KZ3Y"
    }
  ]
}

Actual result

{
    "code": 4003,
    "message": "resolve did doc: did method web not supported for vdr"
}

Sample code / test case

Steps:

The error come from this method where it seems that r.vdr include only peer and key

func (r *Registry) resolveVDR(method string) (vdrapi.VDR, error) {
    for _, v := range r.vdr {
        if v.Accept(method) {
            return v, nil
        }
    }
    return nil, fmt.Errorf("did method %s not supported for vdr", method)
}

Question: Is there a way to activate the web vdr ?

Using the httpbinding give me this error

HTTP_DID_RESOLVER=web@https://dev.uniresolver.io/1.0/identifiers/ or HTTP_DID_RESOLVER=web@https://api.godiddy.com/0.1.0/universal-resolver/identifiers/

ERROR (http://localhost:8083/vdr/did/resolve/ZGlkOndlYjpkaWQuYWN0b3I6YWxpY2U=) ->

 {
    "code": 4003,
    "message": "resolve did doc: did method read failed failed: did document not valid:\n- @context: Must validate one and only one schema (oneOf)\n- @context.0: Does not match pattern '^https://(w3id.org|www.w3.org/ns)/did/v1$'\nDocument: {\"@context\":[\"https://w3.org/ns/did/v1\",\"https://w3id.org/security/suites/ed25519-2018/v1\"],\"id\":\"did:web:did.actor:alice\",\"publicKey\":[{\"id\":\"did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN\",\"controller\":\"did:web:did.actor:alice\",\"type\":\"Ed25519VerificationKey2018\",\"publicKeyBase58\":\"DK7uJiq9PnPnj7AmNZqVBFoLuwTjT1hFPrk6LSjZ2JRz\"}],\"authentication\":[\"did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN\"],\"assertionMethod\":[\"did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN\"],\"capabilityDelegation\":[\"did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN\"],\"capabilityInvocation\":[\"did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN\"],\"keyAgreement\":[{\"id\":\"did:web:did.actor:alice#zC8GybikEfyNaausDA4mkT4egP7SNLx2T1d1kujLQbcP6h\",\"type\":\"X25519KeyAgreementKey2019\",\"controller\":\"did:web:did.actor:alice\",\"publicKeyBase58\":\"CaSHXEvLKS6SfN9aBfkVGBpp15jSnaHazqHgLHp8KZ3Y\"}]}\n"
}

Thanks

sudeshrshetty commented 2 years ago

@MajdT51 using http binding resolved your DID, but looks like your resolved DIDDocument failed schema validation

https://github.com/hyperledger/aries-framework-go/blob/af30e870c3c085ed1debfe304de293ba2b995516/pkg/doc/did/doc.go#L859

MajdT51 commented 2 years ago

@MajdT51 using http binding resolved your DID, but looks like your resolved DIDDocument failed schema validation

https://github.com/hyperledger/aries-framework-go/blob/af30e870c3c085ed1debfe304de293ba2b995516/pkg/doc/did/doc.go#L859

yes i managed to pybass the error by adding "|w3.org/ns" -> "pattern": "^https://(w3id.org|www.w3.org/ns|w3.org/ns)/did/v1$" in pkg/doc/did/schema.go