Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the technical definition of watchers to the specification #181

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

swcurran
Copy link
Collaborator

@swcurran swcurran commented Mar 4, 2025

Adds the concept of watchers to the spec. As always, provides a relatively short/simple technical implementation, and leaves the governance / implementation details out of the spec. That said, it does add more implementation details than, say, the witness implmentation.

Watchers are a list of URLs that monitor the DID. The URL must respond to a core set of 5 endpoints to return the cached DID Log, return the cached witness.json file, return a cached resource, webhook about an update to the DID, webhook about an update to a resource.

It's a slippery slope to define how much to include.

Questions from me:

  1. Feedback on what is there so far?
  2. What details need to be added about the list as DID Metadata?
  3. Should the webhooks have an attached proof for "authorization"?

Signed-off-by: Stephen Curran [email protected]

@swcurran swcurran requested review from a team March 4, 2025 23:31
Comment on lines 1186 to 1202
##### Watcher Endpoints and Behaviour

A [[ref: watcher]] that has its HTTP URL published in the [[ref: DID Log]] of a `did:webvh` must support the following endpoints. The query parameters **MUST NOT** be used in combination:

- `HTTP GET <WATCHER URL>?vhscid=<SCID>` — Returns the most recent `did:webvh` [[ref: DID Log]] file for the DID with the provided `<SCID>` from the [[ref: watchers]] cache.

- `HTTP GET <WATCHER URL>?vhscid-witness=<SCID>` — Returns the most recent `did:webvh` `witness.json` file for the DID with the provided `<SCID>` from the [[ref: watchers]] cache.

- `HTTP GET <WATCHER URL>?vhscid=<SCID>&resource=<RESOURCE_PATH>` — Requests the cached version of the specified `<RESOURCE_PATH>` for the given `<SCID>`. If the resource is not found in the cache, the watcher **SHOULD** return a `404 Not Found` response.

- `HTTP POST <WATCHER URL>?vhscid=<SCID>` — Sent by the [[ref: DID Controller]] or another authorized party to notify the [[ref: watcher]] that the `did:webvh` DID has been updated and should be retrieved from the DID's web location.

- `HTTP POST <WATCHER URL>?vhscid-entry=<SCID>` — Sent by the [[ref: DID Controller]] or another authorized party to notify the [[ref: watcher]] that the `did:webvh` DID has been updated and provides, as the body of the message, the [[ref: JSON Line]] that is the new [[ref: DID log entry]].

- This endpoint can be used when the [[ref: watcher]] is also a [[ref: witness]] and is used to notify the [[ref: witness]] that a new entry has been created that the witness must verify and approve.

- `HTTP POST <WATCHER URL>?vhscid=<SCID>&resource=<RESOURCE_PATH>` — Sent by the [[ref: DID Controller]] or another authorized party to notify the [[ref: watcher]] that a new [[ref: DID resource]] (file) has been published under the given `<RESOURCE_PATH>` and should be retrieved and cached.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we only have 1 endpoint defined or have a set of endpoints relevant to their actions? Having only 1 endpoint might overload this endpoint.

The operations a watcher should do can be summed up as:

  • Return latest log entry for a given SCID
  • Signal a new log entry is available for a given SCID
  • Return witness file for a given SCID
  • Request witness signature for a given log entry and SCID
    • Only on the case of a witness-watcher
  • Return resource for a given SCID and resource path
  • Signal new resource for a given SCID and resource path

I would suggest to divide these operations into 3 endpoints to avoid overloading:
<WATCHER URL>/log
<WATCHER URL>/witness
<WATCHER URL>/resource

Operations can be carried as such:

GET <WATCHER URL>/log?scid=<SCID>
Returns latest log entry.

POST <WATCHER URL>/log?scid=<SCID>
Empty body, fetch and update log entries.

GET <WATCHER URL>/witness?scid=<SCID>
Returns witness file.

POST <WATCHER URL>/witness?scid=<SCID>

{
    "logEntry": {...},
    "options": {
        "callbackUrl": "https://..."
    }
}

Validates and signs the log entry provided in request body. This endpoint can return a 200 with the witness proof or a 202 with an empty body, having the proof returned as a POST request to the callbackUrl provided.

GET <WATCHER URL>/resource?scid=<SCID>&path=<resourcePath>
Returns resource

POST <WATCHER URL>/resource?scid=<SCID>&path=<resourcePath>
Fetch and updates resource

@swcurran
Copy link
Collaborator Author

Updated the PR to add items discussed at the 2025-03-13 Meeting. Notably:

  • Added a "DELETE" endpoint that requests removal of a SCID from the watcher's cache -- governance outside of this specification.
  • Added that all POST and DELETE must respond to the successful receipt of a message with a 202, indicating asynchronous processing will occur. This eliminates the possiblity of a POST of the entry for a witness responding in any way other than via the callback.
  • Added that the URLs can be any type, and that if they are HTTP(S) URLs, they MUST adhere to the defined endpoints.

Not done yet:

  • attach an OpenAPI definition of the API (@PatStLouis ?)
  • define if/how any of the POSTs can/should be associated with the DID Controller -- a proof and if so the impact on the API. For example, should a DELETE have to have a proof, if it is possible that the DID Controller no longer exists? Which is of course, back to governance.
  • anything for the sender about POSTs/DELETE if a 202 is not received -- e.g. retries, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants