web5-js icon indicating copy to clipboard operation
web5-js copied to clipboard

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

Open decentralgabe opened this issue 2 months ago • 3 comments

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:

  • https://github.com/TBD54566975/did-dht-method/issues/74
  • https://github.com/TBD54566975/did-dht-method/issues/100

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.

decentralgabe avatar Apr 23 '24 23:04 decentralgabe

ok so in web5-js:

❌ - Not done 🟡 - Needs further investigation ✅ - Done ⌛ - Depriortized (for now)

  1. ❌ Support the three test vectors listed here (Needs to be fully implemented)

  2. ❌ Support NS records to be set to the publishing gateway (needs to be fully implemented)

  3. 🟡 Always set alg and kid on expansion (not sure if this exists currently)

  4. 🟡 Support TXT records over 255 characters I don't see anything in the code preventing this, need to create a unit test / consume test vector to confirm we can handle over 255

  5. ✅ Set verification method's controller property (Already done)

  6. ✅ stamp version field in the root record (Already version 0)

  7. ✅ Support multiple service endpoints (already supported)

  8. ⌛ Support X25519 (need to fully implement this, but low-pri as it is considered optional for now)

  9. ⌛ Support a republish feature.

nitro-neal avatar Apr 25 '24 21:04 nitro-neal

@nitro-neal

5 - looks right 6 - this is fine - my mistake mentioning 1, 0 is correct 8 - would consider this optional for now

decentralgabe avatar Apr 26 '24 16:04 decentralgabe

Number 3 draft pr - https://github.com/TBD54566975/web5-js/pull/502

nitro-neal avatar Apr 29 '24 21:04 nitro-neal