TBD54566975 / web5-spec

https://tbd54566975.github.io/sdk-report-runner/
Apache License 2.0
6 stars 5 forks source link

How to add service to an existing DID (and more broadly, how to update) #157

Open jiyoontbd opened 1 month ago

jiyoontbd commented 1 month ago

We need to hold design discussions to come up with a unified update() method signature that complies with how each did method handles (or doesn't handle) updates, and has an intuitive DX which allows the developer to discover what operations can or can't be done with specific did methods.

For example, although addService() implemented in https://github.com/TBD54566975/web5-kt/pull/313 would add a service to BearerDid construct, BearerDid is an abstraction that holds a DID (of any kind) and related objects like keymanager and diddocument.

Adding a service should have downstream implications besides mutating our library-specific BearerDid abstraction, but https://github.com/TBD54566975/web5-kt/pull/313 does not (and cannot, without prior design discussion) support the downstream actions.

A couple examples to illustrate this point:

  1. If we were to add a service to an existing did:dht, we need to also publish the mutated DID, otherwise if we resolve the same did:dht again, the new service would not exist in the resolution result.
  2. If we were to try and add a service to an existing did:jwk, that actually should not be possible, because did:jwk does not support updates at all.

relevant issues / PRs https://github.com/TBD54566975/web5-kt/issues/310 https://github.com/TBD54566975/web5-kt/pull/311 https://github.com/TBD54566975/web5-kt/pull/313

decentralgabe commented 1 month ago

Do we have a consistent interface for interacting with DIDs? Update should certainly be one of the methods on that interface. Not all methods need to implement all methods on the interface.