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

Feature/native did web resolver #1218

Conversation

domwoe
Copy link

@domwoe domwoe commented Jun 2, 2021

Add native did:web resolver. Carved out and touched up from #1143

  • Uses DID and DID Doc validation from pyDID
  • Does not support encoding of ports in DIDs yet (e.g. did:web:localhost%3A8443 -> https://localhost:443/.well-known/did.json yet, because pyDID does not allow '%' char in DID (See: Allow % char in DID Indicio-tech/pydid#34)

Woerner Dominic (RBCH/PJ-IOT) added 2 commits June 2, 2021 10:45

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Signed-off-by: Woerner Dominic (RBCH/PJ-IOT) <dominic.woerner2@ch.bosch.com>
Signed-off-by: Woerner Dominic (RBCH/PJ-IOT) <dominic.woerner2@ch.bosch.com>
@codecov-commenter
Copy link

codecov-commenter commented Jun 2, 2021

Codecov Report

Merging #1218 (84035ce) into main (1c7bc86) will decrease coverage by 0.05%.
The diff coverage is 67.39%.

@@            Coverage Diff             @@
##             main    #1218      +/-   ##
==========================================
- Coverage   98.47%   98.41%   -0.06%     
==========================================
  Files         456      457       +1     
  Lines       25428    25474      +46     
==========================================
+ Hits        25039    25070      +31     
- Misses        389      404      +15     

Comment on lines 3 to 16
from typing import Sequence, Pattern
import aiohttp
import urllib.parse

from ...config.injection_context import InjectionContext
from ...core.profile import Profile
from ..base import (
BaseDIDResolver,
DIDNotFound,
ResolverError,
ResolverType,
)
from ...messaging.valid import DIDWeb
from pydid import DID, DIDDocument
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reorder imports:

import urllib.parse

from typing import Sequence, Pattern

import aiohttp

from pydid import DID, DIDDocument

from ...config.injection_context import InjectionContext
from ...core.profile import Profile
from ...messaging.valid import DIDWeb

from ..base import (
    BaseDIDResolver,
    DIDNotFound,
    ResolverError,
    ResolverType,
)

@andrewwhitehead andrewwhitehead requested a review from dbluhm June 2, 2021 17:14
Woerner Dominic (RBCH/PJ-IOT) added 3 commits June 2, 2021 20:12
Signed-off-by: Woerner Dominic (RBCH/PJ-IOT) <dominic.woerner2@ch.bosch.com>
Signed-off-by: Woerner Dominic (RBCH/PJ-IOT) <dominic.woerner2@ch.bosch.com>
Signed-off-by: Woerner Dominic (RBCH/PJ-IOT) <dominic.woerner2@ch.bosch.com>
Comment on lines +38 to +40
def supported_methods(self) -> Sequence[str]:
"""Return list of supported methods."""
return ["web"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should no longer be required, technically.

@andrewwhitehead andrewwhitehead merged commit b538cb9 into openwallet-foundation:main Jun 4, 2021
@swcurran
Copy link
Contributor

swcurran commented Aug 1, 2021

I was trying this out and have found that while did:web:did.actor:alice resolves properly (e.g. matches more or less what the DIF Resolver returns. However, the other actors DIDs (e.g. mike -- did:web:did.actor:mike, URL: https://did.actor/mike/did.json ) does not resolve successfully. For Mike, the error is:

Error: Response was incorrectly formatted. Failed to deserialize DIDDocumentRoot:. 1 validation error for ParsingModel[DIDDocumentRoot]. __root__ -> @context -> 1. str type expected (type=type_error.str). [ErrorWrapper(exc=ValidationError(model='DIDDocumentRoot', errors=[{'loc': ('@context', 1), 'msg': 'str type expected', 'type': 'type_error.str'}]), loc=('__root__',))].

I'm guessing this is because of the JSON-LD contexts in the Mike document (and Carol). Is that the issue?

Thanks

@dbluhm
Copy link
Contributor

dbluhm commented Aug 2, 2021

PyDID is complaining about the embedded object in the @context which isn't strictly spec conforming. At this point, I'm seriously questioning whether we'll ever be able to expect DID Documents to be even mostly spec compliant lol... I thought I had loosened expectations around parsed DID Documents in use by ACA-Py though. Was this error raised while just querying the plugged in resolvers through /resolver/resolve/{did} or another operation?

@swcurran
Copy link
Contributor

swcurran commented Aug 3, 2021

Yes -- I was using /resolver/resolve/{did}

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.

5 participants