TwoFactor

@accounts/two-factorGlobalsTwoFactor

Hierarchy

  • TwoFactor

Index

Constructors

Methods

Constructors

constructor

+ new TwoFactor(options: AccountsTwoFactorOptions): TwoFactor

Defined in two-factor.ts:16

Parameters:

NameTypeDefault
optionsAccountsTwoFactorOptions{}

Returns: TwoFactor

Methods

authenticate

authenticate(user: User, code: string): Promise‹void›

Defined in two-factor.ts:32

Authenticate a user with a 2fa code

Parameters:

NameType
userUser
codestring

Returns: Promise‹void›


getNewAuthSecret

getNewAuthSecret(): Key

Defined in two-factor.ts:57

Generate a new two factor secret

Returns: Key


set

set(userId: string, secret: Key, code: string): Promise‹void›

Defined in two-factor.ts:69

Verify the code is correct Add the code to the user profile Throw if user already have 2fa enabled

Parameters:

NameType
userIdstring
secretKey
codestring

Returns: Promise‹void›


setStore

setStore(store: DatabaseInterface): void

Defined in two-factor.ts:25

Set two factor store

Parameters:

NameType
storeDatabaseInterface

Returns: void


unset

unset(userId: string, code: string): Promise‹void›

Defined in two-factor.ts:104

Remove two factor for a user

Parameters:

NameType
userIdstring
codestring

Returns: Promise‹void›