# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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.
type: object
title: CrossSigningKey
description: Cross signing key
properties:
  user_id:
    type: string
    description: |-
      The ID of the user the key belongs to.
    example: "@alice:example.com"
  usage:
    type: array
    description: |-
      What the key is used for.
    items:
      type: string
      enum: ["master", "self_signing", "user_signing"]
  keys:
    type: object
    additionalProperties:
      type: string
    description: |-
      The public key.  The object must have exactly one property, whose name is
      in the form `<algorithm>:<unpadded_base64_public_key>`, and whose value
      is the unpadded base64 public key.
    minProperties: 1
    maxProperties: 1
    example:
      "ed25519:alice+base64+public+key": "alice+base64+public+key"
  signatures:
    type: object
    title: Signatures
    description: |-
      Signatures of the key, calculated using the process described at [Signing JSON](/appendices/#signing-json).
      Optional for the master key. Other keys must be signed by the
      user\'s master key.
    example: {
        "@alice:example.com": {
            "ed25519:alice+base64+master+key": "signature+of+key"
          }
      }
required:
  - user_id
  - usage
  - keys
