AccountsMfa

@accounts/mfaGlobalsAccountsMfa

Type parameters

CustomUser: User

Hierarchy

  • AccountsMfa

Implements

  • AuthenticationService

Index

Constructors

Properties

Methods

Constructors

constructor

+ new AccountsMfa(options: AccountsMfaOptions): AccountsMfa

Defined in accounts-mfa.ts:52

Parameters:

NameType
optionsAccountsMfaOptions

Returns: AccountsMfa

Properties

server

server: AccountsServer

Defined in accounts-mfa.ts:49


serviceName

serviceName: string = "mfa"

Defined in accounts-mfa.ts:48

Methods

associate

associate(userId: string, factorName: string, params: any, infos: ConnectionInformations): Promise‹any›

Defined in accounts-mfa.ts:185

description Start the association of a new authenticator.

throws AssociateError

Parameters:

NameTypeDescription
userIdstringUser id to link the new authenticator.
factorNamestring-
paramsanyParams for the the authenticator service.
infosConnectionInformationsUser connection informations.

Returns: Promise‹any›


associateByMfaToken

associateByMfaToken(mfaToken: string, factorName: string, params: any, infos: ConnectionInformations): Promise‹any›

Defined in accounts-mfa.ts:211

description Start the association of a new authenticator, this method is called when the user is enforced to associate an authenticator before the first login.

throws AssociateByMfaTokenError

Parameters:

NameTypeDescription
mfaTokenstring-
factorNamestring-
paramsanyParams for the the authenticator service.
infosConnectionInformationsUser connection informations.

Returns: Promise‹any›


authenticate

authenticate(params: AccountsMfaAuthenticateParams, infos: ConnectionInformations): Promise‹CustomUser | null›

Defined in accounts-mfa.ts:74

throws AuthenticateErrors

Parameters:

NameType
paramsAccountsMfaAuthenticateParams
infosConnectionInformations

Returns: Promise‹CustomUser | null›


challenge

challenge(mfaToken: string, authenticatorId: string, infos: ConnectionInformations): Promise‹any›

Defined in accounts-mfa.ts:128

description Request a challenge for the MFA authentication.

throws ChallengeErrors

Parameters:

NameTypeDescription
mfaTokenstringA valid mfa token you obtained during the login process.
authenticatorIdstringThe ID of the authenticator to challenge.
infosConnectionInformationsUser connection informations.

Returns: Promise‹any›


findUserAuthenticators

findUserAuthenticators(userId: string): Promise‹Authenticator[]›

Defined in accounts-mfa.ts:245

description Return the list of the active and inactive authenticators for this user. The authenticators objects are whitelisted to not expose any sensitive informations to the client. If you want to get all the fields from the database, use the database findUserAuthenticators method directly.

Parameters:

NameTypeDescription
userIdstringUser id linked to the authenticators.

Returns: Promise‹Authenticator[]›


findUserAuthenticatorsByMfaToken

findUserAuthenticatorsByMfaToken(mfaToken: string): Promise‹Authenticator[]›

Defined in accounts-mfa.ts:258

description Return the list of the active authenticators for this user.

throws FindUserAuthenticatorsByMfaTokenError

Parameters:

NameTypeDescription
mfaTokenstringA valid mfa token you obtained during the login process.

Returns: Promise‹Authenticator[]›


isMfaChallengeValid

isMfaChallengeValid(mfaChallenge: MfaChallenge): boolean

Defined in accounts-mfa.ts:275

Parameters:

NameType
mfaChallengeMfaChallenge

Returns: boolean


setStore

setStore(store: DatabaseInterface‹CustomUser›): void

Defined in accounts-mfa.ts:63

Parameters:

NameType
storeDatabaseInterface‹CustomUser›

Returns: void