diff --git a/crates/ruma-client-api/CHANGELOG.md b/crates/ruma-client-api/CHANGELOG.md index 5e885e4b..2706cf9f 100644 --- a/crates/ruma-client-api/CHANGELOG.md +++ b/crates/ruma-client-api/CHANGELOG.md @@ -8,12 +8,9 @@ Breaking changes: Improvements: -* Add unstable support for refresh tokens (MSC2918) +* Add support for refresh tokens (MSC2918) * Add `ErrorKind::{UnableToAuthorizeJoin, UnableToGrantJoin}` encountered for restricted rooms * Add unstable support for timestamp massaging (MSC3316) - -Improvements: - * Add unstable support for querying relating events (MSC2675) * Move `filter::RelationType` to `ruma_common::events::relations` * Add unstable support for discovering an OpenID Connect server (MSC2965) diff --git a/crates/ruma-client-api/Cargo.toml b/crates/ruma-client-api/Cargo.toml index e77d5355..febdb8c4 100644 --- a/crates/ruma-client-api/Cargo.toml +++ b/crates/ruma-client-api/Cargo.toml @@ -25,7 +25,6 @@ unstable-msc2654 = [] unstable-msc2675 = [] unstable-msc2676 = [] unstable-msc2677 = [] -unstable-msc2918 = [] unstable-msc2965 = [] unstable-msc3316 = [] unstable-msc3440 = [] diff --git a/crates/ruma-client-api/src/account/register.rs b/crates/ruma-client-api/src/account/register.rs index ccbd7ad8..06d19d8e 100644 --- a/crates/ruma-client-api/src/account/register.rs +++ b/crates/ruma-client-api/src/account/register.rs @@ -7,7 +7,6 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3register - #[cfg(feature = "unstable-msc2918")] use std::time::Duration; use ruma_common::{api::ruma_api, DeviceId, OwnedDeviceId, OwnedUserId}; @@ -85,8 +84,9 @@ pub mod v3 { #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub login_type: Option<&'a LoginType>, - /// If set to `true`, the client supports refresh tokens. - #[cfg(feature = "unstable-msc2918")] + /// If set to `true`, the client supports [refresh tokens]. + /// + /// [refresh tokens]: https://spec.matrix.org/v1.3/client-server-api/#refreshing-access-tokens #[serde( default, skip_serializing_if = "ruma_common::serde::is_default", @@ -115,13 +115,15 @@ pub mod v3 { /// Required if the request's `inhibit_login` was set to `false`. pub device_id: Option, - /// A refresh token for the account. + /// A [refresh token] for the account. /// /// This token can be used to obtain a new access token when it expires by calling the - /// `/refresh` endpoint. + /// [`refresh_token`] endpoint. /// /// Omitted if the request's `inhibit_login` was set to `true`. - #[cfg(feature = "unstable-msc2918")] + /// + /// [refresh token]: https://spec.matrix.org/v1.3/client-server-api/#refreshing-access-tokens + /// [`refresh_token`]: crate::session::refresh_token #[serde(skip_serializing_if = "Option::is_none")] pub refresh_token: Option, @@ -134,7 +136,6 @@ pub mod v3 { /// If this is `None`, the client can assume that the access token will not expire. /// /// Omitted if the request's `inhibit_login` was set to `true`. - #[cfg(feature = "unstable-msc2918")] #[serde( with = "ruma_common::serde::duration::opt_ms", default, @@ -161,9 +162,7 @@ pub mod v3 { access_token: None, user_id, device_id: None, - #[cfg(feature = "unstable-msc2918")] refresh_token: None, - #[cfg(feature = "unstable-msc2918")] expires_in: None, } } diff --git a/crates/ruma-client-api/src/session.rs b/crates/ruma-client-api/src/session.rs index dd9c4b0c..9dde673d 100644 --- a/crates/ruma-client-api/src/session.rs +++ b/crates/ruma-client-api/src/session.rs @@ -5,7 +5,6 @@ pub mod login; pub mod login_fallback; pub mod logout; pub mod logout_all; -#[cfg(feature = "unstable-msc2918")] pub mod refresh_token; pub mod sso_login; pub mod sso_login_with_provider; diff --git a/crates/ruma-client-api/src/session/login.rs b/crates/ruma-client-api/src/session/login.rs index 6ccf1cdd..035e8b76 100644 --- a/crates/ruma-client-api/src/session/login.rs +++ b/crates/ruma-client-api/src/session/login.rs @@ -5,7 +5,6 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3login - #[cfg(feature = "unstable-msc2918")] use std::time::Duration; use ruma_common::{ @@ -48,8 +47,9 @@ pub mod v3 { #[serde(skip_serializing_if = "Option::is_none")] pub initial_device_display_name: Option<&'a str>, - /// If set to `true`, the client supports refresh tokens. - #[cfg(feature = "unstable-msc2918")] + /// If set to `true`, the client supports [refresh tokens]. + /// + /// [refresh tokens]: https://spec.matrix.org/v1.3/client-server-api/#refreshing-access-tokens #[serde( default, skip_serializing_if = "ruma_common::serde::is_default", @@ -85,11 +85,13 @@ pub mod v3 { #[serde(skip_serializing_if = "Option::is_none")] pub well_known: Option, - /// A refresh token for the account. + /// A [refresh token] for the account. /// /// This token can be used to obtain a new access token when it expires by calling the - /// `/refresh` endpoint. - #[cfg(feature = "unstable-msc2918")] + /// [`refresh_token`] endpoint. + /// + /// [refresh token]: https://spec.matrix.org/v1.3/client-server-api/#refreshing-access-tokens + /// [`refresh_token`]: crate::session::refresh_token #[serde(skip_serializing_if = "Option::is_none")] pub refresh_token: Option, @@ -100,7 +102,6 @@ pub mod v3 { /// re-login to obtain a new access token. /// /// If this is `None`, the client can assume that the access token will not expire. - #[cfg(feature = "unstable-msc2918")] #[serde( with = "ruma_common::serde::duration::opt_ms", default, @@ -120,7 +121,6 @@ pub mod v3 { login_info, device_id: None, initial_device_display_name: None, - #[cfg(feature = "unstable-msc2918")] refresh_token: false, } } @@ -135,9 +135,7 @@ pub mod v3 { home_server: None, device_id, well_known: None, - #[cfg(feature = "unstable-msc2918")] refresh_token: None, - #[cfg(feature = "unstable-msc2918")] expires_in: None, } } @@ -424,7 +422,6 @@ pub mod v3 { login_info: LoginInfo::Token(Token { token: "0xdeadbeef" }), device_id: None, initial_device_display_name: Some("test"), - #[cfg(feature = "unstable-msc2918")] refresh_token: false, } .try_into_http_request( @@ -451,7 +448,6 @@ pub mod v3 { }), device_id: None, initial_device_display_name: Some("test"), - #[cfg(feature = "unstable-msc2918")] refresh_token: false, } .try_into_http_request( diff --git a/crates/ruma-client-api/src/session/refresh_token.rs b/crates/ruma-client-api/src/session/refresh_token.rs index 6ec4dd74..c75b0809 100644 --- a/crates/ruma-client-api/src/session/refresh_token.rs +++ b/crates/ruma-client-api/src/session/refresh_token.rs @@ -20,10 +20,10 @@ //! //! Application Service identity assertion is disabled for this endpoint. -pub mod unstable { - //! `/unstable/` (MSC2918) +pub mod v3 { + //! `/v3/` ([spec]) //! - //! [MSC2918]: https://github.com/matrix-org/matrix-spec-proposals/pull/2918 + //! [spec]: https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3refresh use std::time::Duration; @@ -35,8 +35,10 @@ pub mod unstable { method: POST, name: "refresh", unstable_path: "/_matrix/client/unstable/org.matrix.msc2918/refresh", + stable_path: "/_matrix/client/v3/refresh", rate_limited: true, authentication: None, + added: 1.3, } request: { diff --git a/crates/ruma/Cargo.toml b/crates/ruma/Cargo.toml index 5bea2f23..f0baa4a7 100644 --- a/crates/ruma/Cargo.toml +++ b/crates/ruma/Cargo.toml @@ -139,7 +139,6 @@ unstable-msc2677 = [ ] unstable-msc2746 = ["ruma-common/unstable-msc2746"] unstable-msc2870 = ["ruma-signatures?/unstable-msc2870"] -unstable-msc2918 = ["ruma-client-api?/unstable-msc2918"] unstable-msc3245 = ["ruma-common/unstable-msc3245"] unstable-msc3246 = ["ruma-common/unstable-msc3246"] unstable-msc3316 = ["ruma-client-api?/unstable-msc3316"] @@ -172,7 +171,6 @@ __ci = [ "unstable-msc2677", "unstable-msc2746", "unstable-msc2870", - "unstable-msc2918", "unstable-msc3245", "unstable-msc3246", "unstable-msc3316",