diff --git a/src/@types/another-json.ts b/src/@types/another-json.d.ts similarity index 100% rename from src/@types/another-json.ts rename to src/@types/another-json.d.ts diff --git a/src/autodiscovery.ts b/src/autodiscovery.ts index 0457175f3..f4a341596 100644 --- a/src/autodiscovery.ts +++ b/src/autodiscovery.ts @@ -47,7 +47,7 @@ interface WellKnownConfig extends Omit { error?: IWellKnownConfig["error"] | null; } -interface ClientConfig extends Omit { +export interface ClientConfig extends Omit { "m.homeserver": WellKnownConfig; "m.identity_server": WellKnownConfig; } diff --git a/src/client.ts b/src/client.ts index ad00c95a9..a48d58e5d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -573,6 +573,8 @@ export interface IWellKnownConfig { error?: Error | string; // eslint-disable-next-line base_url?: string | null; + // XXX: this is undocumented + server_name?: string; } export interface IDelegatedAuthConfig { diff --git a/src/interactive-auth.ts b/src/interactive-auth.ts index e4baefa6d..7d9c183f5 100644 --- a/src/interactive-auth.ts +++ b/src/interactive-auth.ts @@ -24,7 +24,7 @@ import { MatrixError } from "./http-api"; const EMAIL_STAGE_TYPE = "m.login.email.identity"; const MSISDN_STAGE_TYPE = "m.login.msisdn"; -interface IFlow { +export interface UIAFlow { stages: AuthType[]; } @@ -48,8 +48,8 @@ export interface IAuthData { session?: string; type?: string; completed?: string[]; - flows?: IFlow[]; - available_flows?: IFlow[]; + flows?: UIAFlow[]; + available_flows?: UIAFlow[]; stages?: string[]; required_stages?: AuthType[]; params?: Record>; @@ -101,7 +101,7 @@ class NoAuthFlowFoundError extends Error { public name = "NoAuthFlowFoundError"; // eslint-disable-next-line @typescript-eslint/naming-convention, camelcase - public constructor(m: string, public readonly required_stages: string[], public readonly flows: IFlow[]) { + public constructor(m: string, public readonly required_stages: string[], public readonly flows: UIAFlow[]) { super(m); } } @@ -198,7 +198,7 @@ export class InteractiveAuth { private emailSid?: string; private requestingEmailToken = false; private attemptAuthDeferred: IDeferred | null = null; - private chosenFlow: IFlow | null = null; + private chosenFlow: UIAFlow | null = null; private currentStage: string | null = null; private emailAttempt = 1; @@ -320,7 +320,7 @@ export class InteractiveAuth { return this.data.params?.[loginType]; } - public getChosenFlow(): IFlow | null { + public getChosenFlow(): UIAFlow | null { return this.chosenFlow; } @@ -573,7 +573,7 @@ export class InteractiveAuth { * @returns flow * @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found */ - private chooseFlow(): IFlow { + private chooseFlow(): UIAFlow { const flows = this.data.flows || []; // we've been given an email or we've already done an email part @@ -610,7 +610,7 @@ export class InteractiveAuth { * @internal * @returns login type */ - private firstUncompletedStage(flow: IFlow): AuthType | undefined { + private firstUncompletedStage(flow: UIAFlow): AuthType | undefined { const completed = this.data.completed || []; return flow.stages.find((stageType) => !completed.includes(stageType)); }