| 
 | 1 | +# Copyright 2020 The Matrix.org Foundation C.I.C.  | 
 | 2 | +#  | 
 | 3 | +# Licensed under the Apache License, Version 2.0 (the "License");  | 
 | 4 | +# you may not use this file except in compliance with the License.  | 
 | 5 | +# You may obtain a copy of the License at  | 
 | 6 | +#  | 
 | 7 | +#     http://www.apache.org/licenses/LICENSE-2.0  | 
 | 8 | +#  | 
 | 9 | +# Unless required by applicable law or agreed to in writing, software  | 
 | 10 | +# distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 12 | +# See the License for the specific language governing permissions and  | 
 | 13 | +# limitations under the License.  | 
 | 14 | +swagger: '2.0'  | 
 | 15 | +info:  | 
 | 16 | +  title: "Matrix Client-Server Cross Signing API"  | 
 | 17 | +  version: "1.0.0"  | 
 | 18 | +host: localhost:8008  | 
 | 19 | +schemes:  | 
 | 20 | +  - https  | 
 | 21 | +  - http  | 
 | 22 | +basePath: /_matrix/client/%CLIENT_MAJOR_VERSION%  | 
 | 23 | +consumes:  | 
 | 24 | +  - application/json  | 
 | 25 | +produces:  | 
 | 26 | +  - application/json  | 
 | 27 | +securityDefinitions:  | 
 | 28 | +  $ref: definitions/security.yaml  | 
 | 29 | +paths:  | 
 | 30 | +  "/keys/device_signing/upload":  | 
 | 31 | +    post:  | 
 | 32 | +      summary: Upload cross-signing keys.  | 
 | 33 | +      description: |-  | 
 | 34 | +        Publishes cross-signing keys for the user.  | 
 | 35 | +
  | 
 | 36 | +        This API endpoint uses the `User-Interactive Authentication API`_.  | 
 | 37 | +      operationId: uploadCrossSigningKeys  | 
 | 38 | +      security:  | 
 | 39 | +        - accessToken: []  | 
 | 40 | +      parameters:  | 
 | 41 | +        - in: body  | 
 | 42 | +          name: keys  | 
 | 43 | +          description: |-  | 
 | 44 | +            The keys to be published.  | 
 | 45 | +          schema:  | 
 | 46 | +            type: object  | 
 | 47 | +            properties:  | 
 | 48 | +              master_key:  | 
 | 49 | +                description: |-  | 
 | 50 | +                  Optional. The user\'s master key.  | 
 | 51 | +                allOf:  | 
 | 52 | +                  - $ref: definitions/cross_signing_key.yaml  | 
 | 53 | +              self_signing_key:  | 
 | 54 | +                description: |-  | 
 | 55 | +                  Optional. The user\'s self-signing key. Must be signed by  | 
 | 56 | +                  the accompanying master key, or by the user\'s most recently  | 
 | 57 | +                  uploaded master key if no master key is included in the  | 
 | 58 | +                  request.  | 
 | 59 | +                allOf:  | 
 | 60 | +                  - $ref: definitions/cross_signing_key.yaml  | 
 | 61 | +              user_signing_key:  | 
 | 62 | +                description: |-  | 
 | 63 | +                  Optional. The user\'s user-signing key. Must be signed by  | 
 | 64 | +                  the accompanying master key, or by the user\'s most recently  | 
 | 65 | +                  uploaded master key if no master key is included in the  | 
 | 66 | +                  request.  | 
 | 67 | +                allOf:  | 
 | 68 | +                  - $ref: definitions/cross_signing_key.yaml  | 
 | 69 | +            example: {  | 
 | 70 | +              "master_key": {  | 
 | 71 | +                "user_id": "@alice:example.com",  | 
 | 72 | +                "usage": ["master"],  | 
 | 73 | +                "keys": {  | 
 | 74 | +                  "ed25519:base64+master+public+key": "base64+master+public+key",  | 
 | 75 | +                }  | 
 | 76 | +              },  | 
 | 77 | +              "self_signing_key": {  | 
 | 78 | +                "user_id": "@alice:example.com",  | 
 | 79 | +                "usage": ["self_signing"],  | 
 | 80 | +                "keys": {  | 
 | 81 | +                  "ed25519:base64+self+signing+public+key": "base64+self+signing+master+public+key",  | 
 | 82 | +                },  | 
 | 83 | +                "signatures": {  | 
 | 84 | +                  "@alice:example.com": {  | 
 | 85 | +                    "ed25519:base64+master+public+key": "signature+of+self+signing+key"  | 
 | 86 | +                  }  | 
 | 87 | +                }  | 
 | 88 | +              },  | 
 | 89 | +              "user_signing_key": {  | 
 | 90 | +                "user_id": "@alice:example.com",  | 
 | 91 | +                "usage": ["user_signing"],  | 
 | 92 | +                "keys": {  | 
 | 93 | +                  "ed25519:base64+user+signing+public+key": "base64+user+signing+master+public+key",  | 
 | 94 | +                },  | 
 | 95 | +                "signatures": {  | 
 | 96 | +                  "@alice:example.com": {  | 
 | 97 | +                    "ed25519:base64+master+public+key": "signature+of+user+signing+key"  | 
 | 98 | +                  }  | 
 | 99 | +                }  | 
 | 100 | +              }  | 
 | 101 | +            }  | 
 | 102 | +      responses:  | 
 | 103 | +        200:  | 
 | 104 | +          description: The provided keys were successfully uploaded.  | 
 | 105 | +          schema:  | 
 | 106 | +            type: object  | 
 | 107 | +            example: {}  | 
 | 108 | +        400:  | 
 | 109 | +          description: |-  | 
 | 110 | +            The input was invalid in some way. This can include one of the  | 
 | 111 | +            following error codes:  | 
 | 112 | +
  | 
 | 113 | +            * ``M_INVALID_SIGNATURE``: For example, the self-signing or  | 
 | 114 | +              user-signing key had an incorrect signature.  | 
 | 115 | +            * ``M_MISSING_PARAM``: No master key is available.  | 
 | 116 | +          schema:  | 
 | 117 | +            type: object  | 
 | 118 | +            example: {  | 
 | 119 | +              "errcode": "M_INVALID_SIGNATURE",  | 
 | 120 | +              "error": "Invalid signature"  | 
 | 121 | +            }  | 
 | 122 | +        403:  | 
 | 123 | +          description: |-  | 
 | 124 | +            The public key of one of the keys is the same as one of the user\'s  | 
 | 125 | +            device IDs, or the request is not authorized for any other reason.  | 
 | 126 | +          schema:  | 
 | 127 | +            type: object  | 
 | 128 | +            example: {  | 
 | 129 | +              "errcode": "M_FORBIDDEN",  | 
 | 130 | +              "error": "Key ID in use"  | 
 | 131 | +            }  | 
 | 132 | +  "/keys/signatures/upload":  | 
 | 133 | +    post:  | 
 | 134 | +      summary: Upload cross-signing signatures.  | 
 | 135 | +      description: |-  | 
 | 136 | +        Publishes cross-signing signatures for the user.  The request body is a  | 
 | 137 | +        map from user ID to key ID to signed JSON object.  | 
 | 138 | +      operationId: uploadCrossSigningSignatures  | 
 | 139 | +      security:  | 
 | 140 | +        - accessToken: []  | 
 | 141 | +      parameters:  | 
 | 142 | +        - in: body  | 
 | 143 | +          name: signatures  | 
 | 144 | +          description: |-  | 
 | 145 | +            The signatures to be published.  | 
 | 146 | +          schema:  | 
 | 147 | +            type: object  | 
 | 148 | +            title: Signatures  | 
 | 149 | +            additionalProperties:  | 
 | 150 | +              type: object  | 
 | 151 | +              additionalProperties:  | 
 | 152 | +                type: object  | 
 | 153 | +            example: {  | 
 | 154 | +              "@alice:example.com": {  | 
 | 155 | +                "HIJKLMN": {  | 
 | 156 | +                  "user_id": "@alice:example.com",  | 
 | 157 | +                  "device_id": "HIJKLMN",  | 
 | 158 | +                  "algorithms": [  | 
 | 159 | +                    "m.olm.curve25519-aes-sha256",  | 
 | 160 | +                    "m.megolm.v1.aes-sha"  | 
 | 161 | +                  ],  | 
 | 162 | +                  "keys": {  | 
 | 163 | +                    "curve25519:HIJKLMN": "base64+curve25519+key",  | 
 | 164 | +                    "ed25519:HIJKLMN": "base64+ed25519+key"  | 
 | 165 | +                  },  | 
 | 166 | +                  "signatures": {  | 
 | 167 | +                    "@alice:example.com": {  | 
 | 168 | +                      "ed25519:base64+self+signing+public+key": "base64+signature+of+HIJKLMN"  | 
 | 169 | +                    }  | 
 | 170 | +                  }  | 
 | 171 | +                },  | 
 | 172 | +                "base64+master+public+key": {  | 
 | 173 | +                  "user_id": "@alice:example.com",  | 
 | 174 | +                  "usage": ["master"],  | 
 | 175 | +                  "keys": {  | 
 | 176 | +                    "ed25519:base64+master+public+key": "base64+master+public+key"  | 
 | 177 | +                  },  | 
 | 178 | +                  "signatures": {  | 
 | 179 | +                    "@alice:example.com": {  | 
 | 180 | +                      "ed25519:HIJKLMN": "base64+signature+of+master+key"  | 
 | 181 | +                    }  | 
 | 182 | +                  }  | 
 | 183 | +                }  | 
 | 184 | +              },  | 
 | 185 | +              "@bob:example.com": {  | 
 | 186 | +                "bobs+base64+master+public+key": {  | 
 | 187 | +                  "user_id": "@bob:example.com",  | 
 | 188 | +                  "keys": {  | 
 | 189 | +                    "ed25519:bobs+base64+master+public+key": "bobs+base64+master+public+key"  | 
 | 190 | +                  },  | 
 | 191 | +                  "usage": ["master"],  | 
 | 192 | +                  "signatures": {  | 
 | 193 | +                    "@alice:example.com": {  | 
 | 194 | +                      "ed25519:base64+user+signing+public+key": "base64+signature+of+bobs+master+key"  | 
 | 195 | +                    }  | 
 | 196 | +                  }  | 
 | 197 | +                }  | 
 | 198 | +              }  | 
 | 199 | +            }  | 
 | 200 | +      responses:  | 
 | 201 | +        200:  | 
 | 202 | +          description: The provided signatures were processed.  | 
 | 203 | +          schema:  | 
 | 204 | +            type: object  | 
 | 205 | +            properties:  | 
 | 206 | +              failures:  | 
 | 207 | +                type: object  | 
 | 208 | +                description: |-  | 
 | 209 | +                  A map from user ID to key ID to an error for any signatures  | 
 | 210 | +                  that failed.  If a signature was invalid, the ``errcode`` will  | 
 | 211 | +                  be set to ``M_INVALID_SIGNATURE``.  | 
 | 212 | +                additionalProperties:  | 
 | 213 | +                  type: object  | 
 | 214 | +                  additionalProperties:  | 
 | 215 | +                    type: object  | 
 | 216 | +                    title: Error  | 
 | 217 | +                example: {  | 
 | 218 | +                  "@alice:example.com": {  | 
 | 219 | +                    "HIJKLMN": {  | 
 | 220 | +                      "errcode": "M_INVALID_SIGNATURE",  | 
 | 221 | +                      "error": "Invalid signature"  | 
 | 222 | +                    }  | 
 | 223 | +                  }  | 
 | 224 | +                }  | 
0 commit comments