Interface TwoFactorMethod<TwoFactorRequestRegisterData, TwoFactorConfirmRegisterData>

Interface for a two factor method.

interface TwoFactorMethod<
    TwoFactorRequestRegisterData,
    TwoFactorConfirmRegisterData,
> {
    confirmRegisterForUser: <
        Role extends string,
        UserType extends BaseUser<Role>,
    >(
        user: UserType,
        data: TwoFactorConfirmRegisterData,
    ) => void | Promise<void>;
    init: () => void;
    requestRegisterForUser: <
        Role extends string,
        UserType extends BaseUser<Role>,
    >(
        user: UserType,
        data: TwoFactorRequestRegisterData,
    ) => void | Promise<void>;
    unregisterForUser: <Role extends string, UserType extends BaseUser<Role>>(
        user: UserType,
    ) => void | Promise<void>;
    validate: <Role extends string, UserType extends BaseUser<Role>>(
        user: UserType,
        request: HttpRequest | WebsocketRequest,
    ) => void | Promise<void>;
}

Type Parameters

  • TwoFactorRequestRegisterData
  • TwoFactorConfirmRegisterData

Implemented by

Properties

confirmRegisterForUser: <Role extends string, UserType extends BaseUser<Role>>(
    user: UserType,
    data: TwoFactorConfirmRegisterData,
) => void | Promise<void>

Confirms the registration of the two factor method for the given user.

init: () => void

Initializes the two factor method.

requestRegisterForUser: <Role extends string, UserType extends BaseUser<Role>>(
    user: UserType,
    data: TwoFactorRequestRegisterData,
) => void | Promise<void>

Requests to register the two factor method for the given user.

unregisterForUser: <Role extends string, UserType extends BaseUser<Role>>(
    user: UserType,
) => void | Promise<void>

Removes the two factor method from the given user.

validate: <Role extends string, UserType extends BaseUser<Role>>(
    user: UserType,
    request: HttpRequest | WebsocketRequest,
) => void | Promise<void>

Validates that the given request has a valid second factor.