Skip to content

Commit

Permalink
Use stable forms for registration tokens
Browse files Browse the repository at this point in the history
https://spec.matrix.org/v1.2/client-server-api/#token-authenticated-registration

This isn't ready to be used yet because the patch for synapse hasn't been
merged (matrix-org/synapse#11867).
  • Loading branch information
govynnus committed Feb 3, 2022
1 parent dc55f64 commit 87d2826
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/mtx/responses/register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void
from_json(const nlohmann::json &obj, Register &response);

//! Response from the `GET
//! /_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity`
//! /_matrix/client/v1/register/m.login.registration_token/validity`
//! endpoint.
struct RegistrationTokenValidity
{
Expand Down
2 changes: 1 addition & 1 deletion include/mtx/user_interactive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ constexpr std::string_view dummy = "m.login.dummy";
//! Authentication by accepting a set of terms like a privacy policy.
constexpr std::string_view terms = "m.login.terms"; // see MSC1692
//! Authentication using a registration token. See MSC3231.
constexpr std::string_view registration_token = "org.matrix.msc3231.login.registration_token";
constexpr std::string_view registration_token = "m.login.registration_token";
}

//! A list of auth types
Expand Down
3 changes: 1 addition & 2 deletions lib/http/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,7 @@ void
Client::registration_token_validity(const std::string token,
Callback<mtx::responses::RegistrationTokenValidity> cb)
{
const auto api_path = "/client/unstable/org.matrix.msc3231/register/"
"org.matrix.msc3231.login.registration_token/validity?" +
const auto api_path = "/client/v1/register/m.login.registration_token/validity?" +
mtx::client::utils::query_params({{"token", token}});

get<mtx::responses::RegistrationTokenValidity>(
Expand Down
2 changes: 1 addition & 1 deletion tests/requests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ TEST(Requests, UserInteractiveAuth)

a.content = auth::RegistrationToken{"<token>"};
EXPECT_EQ(nlohmann::json(a), R"({
"type": "org.matrix.msc3231.login.registration_token",
"type": "m.login.registration_token",
"token": "<token>",
"session": "<session ID>"
})"_json);
Expand Down

0 comments on commit 87d2826

Please sign in to comment.