From 170d7a5e555358eb93d307d4579fe0806618f705 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 5 Jan 2022 12:45:41 +0530 Subject: [PATCH] Add startRegistration method --- src/matrix/Client.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/matrix/Client.js b/src/matrix/Client.js index f070d24c..bc35703a 100644 --- a/src/matrix/Client.js +++ b/src/matrix/Client.js @@ -30,6 +30,7 @@ import {PasswordLoginMethod} from "./login/PasswordLoginMethod"; import {TokenLoginMethod} from "./login/TokenLoginMethod"; import {SSOLoginHelper} from "./login/SSOLoginHelper"; import {getDehydratedDevice} from "./e2ee/Dehydration.js"; +import {Registration} from "./registration/Registration"; export const LoadStatus = createEnum( "NotLoading", @@ -131,6 +132,19 @@ export class Client { }); } + async startRegistration(homeserver, username, password, initialDeviceDisplayName) { + const request = this._platform.request; + const hsApi = new HomeServerApi({homeserver, request}); + const registration = new Registration(hsApi, { + username, + password, + initialDeviceDisplayName, + inhibitLogin: true + }); + let stage = await registration.start(); + return stage; + } + async startWithLogin(loginMethod, {inspectAccountSetup} = {}) { const currentStatus = this._status.get(); if (currentStatus !== LoadStatus.LoginFailed &&