Skip to main content

Abstract Class: BaseAuthTOTPRoute<U, A, S>

Defined in: src/routes/BaseAuthTOTPRoute.ts:21

Extended by

Type Parameters

U

U extends User

A

A extends Alias

S

S extends Secret

Constructors

Constructor

new BaseAuthTOTPRoute<U, A, S>(): BaseAuthTOTPRoute<U, A, S>

Returns

BaseAuthTOTPRoute<U, A, S>

Properties

aliasClass

abstract protected aliasClass: any

Defined in: src/routes/BaseAuthTOTPRoute.ts:22


authMiddleware?

protected optional authMiddleware?: AuthMiddleware

Defined in: src/routes/BaseAuthTOTPRoute.ts:27


jwtConfig?

protected optional jwtConfig?: any

Defined in: src/routes/BaseAuthTOTPRoute.ts:30


messagingUtils?

protected optional messagingUtils?: MessagingUtils

Defined in: src/routes/BaseAuthTOTPRoute.ts:36


objectFactory?

protected optional objectFactory?: ObjectFactory

Defined in: src/routes/BaseAuthTOTPRoute.ts:33


secretClass

abstract protected secretClass: any

Defined in: src/routes/BaseAuthTOTPRoute.ts:23


secretRepo?

protected optional secretRepo?: RepoUtils<S>

Defined in: src/routes/BaseAuthTOTPRoute.ts:38


template

protected template: string = "login-otp"

Defined in: src/routes/BaseAuthTOTPRoute.ts:41

The name of the messaging template to use for sending notifications.


userClass

abstract protected userClass: any

Defined in: src/routes/BaseAuthTOTPRoute.ts:24


userUtils?

protected optional userUtils?: UserUtils<U, A>

Defined in: src/routes/BaseAuthTOTPRoute.ts:43

Methods

authenticate()

authenticate(user): Promise<AuthResult | undefined>

Defined in: src/routes/BaseAuthTOTPRoute.ts:92

Authenticates the user using TOTP and returns a JSON Web Token access token to be used with future API requests.

Parameters

user

JWTUser

Returns

Promise<AuthResult | undefined>


getSecrets()

protected getSecrets(uid): Promise<TOTPSecret[]>

Defined in: src/routes/BaseAuthTOTPRoute.ts:100

Parameters

uid

string

Returns

Promise<TOTPSecret[]>


getUser()

protected getUser(uid): Promise<JWTUser | undefined>

Defined in: src/routes/BaseAuthTOTPRoute.ts:123

Retrieves the user with the given unique id.

Parameters

uid

string

The unique id of the user to retrieve.

Returns

Promise<JWTUser | undefined>

The user if found, otherwise undefined.


initialize()

protected initialize(): Promise<void>

Defined in: src/routes/BaseAuthTOTPRoute.ts:49

Called on server startup to initialize the route with any defaults.

Returns

Promise<void>