TBD54566975 / web5-kt

Apache License 2.0
10 stars 10 forks source link

Update did:dht to conform to the latest version of the specification #303

Open decentralgabe opened 5 months ago

decentralgabe commented 5 months ago

There have been a number of changes to the DID DHT spec since implementation, which I've captured below. These changes should be backwards compatible, meaning DIDs you use today will not break.

These changes are already in place in the DID DHT project itself, and you can find passing test vectors here as a reference.

  1. Support the three test vectors listed here: https://did-dht.com/#test-vectors
  2. Support NS records to be set to the publishing gateway (as per https://did-dht.com/#designating-authoritative-gateways, https://github.com/TBD54566975/did-dht-method/issues/129)
  3. Always set alg and kid on expansion (to the values in the registry), support overriding of alg values (as per https://github.com/TBD54566975/did-dht-method/pull/148)
  4. Support TXT records over 255 characters (as per https://github.com/TBD54566975/did-dht-method/pull/162)
  5. Set verification method's controller property, allow overriding (as per https://github.com/TBD54566975/did-dht-method/pull/102)
  6. Stamp version field in the root record - set to 0 for now (as per https://github.com/TBD54566975/did-dht-method/pull/102)
  7. Support multiple service endpoints (as per https://github.com/TBD54566975/did-dht-method/pull/86)
  8. Support X25519 (as per https://github.com/TBD54566975/did-dht-method/pull/148) - note this is required for the 3rd test vector

Additionally, I would recommend:

  1. Support a republish feature, which is able to take the latest state of a DID DHT document and re-publish it to a gateway.

If not in practice already, it would make sense to expand our "PortableDID" construct to store histories of DID DHT documents and republish should only work on the latest version (seq num).


After this you can anticipate two additional changes to DID DHT pertaining to the following issues:

74 will be a breaking change, though (9) from above paves a path to make it less disruptive.

Please let me know if you have any questions.