# 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.
openapi: 3.1.0
info:
  title: Matrix Federation Event Authorization API
  version: 1.0.0
paths:
  "/event_auth/{roomId}/{eventId}":
    get:
      summary: Get the auth chain for a given event
      description: Retrieves the complete auth chain for a given event.
      operationId: getEventAuth
      security:
        - signedRequest: []
      parameters:
        - in: path
          name: roomId
          description: The room ID to get the auth chain for.
          required: true
          example: "!abc123:matrix.org"
          schema:
            type: string
        - in: path
          name: eventId
          description: The event ID to get the auth chain of.
          required: true
          example: $helloworld:example.org
          schema:
            type: string
      responses:
        "200":
          description: The auth chain for the event.
          content:
            application/json:
              schema:
                type: object
                properties:
                  auth_chain:
                    type: array
                    description: |-
                      The [PDUs](/server-server-api/#pdus) forming the auth chain
                      of the given event. The event format varies depending on the
                      room version - check the [room version specification](/rooms)
                      for precise event formats.
                    items:
                      type: object
                      title: PDU
                      properties: {}
                      example:
                        $ref: examples/minimal_pdu.json
                required:
                  - auth_chain
servers:
  - url: "{protocol}://{hostname}{basePath}"
    variables:
      protocol:
        enum:
          - http
          - https
        default: https
      hostname:
        default: localhost:8448
      basePath:
        default: /_matrix/federation/v1
components:
  securitySchemes:
    signedRequest:
      $ref: definitions/security.yaml#/signedRequest
