This commit is contained in:
ChronosX88 2019-12-29 17:01:35 +04:00
parent ddef4e794b
commit 7474e63fd3
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A
3 changed files with 32 additions and 12 deletions

View File

@ -89,7 +89,7 @@ interface LoginRequestPayload {
```typescript ```typescript
interface LoginResponsePayload { 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, authToken: string,

View File

@ -16,7 +16,7 @@ This extension is intended for creating user accounts on a server
## Use cases ## Use cases
### Basic registration flow (with CAPTCHA) ### Basic registration flow
- Client: - Client:
@ -80,7 +80,7 @@ interface RegistrationRequestPayload {
/** /**
* The username that the user wants to register * The username that the user wants to register
*/ */
username: string, username?: string,
/** /**
* Array of user third party IDs (email and/or MSISDN) * Array of user third party IDs (email and/or MSISDN)
@ -90,7 +90,12 @@ interface RegistrationRequestPayload {
/** /**
* Password of new account * Password of new account
*/ */
password: string password: string,
/**
* Login to freshly created user account when registration will be completed
*/
loginOnSuccess: boolean
} }
interface ThirdPartyID { 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) * 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
} }
``` ```

View File

@ -3,6 +3,9 @@
- [Protocol Core](#protocol-core) - [Protocol Core](#protocol-core)
- [Transport](#transport) - [Transport](#transport)
- [Entity ID](#entity-id) - [Entity ID](#entity-id)
- [Server-part](#server-part)
- [Username/Room alias/RoomID](#usernameroom-aliasroomid)
- [Special business rules](#special-business-rules)
- [BaseMessage](#basemessage) - [BaseMessage](#basemessage)
## Transport ## Transport
@ -16,18 +19,20 @@ For starting we simply use JSON + Websockets.
- User ID with any 3PID: `%<type>:<data>@<serverpart>` - User ID with any 3PID: `%<type>:<data>@<serverpart>`
- Currently supported only following types: `email` and `msisdn`. - Currently supported only following types: `email` and `msisdn`.
- Raw User ID: `@<UUID>@<serverpart>` - Raw User ID: `@<UUID>@<serverpart>`
- Message ID: `&<uuid>@<serverpart (from which server the message was sent)>` - Message ID: `&<uuid>@<serverpart (of source server)>`
- Room ID: `!<roomID>@<serverpart>` - Room ID: `!<roomID>@<serverpart>`
- Single server-part: `<serverpart>` - Single server-part: `<serverpart>`
**Server-part**: ### Server-part
- hostname: `IPv4 / [IPv6] / dns-domain:<port (1-65535)>` (for end-users use) - hostname: `IPv4 / [IPv6] / dns-domain:<port (1-65535)>` (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. - 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. - 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, 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, 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) * Message payload (used to store extra information in message, list of permissible fields in the payload depends on "type" field)
*/ */