# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

swagger: '2.0'
info:
  title: "Matrix Federation Key Exchange API"
  version: "1.0.0"
host: localhost:8448
schemes:
  - https
basePath: /_matrix/key/v2
produces:
  - application/json
paths:
  "/server/{keyId}":
    get:
      summary: Get the homeserver's public key(s)
      description: |-
        Gets the homeserver's published signing keys.
        The homeserver may have any number of active keys and may have a
        number of old keys.

        Intermediate notary servers should cache a response for half of its
        lifetime to avoid serving a stale response. Originating servers should
        avoid returning responses that expire in less than an hour to avoid
        repeated reqests for a certificate that is about to expire. Requesting
        servers should limit how frequently they query for certificates to
        avoid flooding a server with requests.

        If the server fails to respond to this request, intermediate notary
        servers should continue to return the last response they received
        from the server so that the signatures of old events can still be
        checked.
      operationId: getServerKey
      parameters:
        - in: path
          name: keyId
          type: string
          description: |-
            **Deprecated**. Servers should not use this parameter and instead
            opt to return all keys, not just the requested one. The key ID to
            look up.

            When excluded, the trailing slash on this endpoint is optional.
          required: false
          x-example: "ed25519:abc123"
          deprecated: true
      responses:
        200:
          description: The homeserver's keys
          schema:
            $ref: "definitions/keys.yaml"
