Skip to content
This repository has been archived by the owner on Jan 23, 2020. It is now read-only.

decentralized-identity/universal-resolver-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple API Library implementaation built for Python3 with backwards compatibility for python2.x. It is intended to make a simple http request to a web service. The web service will handle the resolving of the DID and will return a DDO (DID Document) through the HTTP response.

implementation: assign a config file with a list of URLs pointing to a resolver web service. This is done, by creating a UniversalUriResolver object and assign it a string with the name of the file.

uri = ClientUriResolver("Config.txt")

Now you can resolve DIDs by passing them as a string argument into the resolver method

ddo = uri.resolver("did:sov:WRfXPg8dantKVubE3HX8pw")

This returns back the DDO in the form of a JSON object. If it fails to resolve using all of the provided web services, it will return a None object.

example to print a DDO:

webResolver = ClientWebResolver("config.txt")
response = webResolver.resolve("did:sov:WRfXPg8dantKVubE3HX8pw")
print(response)

response will look like this:

{'control': [], 
    'owner': {
        'curve': 'ed25519', 
        'publicKeyBase64': 'H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV', 
        'type': ['CryptographicKey', 'EdDsaSAPublicKey'], 
        'id': 'did:sov:WRfXPg8dantKVubE3HX8pw'
    }, 
    'id': 'did:sov:WRfXPg8dantKVubE3HX8pw', 
    'service': {
            'xdi': 'http://127.0.0.1:8080/xdi'
    }, 
    '@context': 'https://example.org/did/v1'
}

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages