kamax-matrix / matrix-java-sdk

Matrix Java SDK
GNU Affero General Public License v3.0
21 stars 14 forks source link

Implement auto-discovery of the Client APIs (Home, Identity) endpoints #23

Closed maxidorius closed 6 years ago

maxidorius commented 6 years ago

There is currently no official way in the spec to discover the client endpoint for a given Matrix domain, which would be the equivalent of the SRV record for the S2S API.

Following several conversations and exchanges [1] [2], we'll use a .well-known URL [RFC 5785].

For the domain example.org, the discovery URL will be: https://example.org/.well-known/matrix It will return a status code 200 and body as JSON object like so:

{
  "m.hs": {
    "base_urls": [
      "https://a.mxhsd.example.org",
      "https://b.mxhsd.example.org",
      "https://c.mxhsd.example.org/with/prefix/path",
      "https://d.mxhsd.example.org:12345"
    ]
  },
  "m.is": {
    "base_urls": [
      "https://a.mxisd.example.org",
      "https://b.mxisd.example.org",
      "https://c.mxisd.example.org/with/prefix/path",
      "https://d.mxisd.example.org:12345"
    ]
  },
  "im.vector.riot.integrations": {
    "ui_url": "https://dimension.example.org/riot",
    "rest_url": "https://dimension.example.org/api/v1/scalar",
    "widgets_urls": [
      "https://dimension.example.org/widgets"
    ]
  }
}

For base_urls in m.hs and m.is:

Every other entry will be DNS namespace, like other parts of the Matrix protocol, so custom features in clients can also receive dedicated configuration, or rely on other other clients supported configuration. In this case, im.vector.riot.integrations would reference to the Riot Integration Manager and any other client that supports it.

/_matrix/identity/versions will be defined at https://kamax.io/matrix/api/identity_service/unstable.html

This implementation will be documented at https://kamax.io/matrix/api/client_server/unstable.html

maxidorius commented 6 years ago

This has been turned into a Google Docs proposal.

maxidorius commented 6 years ago

Done in #26