interface IOpts<T> {
    authData?: IAuthData;
    clientSecret?: string;
    emailSid?: string;
    inputs?: IInputs;
    matrixClient: MatrixClient;
    sessionId?: string;
    supportedStages?: string[];
    busyChanged?(busy): void;
    doRequest(auth, background): Promise<T>;
    requestEmailToken(email, secret, attempt, session): Promise<{
        sid: string;
    }>;
    startAuthStage?(nextStage): Promise<void>;
    stateUpdated(nextStage, status): void;
}

Type Parameters

  • T

Properties

authData?: IAuthData

Error response from the last request. If null, a request will be made with no auth before starting.

clientSecret?: string

If resuming an existing interactive auth session, the client secret for that session

emailSid?: string

If returning from having completed m.login.email.identity auth, the sid for the email verification session.

inputs?: IInputs

Inputs provided by the user and used by different stages of the auto process. The inputs provided will affect what flow is chosen.

matrixClient: MatrixClient

A matrix client to use for the auth process

sessionId?: string

If resuming an existing interactive auth session, the sessionId of that session.

supportedStages?: string[]

If specified, will prefer flows which entirely consist of listed stages. These should normally be of type AuthTypes but can be string when supporting custom auth stages.

This can be used to avoid needing the fallback mechanism.

Methods

  • Called whenever the interactive auth logic becomes busy submitting information provided by the user or finishes. After this has been called with true the UI should indicate that a request is in progress until it is called again with false.

    Parameters

    • busy: boolean

    Returns void

  • Called with the new auth dict to submit the request. Also passes a second deprecated arg which is a flag set to true if this request is a background request. The busyChanged callback should be used instead of the background flag. Should return a promise which resolves to the successful response or rejects with a MatrixError.

    Parameters

    • auth: null | AuthDict
    • background: boolean

    Returns Promise<T>

  • A function that takes the email address (string), clientSecret (string), attempt number (int) and sessionId (string) and calls the relevant requestToken function and returns the promise returned by that function. If the resulting promise rejects, the rejection will propagate through to the attemptAuth promise.

    Parameters

    • email: string
    • secret: string
    • attempt: number
    • session: string

    Returns Promise<{
        sid: string;
    }>

  • Called when the status of the UI auth changes, ie. when the state of an auth stage changes of when the auth flow moves to a new stage. The arguments are: the login type (eg m.login.password); and an object which is either an error or an informational object specific to the login type. If the 'errcode' key is defined, the object is an error, and has keys: errcode: string, the textual error code, eg. M_UNKNOWN error: string, human readable string describing the error

    The login type specific objects are as follows: m.login.email.identity: * emailSid: string, the sid of the active email auth session

    Parameters

    Returns void

Generated using TypeDoc