Add/update endpoints for requesting account management tokens
This commit is contained in:
parent
4a0e0e8bfe
commit
097bd6a86c
11
CHANGELOG.md
11
CHANGELOG.md
@ -13,6 +13,10 @@ Breaking changes:
|
||||
* Move `r0::sync::get_state_events` to `r0::state::get_state_events`
|
||||
* Move `r0::sync::get_state_events_for_empty_key` to `r0::state::get_state_events_for_empty_key`
|
||||
* Move `r0::sync::get_state_events_for_key` to `r0::state::get_state_events_for_key`
|
||||
* Update endpoints for requesting account management tokens via email:
|
||||
* Move `r0::account::request_password_change_token` to `r0::account::request_password_change_token_via_email`
|
||||
* Move `r0::account::request_register_token` to `r0::account::request_registration_token_via_email`
|
||||
* Modify `r0::account::request_registration_token_via_email` not to be rate-limited and require authentication
|
||||
|
||||
Improvements:
|
||||
|
||||
@ -23,6 +27,11 @@ Improvements:
|
||||
* Add `r0::keys` endpoints (introduced in r0.3.0)
|
||||
* Add `r0::session::get_login_types` (introduced in r0.4.0)
|
||||
* Add `r0::account::get_username_availability` (introduced in r0.4.0)
|
||||
* Add endpoints to request management tokens (introduced upstream in r0.4.0):
|
||||
* `r0::account::request_3pid_management_token_via_msisdn`
|
||||
* `r0::account::request_password_change_token_via_msisdn`
|
||||
* `r0::account::request_registration_token_via_msisdn`
|
||||
* `r0::acount::request_3pid_management_token_via_email`
|
||||
|
||||
# 0.5.0
|
||||
|
||||
@ -42,4 +51,4 @@ Improvements:
|
||||
* Add `r0::appservice::set_room_visibility` (part of application service extensions for the client-server API)
|
||||
* Add `contains_url` to `r0::filter::RoomEventFilter` (introduced upstream in r0.3.0)
|
||||
* Update `r0::account::change_password` from r0.3.0 to r0.6.0
|
||||
* Add optional `auth` field
|
||||
* Add optional `auth` field
|
@ -4,8 +4,13 @@ pub mod change_password;
|
||||
pub mod deactivate;
|
||||
pub mod get_username_availability;
|
||||
pub mod register;
|
||||
pub mod request_password_change_token;
|
||||
pub mod request_register_token;
|
||||
pub mod request_3pid_management_token_via_email;
|
||||
pub mod request_3pid_management_token_via_msisdn;
|
||||
pub mod request_password_change_token_via_email;
|
||||
pub mod request_password_change_token_via_msisdn;
|
||||
pub mod request_registration_token_via_email;
|
||||
pub mod request_registration_token_via_msisdn;
|
||||
|
||||
pub mod whoami;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -19,3 +24,14 @@ pub struct AuthenticationData {
|
||||
/// The value of the session key given by the homeserver.
|
||||
session: Option<String>,
|
||||
}
|
||||
|
||||
/// Additional authentication information for requestToken endpoints.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct IdentityServerInfo {
|
||||
/// The ID server to send the onward request to as a hostname with an
|
||||
/// appended colon and port number if the port is not the default.
|
||||
/// Deprecated since r0.6.0.
|
||||
pub id_server: String,
|
||||
/// Access token previously registered with identity server.
|
||||
pub id_access_token: String,
|
||||
}
|
||||
|
41
src/r0/account/request_3pid_management_token_via_email.rs
Normal file
41
src/r0/account/request_3pid_management_token_via_email.rs
Normal file
@ -0,0 +1,41 @@
|
||||
//! [POST /_matrix/client/r0/account/3pid/email/requestToken](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-account-3pid-email-requesttoken)
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
|
||||
use super::IdentityServerInfo;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
description: "Request a 3PID management token with a 3rd party email.",
|
||||
method: POST,
|
||||
name: "request_3pid_association_token_via_email",
|
||||
path: "/_matrix/client/r0/account/3pid/email/requestToken",
|
||||
rate_limited: false,
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
request {
|
||||
/// Client-generated secret string used to protect this session.
|
||||
pub client_secret: String,
|
||||
/// The email address.
|
||||
pub email: String,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the email.
|
||||
pub send_attempt: UInt,
|
||||
/// Return URL for identity server to redirect the client back to.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub next_link: Option<String>,
|
||||
/// Optional identity server hostname and access token. Deprecated since r0.6.0.
|
||||
#[serde(flatten)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub identity_server_info: Option<IdentityServerInfo>,
|
||||
}
|
||||
|
||||
response {
|
||||
/// The session identifier given by the identity server.
|
||||
pub sid: String,
|
||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub submit_url: Option<String>
|
||||
}
|
||||
}
|
43
src/r0/account/request_3pid_management_token_via_msisdn.rs
Normal file
43
src/r0/account/request_3pid_management_token_via_msisdn.rs
Normal file
@ -0,0 +1,43 @@
|
||||
//! [POST /_matrix/client/r0/account/3pid/msisdn/requestToken](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-account-3pid-msisdn-requesttoken)
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
|
||||
use super::IdentityServerInfo;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
description: "Request a 3PID management token with a phone number.",
|
||||
method: POST,
|
||||
name: "request_3pid_association_token_via_msisdn",
|
||||
path: "/_matrix/client/r0/account/3pid/msisdn/requestToken",
|
||||
rate_limited: false,
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
request {
|
||||
/// Client-generated secret string used to protect this session.
|
||||
pub client_secret: String,
|
||||
/// Two-letter ISO 3166 country code for the phone number.
|
||||
pub country: String,
|
||||
/// Phone number to validate.
|
||||
pub phone_number: String,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the SMS.
|
||||
pub send_attempt: UInt,
|
||||
/// Return URL for identity server to redirect the client back to.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub next_link: Option<String>,
|
||||
/// Optional identity server hostname and access token. Deprecated since r0.6.0.
|
||||
#[serde(flatten)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub identity_server_info: Option<IdentityServerInfo>,
|
||||
}
|
||||
|
||||
response {
|
||||
/// The session identifier given by the identity server.
|
||||
pub sid: String,
|
||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub submit_url: Option<String>
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
//! [POST /_matrix/client/r0/account/password/email/requestToken](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-account-password-email-requesttoken)
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
description: "Request that a password change token is sent to the given email address.",
|
||||
method: POST,
|
||||
name: "request_password_change_token",
|
||||
path: "/_matrix/client/r0/account/password/email/requestToken",
|
||||
rate_limited: false,
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
request {
|
||||
/// TODO: This parameter is not documented in the spec.
|
||||
pub client_secret: String,
|
||||
/// TODO: This parameter is not documented in the spec.
|
||||
pub email: String,
|
||||
/// TODO: This parameter is not documented in the spec.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub id_server: Option<String>,
|
||||
/// TODO: This parameter is not documented in the spec.
|
||||
pub send_attempt: UInt,
|
||||
}
|
||||
|
||||
response {}
|
||||
}
|
41
src/r0/account/request_password_change_token_via_email.rs
Normal file
41
src/r0/account/request_password_change_token_via_email.rs
Normal file
@ -0,0 +1,41 @@
|
||||
//! [POST /_matrix/client/r0/account/password/email/requestToken](https://matrix.org/docs/spec/client_server/r0.6.0.html#post-matrix-client-r0-account-password-email-requesttoken)
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
|
||||
use super::IdentityServerInfo;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
description: "Request that a password change token is sent to the given email address.",
|
||||
method: POST,
|
||||
name: "request_password_change_token_via_email",
|
||||
path: "/_matrix/client/r0/account/password/email/requestToken",
|
||||
rate_limited: false,
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
request {
|
||||
/// Client-generated secret string used to protect this session.
|
||||
pub client_secret: String,
|
||||
/// The email address.
|
||||
pub email: String,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the email.
|
||||
pub send_attempt: UInt,
|
||||
/// Return URL for identity server to redirect the client back to.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub next_link: Option<String>,
|
||||
/// Optional identity server hostname and access token. Deprecated since r0.6.0.
|
||||
#[serde(flatten)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub identity_server_info: Option<IdentityServerInfo>,
|
||||
}
|
||||
|
||||
response {
|
||||
/// The session identifier given by the identity server.
|
||||
pub sid: String,
|
||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub submit_url: Option<String>
|
||||
}
|
||||
}
|
37
src/r0/account/request_password_change_token_via_msisdn.rs
Normal file
37
src/r0/account/request_password_change_token_via_msisdn.rs
Normal file
@ -0,0 +1,37 @@
|
||||
//! [POST /_matrix/client/r0/account/password/msisdn/requestToken](https://matrix.org/docs/spec/client_server/r0.6.0.html#post-matrix-client-r0-account-password-msisdn-requesttoken)
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
description: "Request that a password change token is sent to the given phone number.",
|
||||
method: POST,
|
||||
name: "request_password_change_token_via_msisdn",
|
||||
path: "/_matrix/client/r0/account/password/msisdn/requestToken",
|
||||
rate_limited: false,
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
request {
|
||||
/// Client-generated secret string used to protect this session.
|
||||
pub client_secret: String,
|
||||
/// Two-letter ISO 3166 country code for the phone number.
|
||||
pub country: String,
|
||||
/// Phone number to validate.
|
||||
pub phone_number: String,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the SMS.
|
||||
pub send_attempt: UInt,
|
||||
/// Return URL for identity server to redirect the client back to.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub next_link: Option<String>,
|
||||
}
|
||||
|
||||
response {
|
||||
/// The session identifier given by the identity server.
|
||||
pub sid: String,
|
||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub submit_url: Option<String>
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
//! [POST /_matrix/client/r0/register/email/requestToken](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-register-email-requesttoken)
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
description: "Request a register token with a 3rd party email.",
|
||||
method: POST,
|
||||
name: "request_register_token",
|
||||
path: "/_matrix/client/r0/register/email/requestToken",
|
||||
rate_limited: true,
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
request {
|
||||
/// Client-generated secret string used to protect this session.
|
||||
pub client_secret: String,
|
||||
/// The email address.
|
||||
pub email: String,
|
||||
/// The ID server to send the onward request to as a hostname with an appended colon and port number if the port is not the default.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub id_server: Option<String>,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the email.
|
||||
pub send_attempt: UInt,
|
||||
}
|
||||
|
||||
response {}
|
||||
}
|
41
src/r0/account/request_registration_token_via_email.rs
Normal file
41
src/r0/account/request_registration_token_via_email.rs
Normal file
@ -0,0 +1,41 @@
|
||||
//! [POST /_matrix/client/r0/register/email/requestToken](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register-email-requesttoken)
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
|
||||
use super::IdentityServerInfo;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
description: "Request a registration token with a 3rd party email.",
|
||||
method: POST,
|
||||
name: "request_registration_token_via_email",
|
||||
path: "/_matrix/client/r0/register/email/requestToken",
|
||||
rate_limited: false,
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
request {
|
||||
/// Client-generated secret string used to protect this session.
|
||||
pub client_secret: String,
|
||||
/// The email address.
|
||||
pub email: String,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the email.
|
||||
pub send_attempt: UInt,
|
||||
/// Return URL for identity server to redirect the client back to.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub next_link: Option<String>,
|
||||
/// Optional identity server hostname and access token. Deprecated since r0.6.0.
|
||||
#[serde(flatten)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub identity_server_info: Option<IdentityServerInfo>,
|
||||
}
|
||||
|
||||
response {
|
||||
/// The session identifier given by the identity server.
|
||||
pub sid: String,
|
||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub submit_url: Option<String>
|
||||
}
|
||||
}
|
43
src/r0/account/request_registration_token_via_msisdn.rs
Normal file
43
src/r0/account/request_registration_token_via_msisdn.rs
Normal file
@ -0,0 +1,43 @@
|
||||
//! [POST /_matrix/client/r0/register/msisdn/requestToken](https://matrix.org/docs/spec/client_server/r0.6.0.html#post-matrix-client-r0-register-msisdn-requesttoken)
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
|
||||
use super::IdentityServerInfo;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
description: "Request a registration token with a phone number.",
|
||||
method: POST,
|
||||
name: "request_registration_token_via_msisdn",
|
||||
path: "/_matrix/client/r0/register/msisdn/requestToken",
|
||||
rate_limited: false,
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
request {
|
||||
/// Client-generated secret string used to protect this session.
|
||||
pub client_secret: String,
|
||||
/// Two-letter ISO 3166 country code for the phone number.
|
||||
pub country: String,
|
||||
/// Phone number to validate.
|
||||
pub phone_number: String,
|
||||
/// Return URL for identity server to redirect the client back to.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub next_link: Option<String>,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the SMS.
|
||||
pub send_attempt: UInt,
|
||||
/// Optional identity server hostname and access token. Deprecated since r0.6.0.
|
||||
#[serde(flatten)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub identity_server_info: Option<IdentityServerInfo>,
|
||||
}
|
||||
|
||||
response {
|
||||
/// The session identifier given by the identity server.
|
||||
pub sid: String,
|
||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub submit_url: Option<String>
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user