urlparse domain

This commit is contained in:
Cayo Puigdefabregas 2024-01-20 11:36:45 +01:00
parent be985b52e7
commit e87db60b7e
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import asyncio
import datetime import datetime
import didkit import didkit
import json import json
import urllib
import jinja2 import jinja2
from django.template.backends.django import Template from django.template.backends.django import Template
from django.template.loader import get_template from django.template.loader import get_template
@ -29,7 +30,8 @@ def webdid_from_controller_key(key):
keydid = keydid_from_controller_key(key) # "did:key:<...>" keydid = keydid_from_controller_key(key) # "did:key:<...>"
pubkeyid = keydid.rsplit(":")[-1] # <...> pubkeyid = keydid.rsplit(":")[-1] # <...>
document = json.loads(asyncio.run(resolve_keydid(keydid))) # Documento DID en terminos "key" document = json.loads(asyncio.run(resolve_keydid(keydid))) # Documento DID en terminos "key"
webdid_url = f"did:web:{settings.DOMAIN}:did-registry:{pubkeyid}" # nueva URL: "did:web:idhub.pangea.org:<...>" domain = urllib.parse.urlencode({"domain": settings.DOMAIN})[7:]
webdid_url = f"did:web:{domain}:did-registry:{pubkeyid}" # nueva URL: "did:web:idhub.pangea.org:<...>"
webdid_url_owner = webdid_url + "#owner" webdid_url_owner = webdid_url + "#owner"
# Reemplazamos los campos del documento DID necesarios: # Reemplazamos los campos del documento DID necesarios:
document["id"] = webdid_url document["id"] = webdid_url