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/python wrapper with multiple ledger support #87

Conversation

domwoe
Copy link
Contributor

@domwoe domwoe commented Mar 24, 2022

Added python wrapper for multi-ledger did resolution

Exposes three simple ways to set up a resolver:

  1. Provide a list of namespaces, genesis files will be retrieved from did indy networks repo
  2. Local did indy networks compatible folder structure
  3. Autopilot: Library will try to fetch genesis files from did indy networks repo when a DID with an unknown namespace is encountered.

domwoe added 6 commits March 24, 2022 14:42
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Comment on lines 68 to 100
# Handle legacy case, where diddocContent is not present and we want to check for
# associated ATTRIB endpoints. We can't handle in this in libindy_vdr directly.
if not diddoc_content:
unqualified_did = reply_data["dest"]
req = build_get_attrib_request(None, unqualified_did, "endpoint", None, None)
res = await pool.submit_request(req)
data = res.get("data", None)
if data:
data = json.loads(data)
endpoints = data.get("endpoint", None)

if endpoints:
services = []
for (service_type, service_endpoint) in endpoints.items():
if service_type == "endpoint":

services.append({
"id": f"did:indy:{namespace}:{unqualified_did}#did-communication",
"type": "did-communication",
"recipientKeys": [f"did:indy:{namespace}:{unqualified_did}#verkey"] ,
"routingKeys": [],
"priority": 0
})

else:

services.append({
"id": f"did:indy:{namespace}:{unqualified_did}#{service_type}",
"type": service_type,
"serviceEndpoint": service_endpoint

})
result["didDocument"]["services"] = services;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After countless hours trying to handle fetching the legacy endpoint (ATTRIB tx) on the rust side before crossing the ffi bridge I resigned.

I don't like it but I have added this code to the python wrapper to fetch the ATTRIB data and attach it to the did document.

If the PoolResolver is used from Rust projects (e.g. the proxy server) then this custom code is not necessary, but handled internally.

domwoe added 2 commits March 25, 2022 12:44
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
@domwoe domwoe force-pushed the feature/python-with-multiple-ledger-support branch from d518c99 to 9906f32 Compare March 28, 2022 07:28
domwoe added 11 commits March 28, 2022 09:34
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
…rate_did dependeny

Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Woerner <dom.woe@gmail.com>
Signed-off-by: Dominic Woerner <dom.woe@gmail.com>
Signed-off-by: Dominic Woerner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Get attrib with optional seq_no and timestamp and self-cert version tests
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
@andrewwhitehead andrewwhitehead merged commit f76735d into hyperledger:did-indy Apr 7, 2022
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.

2 participants