Skip to main content

TwoFactor <CustomUser>

Index

Constructors

constructor

Methods

publicauthenticate

  • authenticate(user: User, code: string): Promise<void>
  • Authenticate a user with a 2fa code


    Parameters

    • user: User
    • code: string

    Returns Promise<void>

publicgetNewAuthSecret

  • getNewAuthSecret(): GeneratedSecret
  • Generate a new two factor secret


    Returns GeneratedSecret

publicset

  • set(userId: string, secret: GeneratedSecret, code: string): Promise<void>
  • Verify the code is correct Add the code to the user profile Throw if user already have 2fa enabled


    Parameters

    • userId: string
    • secret: GeneratedSecret
    • code: string

    Returns Promise<void>

publicsetUserStore

  • setUserStore(store: DatabaseInterfaceUser<CustomUser>): void
  • Set two factor store


    Parameters

    • store: DatabaseInterfaceUser<CustomUser>

    Returns void

publicunset

  • unset(userId: string, code: string): Promise<void>
  • Remove two factor for a user


    Parameters

    • userId: string
    • code: string

    Returns Promise<void>