did schemas: key, web #1

Open
opened 2025-02-12 11:58:51 +00:00 by leandro · 0 comments
Owner

Hola, en resumen, no hay que preocuparse :-)

Veo que la implementación actual solo soporta did:web y no did: key

  • did: key Había hecho el año pasado un código para did:key que funcionaba igual que la de SpruceID. La ventaja de un did🔑 es que es autocontenido: incluye la clave pública y el DID document se genera directamente a partir del valor que va en el DID. Vale la pena incluirlo? Quizá no si did:web sirve para todo.
  • did:web veo que sí cumple un caso del estándard) y el elemento del path extra que comentaba ha de estar para que funcione como Ejemplo 5 (abajo) y tengamos control sobre el path del URL. El caso del Ejemplo 4 con did:web sin path resulta más compacto como abajo pero se inserta .well-known/ como path por defecto para buscar el did.json.

El código actual en pvckit es:

def resolve_did(did):
    if did[:8] != "did:web:":
        return
    try:
        url = "https://" + "/".join(did.split(":")[2:]) + "/did.json"
        response = requests.get(url)
    except Exception:
        url = "http://" + "/".join(did.split(":")[2:]) + "/did.json"
        response = requests.get(url)
    if 200 <= response.status_code < 300:
        return response.json()

El estándard dice:

Creating a DID is done by:

1. applying at a domain name registrar for use of a domain name and
2. storing the location of a hosting service, the IP address at a DNS lookup service
3. creating the DID document JSON-LD file including a suitable keypair, e.g. using the Koblitz Curve, and storing the did.json file under the well-known URL to represent the entire domain, or under the specified path if many DIDs will be resolved in this domain.
For example, for the domain name w3c-ccg.github.io, the did.json will be available under the following URL:

EXAMPLE 4: Creating the DID
did:web:w3c-ccg.github.io
 -> https://w3c-ccg.github.io/.well-known/did.json
If an optional path is specified rather the bare domain, the did.json will be available under the specified path:

EXAMPLE 5: Creating the DID with optional path
did:web:w3c-ccg.github.io:user:alice
 -> https://w3c-ccg.github.io/user/alice/did.json
If an optional port is specified on the domain, the port colon splitting the host and the port MUST be percent encoded to prevent collision with the path.

EXAMPLE 6: Creating the DID with optional path and port
did:web:example.com%3A3000:user:alice
 -> https://example.com:3000/user/alice/did.json

Hola, en resumen, no hay que preocuparse :-) Veo que la implementación actual solo soporta did:web y no did: key - did: key Había hecho el año pasado un código para did:key que funcionaba igual que la de SpruceID. La ventaja de un did:key: es que es autocontenido: incluye la clave pública y el DID document se genera directamente a partir del valor que va en el DID. Vale la pena incluirlo? Quizá no si did:web sirve para todo. - did:web veo que sí cumple un caso del [estándard](https://w3c-ccg.github.io/did-method-web/#create-register)) y el elemento del path extra que comentaba **ha de estar** para que funcione como Ejemplo 5 (abajo) y tengamos control sobre el path del URL. El caso del Ejemplo 4 con did:web sin path resulta más compacto como abajo pero se inserta `.well-known/` como path por defecto para buscar el did.json. El código actual en pvckit es: ``` def resolve_did(did): if did[:8] != "did:web:": return try: url = "https://" + "/".join(did.split(":")[2:]) + "/did.json" response = requests.get(url) except Exception: url = "http://" + "/".join(did.split(":")[2:]) + "/did.json" response = requests.get(url) if 200 <= response.status_code < 300: return response.json() ``` El estándard dice: ``` Creating a DID is done by: 1. applying at a domain name registrar for use of a domain name and 2. storing the location of a hosting service, the IP address at a DNS lookup service 3. creating the DID document JSON-LD file including a suitable keypair, e.g. using the Koblitz Curve, and storing the did.json file under the well-known URL to represent the entire domain, or under the specified path if many DIDs will be resolved in this domain. For example, for the domain name w3c-ccg.github.io, the did.json will be available under the following URL: EXAMPLE 4: Creating the DID did:web:w3c-ccg.github.io -> https://w3c-ccg.github.io/.well-known/did.json If an optional path is specified rather the bare domain, the did.json will be available under the specified path: EXAMPLE 5: Creating the DID with optional path did:web:w3c-ccg.github.io:user:alice -> https://w3c-ccg.github.io/user/alice/did.json If an optional port is specified on the domain, the port colon splitting the host and the port MUST be percent encoded to prevent collision with the path. EXAMPLE 6: Creating the DID with optional path and port did:web:example.com%3A3000:user:alice -> https://example.com:3000/user/alice/did.json ```
cayop was assigned by leandro 2025-02-12 11:58:51 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: ereuse/pyvckit#1
No description provided.