-
-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve types around login, registration, UIA and identity servers #3537
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2ddecf5
Improve login types
t3chguy a41ffba
Improve types around identity server APIs
t3chguy ac6f64b
Improve types around registration
t3chguy 5832a7a
Improve types around UIA
t3chguy 6b75f52
Fix types around account deactivation
t3chguy 1483391
Improve types around UIA furtherr
t3chguy 418e135
Iterate
t3chguy 4248253
Merge branch 'develop' of github.com:matrix-org/matrix-js-sdk into t3…
t3chguy d8895a6
s/d.ts/ts/
t3chguy bf4fca0
Fix comments
t3chguy 72aa7a3
Simplify `data` field
t3chguy e3b2137
Merge branch 'develop' of github.com:matrix-org/matrix-js-sdk into t3…
t3chguy 4c25672
Update isRelation
t3chguy 47677df
Just for you rich
t3chguy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
Copyright 2023 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. | ||
*/ | ||
|
||
import { AuthDict } from "../interactive-auth"; | ||
|
||
/** | ||
* The request body of a call to `POST /_matrix/client/v3/register` | ||
t3chguy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3register | ||
*/ | ||
export interface RegisterRequest { | ||
/** | ||
* Additional authentication information for the user-interactive authentication API. | ||
* Note that this information is not used to define how the registered user should be authenticated, | ||
* but is instead used to authenticate the register call itself. | ||
*/ | ||
auth?: AuthDict; | ||
/** | ||
* The basis for the localpart of the desired Matrix ID. | ||
* If omitted, the homeserver MUST generate a Matrix ID local part. | ||
*/ | ||
username?: string; | ||
/** | ||
* The desired password for the account. | ||
*/ | ||
password?: string; | ||
/** | ||
* If true, the client supports refresh tokens. | ||
*/ | ||
refresh_token?: boolean; | ||
/** | ||
* If true, an access_token and device_id should not be returned from this call, therefore preventing an automatic login. | ||
* Defaults to false. | ||
*/ | ||
inhibit_login?: boolean; | ||
/** | ||
* A display name to assign to the newly-created device. | ||
* Ignored if device_id corresponds to a known device. | ||
*/ | ||
initial_device_display_name?: string; | ||
/** | ||
* @deprecated missing in the spec | ||
*/ | ||
guest_access_token?: string; | ||
/** | ||
* @deprecated missing in the spec | ||
*/ | ||
x_show_msisdn?: boolean; | ||
/** | ||
* @deprecated missing in the spec | ||
*/ | ||
bind_msisdn?: boolean; | ||
/** | ||
* @deprecated missing in the spec | ||
*/ | ||
bind_email?: boolean; | ||
} | ||
|
||
/** | ||
* The result of a successful call to `POST /_matrix/client/v3/register` | ||
* | ||
* @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3register | ||
*/ | ||
export interface RegisterResponse { | ||
/** | ||
* The fully-qualified Matrix user ID (MXID) that has been registered. | ||
*/ | ||
user_id: string; | ||
/** | ||
* An access token for the account. | ||
* This access token can then be used to authorize other requests. | ||
* Required if the inhibit_login option is false. | ||
*/ | ||
access_token?: string; | ||
/** | ||
* ID of the registered device. | ||
* Will be the same as the corresponding parameter in the request, if one was specified. | ||
* Required if the inhibit_login option is false. | ||
*/ | ||
device_id?: string; | ||
/** | ||
* 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. | ||
* | ||
* Omitted if the inhibit_login option is true. | ||
*/ | ||
expires_in_ms?: number; | ||
/** | ||
* 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. | ||
*/ | ||
refresh_token?: string; | ||
/** | ||
* The server_name of the homeserver on which the account has been registered. | ||
* | ||
* @deprecated Clients should extract the server_name from user_id (by splitting at the first colon) if they require it. | ||
*/ | ||
home_server?: string; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is certainly helpful, but for bonus points it would be nice to say where this thing is used: if I look at https://pr3537--js-sdk-docs-previews.netlify.app/stable/types/_internal_.userloginidentifier it's just somewhat lacking in context.
Anyway no need to change this now but something I think we could be better at in future.