fix some things

This commit is contained in:
Cayo Puigdefabregas 2024-01-16 14:01:15 +01:00
parent 01bc21d1a4
commit 1453ddf451
2 changed files with 6 additions and 6 deletions

View File

@ -64,7 +64,7 @@ class Command(BaseCommand):
def create_defaults_dids(self):
for u in User.objects.all():
did = DID(label="Default", user=u)
did = DID(label="Default", user=u, type=DID.Types.KEY)
did.set_did()
did.save()

View File

@ -29,14 +29,14 @@ def webdid_from_controller_key(key):
keydid = keydid_from_controller_key(key) # "did:key:<...>"
pubkeyid = keydid.rsplit(":")[-1] # <...>
document = json.loads(asyncio.run(resolve_keydid(keydid))) # Documento DID en terminos "key"
webdid_url = f"did:web:{settings.DOMAIN}:{pubkeyid}" # nueva URL: "did:web:idhub.pangea.org:<...>"
webdid_url = f"did:web:{settings.DOMAIN}:did-registry:{pubkeyid}" # nueva URL: "did:web:idhub.pangea.org:<...>"
webdid_url_owner = webdid_url + "#owner"
# Reemplazamos los campos del documento DID necesarios:
document["id"] = webdid_url
document["verificationMethod"]["id"] = webdid_url_owner
document["verificationMethod"]["controller"] = webdid_url
document["authentication"] = webdid_url_owner
document["assertionMethod"] = webdid_url_owner
document["verificationMethod"][0]["id"] = webdid_url_owner
document["verificationMethod"][0]["controller"] = webdid_url
document["authentication"][0] = webdid_url_owner
document["assertionMethod"][0] = webdid_url_owner
document_fixed_serialized = json.dumps(document)
return webdid_url, document_fixed_serialized