aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/registration.h
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2022-10-06 19:27:24 +0200
committern-peugnet <n.peugnet@free.fr>2022-10-06 19:27:24 +0200
commit08632625e1a04257b5c7d4a9db2246ac07436748 (patch)
tree9ddadf219a7e352ddd3549ad1683282c944adfb6 /lib/csapi/registration.h
parente9c2e2a26d3711e755aa5eb8a8478917c71d612b (diff)
parentd911b207f49e936b3e992200796110f0749ed150 (diff)
downloadlibquotient-08632625e1a04257b5c7d4a9db2246ac07436748.tar.gz
libquotient-08632625e1a04257b5c7d4a9db2246ac07436748.zip
Update upstream source from tag 'upstream/0.7.0'
Update to upstream version '0.7.0' with Debian dir 30dcb77a77433e4a54eab77c0b82ae925dead2d8
Diffstat (limited to 'lib/csapi/registration.h')
-rw-r--r--lib/csapi/registration.h71
1 files changed, 45 insertions, 26 deletions
diff --git a/lib/csapi/registration.h b/lib/csapi/registration.h
index ae8fc162..21d7f9d7 100644
--- a/lib/csapi/registration.h
+++ b/lib/csapi/registration.h
@@ -59,7 +59,7 @@ namespace Quotient {
* Any user ID returned by this API must conform to the grammar given in the
* [Matrix specification](/appendices/#user-identifiers).
*/
-class RegisterJob : public BaseJob {
+class QUOTIENT_API RegisterJob : public BaseJob {
public:
/*! \brief Register for an account on this homeserver.
*
@@ -93,6 +93,9 @@ public:
* If true, an `access_token` and `device_id` should not be
* returned from this call, therefore preventing an automatic
* login. Defaults to false.
+ *
+ * \param refreshToken
+ * If true, the client supports refresh tokens.
*/
explicit RegisterJob(const QString& kind = QStringLiteral("user"),
const Omittable<AuthenticationData>& auth = none,
@@ -100,7 +103,8 @@ public:
const QString& password = {},
const QString& deviceId = {},
const QString& initialDeviceDisplayName = {},
- Omittable<bool> inhibitLogin = none);
+ Omittable<bool> inhibitLogin = none,
+ Omittable<bool> refreshToken = none);
// Result properties
@@ -118,15 +122,27 @@ public:
return loadFromJson<QString>("access_token"_ls);
}
- /// The server_name of the homeserver on which the account has
- /// been registered.
+ /// 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.
+ ///
+ /// Omitted if the `inhibit_login` option is true.
+ QString refreshToken() const
+ {
+ return loadFromJson<QString>("refresh_token"_ls);
+ }
+
+ /// The lifetime of the access token, in milliseconds. Once
+ /// the access token has expired a new access token can be
+ /// obtained by using the provided refresh token. If no
+ /// refresh token is provided, the client will need to re-log in
+ /// to obtain a new access token. If not given, the client can
+ /// assume that the access token will not expire.
///
- /// **Deprecated**. Clients should extract the server_name from
- /// `user_id` (by splitting at the first colon) if they require
- /// it. Note also that `homeserver` is not spelt this way.
- QString homeServer() const
+ /// Omitted if the `inhibit_login` option is true.
+ Omittable<int> expiresInMs() const
{
- return loadFromJson<QString>("home_server"_ls);
+ return loadFromJson<Omittable<int>>("expires_in_ms"_ls);
}
/// ID of the registered device. Will be the same as the
@@ -143,7 +159,7 @@ public:
* should validate the email itself, either by sending a validation email
* itself or by using a service it has control over.
*/
-class RequestTokenToRegisterEmailJob : public BaseJob {
+class QUOTIENT_API RequestTokenToRegisterEmailJob : public BaseJob {
public:
/*! \brief Begins the validation process for an email to be used during
* registration.
@@ -175,7 +191,7 @@ public:
* should validate the phone number itself, either by sending a validation
* message itself or by using a service it has control over.
*/
-class RequestTokenToRegisterMSISDNJob : public BaseJob {
+class QUOTIENT_API RequestTokenToRegisterMSISDNJob : public BaseJob {
public:
/*! \brief Requests a validation token be sent to the given phone number for
* the purpose of registering an account
@@ -215,7 +231,7 @@ public:
* access token provided in the request. Whether other access tokens for
* the user are revoked depends on the request parameters.
*/
-class ChangePasswordJob : public BaseJob {
+class QUOTIENT_API ChangePasswordJob : public BaseJob {
public:
/*! \brief Changes a user's password.
*
@@ -227,14 +243,15 @@ public:
* should be revoked if the request succeeds.
*
* When `false`, the server can still take advantage of the [soft logout
- * method](/client-server-api/#soft-logout) for the user's remaining devices.
+ * method](/client-server-api/#soft-logout) for the user's remaining
+ * devices.
*
* \param auth
* Additional authentication information for the user-interactive
* authentication API.
*/
explicit ChangePasswordJob(const QString& newPassword,
- Omittable<bool> logoutDevices = none,
+ bool logoutDevices = true,
const Omittable<AuthenticationData>& auth = none);
};
@@ -247,7 +264,7 @@ public:
* `/account/password` endpoint.
*
* This API's parameters and response are identical to that of the
- * [`/register/email/requestToken`](/client-server-api/#post_matrixclientr0registeremailrequesttoken)
+ * [`/register/email/requestToken`](/client-server-api/#post_matrixclientv3registeremailrequesttoken)
* endpoint, except that
* `M_THREEPID_NOT_FOUND` may be returned if no account matching the
* given email address could be found. The server may instead send an
@@ -257,7 +274,7 @@ public:
* The homeserver should validate the email itself, either by sending a
* validation email itself or by using a service it has control over.
*/
-class RequestTokenToResetPasswordEmailJob : public BaseJob {
+class QUOTIENT_API RequestTokenToResetPasswordEmailJob : public BaseJob {
public:
/*! \brief Requests a validation token be sent to the given email address
* for the purpose of resetting a user's password
@@ -269,7 +286,7 @@ public:
* `/account/password` endpoint.
*
* This API's parameters and response are identical to that of the
- * [`/register/email/requestToken`](/client-server-api/#post_matrixclientr0registeremailrequesttoken)
+ * [`/register/email/requestToken`](/client-server-api/#post_matrixclientv3registeremailrequesttoken)
* endpoint, except that
* `M_THREEPID_NOT_FOUND` may be returned if no account matching the
* given email address could be found. The server may instead send an
@@ -299,7 +316,7 @@ public:
* `/account/password` endpoint.
*
* This API's parameters and response are identical to that of the
- * [`/register/msisdn/requestToken`](/client-server-api/#post_matrixclientr0registermsisdnrequesttoken)
+ * [`/register/msisdn/requestToken`](/client-server-api/#post_matrixclientv3registermsisdnrequesttoken)
* endpoint, except that
* `M_THREEPID_NOT_FOUND` may be returned if no account matching the
* given phone number could be found. The server may instead send the SMS
@@ -309,7 +326,7 @@ public:
* The homeserver should validate the phone number itself, either by sending a
* validation message itself or by using a service it has control over.
*/
-class RequestTokenToResetPasswordMSISDNJob : public BaseJob {
+class QUOTIENT_API RequestTokenToResetPasswordMSISDNJob : public BaseJob {
public:
/*! \brief Requests a validation token be sent to the given phone number for
* the purpose of resetting a user's password.
@@ -321,15 +338,16 @@ public:
* `/account/password` endpoint.
*
* This API's parameters and response are identical to that of the
- * [`/register/msisdn/requestToken`](/client-server-api/#post_matrixclientr0registermsisdnrequesttoken)
+ * [`/register/msisdn/requestToken`](/client-server-api/#post_matrixclientv3registermsisdnrequesttoken)
* endpoint, except that
* `M_THREEPID_NOT_FOUND` may be returned if no account matching the
* given phone number could be found. The server may instead send the SMS
* to the given phone number prompting the user to create an account.
* `M_THREEPID_IN_USE` may not be returned.
*
- * The homeserver should validate the phone number itself, either by sending
- * a validation message itself or by using a service it has control over.
+ * The homeserver should validate the phone number itself, either by
+ * sending a validation message itself or by using a service it has control
+ * over.
*/
explicit RequestTokenToResetPasswordMSISDNJob(
const MsisdnValidationData& body);
@@ -361,7 +379,7 @@ public:
* parameter because the homeserver is expected to sign the request to the
* identity server instead.
*/
-class DeactivateAccountJob : public BaseJob {
+class QUOTIENT_API DeactivateAccountJob : public BaseJob {
public:
/*! \brief Deactivate a user's account.
*
@@ -377,8 +395,9 @@ public:
* it must return an `id_server_unbind_result` of
* `no-support`.
*/
- explicit DeactivateAccountJob(const Omittable<AuthenticationData>& auth = none,
- const QString& idServer = {});
+ explicit DeactivateAccountJob(
+ const Omittable<AuthenticationData>& auth = none,
+ const QString& idServer = {});
// Result properties
@@ -411,7 +430,7 @@ public:
* reserve the username. This can mean that the username becomes unavailable
* between checking its availability and attempting to register it.
*/
-class CheckUsernameAvailabilityJob : public BaseJob {
+class QUOTIENT_API CheckUsernameAvailabilityJob : public BaseJob {
public:
/*! \brief Checks to see if a username is available on the server.
*