|
|
|
# Copyright 2022 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.
|
|
|
|
openapi: 3.1.0
|
|
|
|
info:
|
|
|
|
title: Matrix Client-Server Registration Token API
|
|
|
|
version: 1.0.0
|
|
|
|
paths:
|
|
|
|
/register/m.login.registration_token/validity:
|
|
|
|
get:
|
|
|
|
x-addedInMatrixVersion: "1.2"
|
|
|
|
summary: Query if a given registration token is still valid.
|
|
|
|
description: |-
|
|
|
|
Queries the server to determine if a given registration token is still
|
|
|
|
valid at the time of request. This is a point-in-time check where the
|
|
|
|
token might still expire by the time it is used.
|
|
|
|
|
|
|
|
Servers should be sure to rate limit this endpoint to avoid brute force
|
|
|
|
attacks.
|
|
|
|
operationId: registrationTokenValidity
|
|
|
|
parameters:
|
|
|
|
- in: query
|
|
|
|
name: token
|
|
|
|
required: true
|
|
|
|
description: The token to check validity of.
|
|
|
|
example: fBVFdqVE
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
description: The check has a result.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
valid:
|
|
|
|
type: boolean
|
|
|
|
description: |-
|
|
|
|
True if the token is still valid, false otherwise. This should
|
|
|
|
additionally be false if the token is not a recognised token by
|
|
|
|
the server.
|
|
|
|
required:
|
|
|
|
- valid
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"valid": true
|
|
|
|
}
|
|
|
|
"403":
|
|
|
|
description: |-
|
|
|
|
The homeserver does not permit registration and thus all tokens are
|
|
|
|
considered invalid.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "M_FORBIDDEN",
|
|
|
|
"error": "Registration is not enabled on this homeserver."
|
|
|
|
}
|
|
|
|
"429":
|
|
|
|
description: This request was rate-limited.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: definitions/errors/rate_limited.yaml
|
|
|
|
tags:
|
|
|
|
- Account management
|
|
|
|
servers:
|
|
|
|
- url: "{protocol}://{hostname}{basePath}"
|
|
|
|
variables:
|
|
|
|
protocol:
|
|
|
|
enum:
|
|
|
|
- http
|
|
|
|
- https
|
|
|
|
default: https
|
|
|
|
hostname:
|
|
|
|
default: localhost:8008
|
|
|
|
basePath:
|
|
|
|
default: /_matrix/client/v1
|