forked from mystiq/hydrogen-web
Add startRegistration method
This commit is contained in:
parent
8ab8726b8f
commit
170d7a5e55
1 changed files with 14 additions and 0 deletions
|
@ -30,6 +30,7 @@ import {PasswordLoginMethod} from "./login/PasswordLoginMethod";
|
||||||
import {TokenLoginMethod} from "./login/TokenLoginMethod";
|
import {TokenLoginMethod} from "./login/TokenLoginMethod";
|
||||||
import {SSOLoginHelper} from "./login/SSOLoginHelper";
|
import {SSOLoginHelper} from "./login/SSOLoginHelper";
|
||||||
import {getDehydratedDevice} from "./e2ee/Dehydration.js";
|
import {getDehydratedDevice} from "./e2ee/Dehydration.js";
|
||||||
|
import {Registration} from "./registration/Registration";
|
||||||
|
|
||||||
export const LoadStatus = createEnum(
|
export const LoadStatus = createEnum(
|
||||||
"NotLoading",
|
"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} = {}) {
|
async startWithLogin(loginMethod, {inspectAccountSetup} = {}) {
|
||||||
const currentStatus = this._status.get();
|
const currentStatus = this._status.get();
|
||||||
if (currentStatus !== LoadStatus.LoginFailed &&
|
if (currentStatus !== LoadStatus.LoginFailed &&
|
||||||
|
|
Loading…
Reference in a new issue