diff --git a/protocol-spec/account-login-by-username.md b/protocol-spec/account-login-by-username.md index cec0e6d..8874e4d 100644 --- a/protocol-spec/account-login-by-username.md +++ b/protocol-spec/account-login-by-username.md @@ -89,7 +89,7 @@ interface LoginRequestPayload { ```typescript interface LoginResponsePayload { /** - * Authentication token which required for various user actions (UUID) + * Authentication token which required for various user actions (static SHA256 hash string from 4096 random characters) */ authToken: string, @@ -99,4 +99,4 @@ interface LoginResponsePayload { */ deviceID: string } -``` \ No newline at end of file +``` diff --git a/protocol-spec/account-registration.md b/protocol-spec/account-registration.md index f2d8dd3..2e981ea 100644 --- a/protocol-spec/account-registration.md +++ b/protocol-spec/account-registration.md @@ -16,7 +16,7 @@ This extension is intended for creating user accounts on a server ## Use cases -### Basic registration flow (with CAPTCHA) +### Basic registration flow - Client: @@ -80,7 +80,7 @@ interface RegistrationRequestPayload { /** * The username that the user wants to register */ - username: string, + username?: string, /** * Array of user third party IDs (email and/or MSISDN) @@ -90,7 +90,12 @@ interface RegistrationRequestPayload { /** * Password of new account */ - password: string + password: string, + + /** + * Login to freshly created user account when registration will be completed + */ + loginOnSuccess: boolean } interface ThirdPartyID { @@ -113,6 +118,11 @@ interface RegistrationResponsePayload { /** * ID of user (Username in priority. If we haven't username, then we put to this field one of user's third party IDs) */ - userID: EntityID + userID: EntityID, + + /** + * Property with login payload (can be omit if property loginOnSuccess wasn't indicated true in RegistrationRequestPayload) + */ + loginPayload?: LoginResponsePayload } ``` diff --git a/protocol-spec/core.md b/protocol-spec/core.md index d3f7165..3cadefb 100644 --- a/protocol-spec/core.md +++ b/protocol-spec/core.md @@ -3,6 +3,9 @@ - [Protocol Core](#protocol-core) - [Transport](#transport) - [Entity ID](#entity-id) + - [Server-part](#server-part) + - [Username/Room alias/RoomID](#usernameroom-aliasroomid) + - [Special business rules](#special-business-rules) - [BaseMessage](#basemessage) ## Transport @@ -16,18 +19,20 @@ For starting we simply use JSON + Websockets. - User ID with any 3PID: `%:@` - Currently supported only following types: `email` and `msisdn`. - Raw User ID: `@@` -- Message ID: `&@` +- Message ID: `&@` - Room ID: `!@` - Single server-part: `` -**Server-part**: +### Server-part - hostname: `IPv4 / [IPv6] / dns-domain:` (for end-users use) -- server ID: static SHA256 hash string from 4096 characters (for internal protocol use) +- server ID: static SHA256 hash string from 4096 characters (for internal protocol use) -**Username/Room alias/RoomID** - MUST NOT be empty, and MUST contain only the characters `a-z`, `0-9`, `.`, `_`, `=`, `-`, and `/`. +### Username/Room alias/RoomID -**Special business rules**: +MUST NOT be empty, and MUST contain only the characters `a-z`, `0-9`, `.`, `_`, `=`, `-`, and `/`. + +### Special business rules - RoomID SHOULD be UUID identifier. - Servers MUST use server ID in internal purposes instead of normal server-part with hostname. Only end-users MUST use normal server-part with hostname. This is done for easy multi-domain serving. @@ -60,10 +65,15 @@ interface BaseMessage { to: EntityID, /** - * Operation success indicator (used to determine if the error happened while processing request) + * Operation success indicator (used to determine if the error happened while processing request) - MUST be only in response from server */ ok: boolean, + /** + * Authentication token string (can be omit if the action does not require user authentication) - MUST be only in request messages from client + */ + authToken?: string, + /** * Message payload (used to store extra information in message, list of permissible fields in the payload depends on "type" field) */