Skip to main content

Abstract Class: BaseAuthOTPRoute<U, A, S>

Defined in: src/routes/BaseAuthOTPRoute.ts:32

Extended by

Type Parameters

U

U extends User

A

A extends Alias

S

S extends Secret

Constructors

Constructor

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

Returns

BaseAuthOTPRoute<U, A, S>

Properties

aliasClass

abstract protected aliasClass: any

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


aliasRepo?

protected optional aliasRepo?: RepoUtils<A>

Defined in: src/routes/BaseAuthOTPRoute.ts:40


authMiddleware?

protected optional authMiddleware?: AuthMiddleware

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


defaultScopes

protected defaultScopes: string[] = []

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


jwtConfig?

protected optional jwtConfig?: any

Defined in: src/routes/BaseAuthOTPRoute.ts:52


logger

protected logger: any

Defined in: src/routes/BaseAuthOTPRoute.ts:46


messagingUtils?

protected optional messagingUtils?: MessagingUtils

Defined in: src/routes/BaseAuthOTPRoute.ts:55


rateLimiter?

protected optional rateLimiter?: RateLimiter

Defined in: src/routes/BaseAuthOTPRoute.ts:58


secretClass

abstract protected secretClass: any

Defined in: src/routes/BaseAuthOTPRoute.ts:34


secretRepo?

protected optional secretRepo?: RepoUtils<S>

Defined in: src/routes/BaseAuthOTPRoute.ts:60


template

protected template: string = "login-otp"

Defined in: src/routes/BaseAuthOTPRoute.ts:63

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


tokenUtils?

protected optional tokenUtils?: TokenUtils

Defined in: src/routes/BaseAuthOTPRoute.ts:66


userClass

abstract protected userClass: any

Defined in: src/routes/BaseAuthOTPRoute.ts:35


userRepo?

protected optional userRepo?: RepoUtils<U>

Defined in: src/routes/BaseAuthOTPRoute.ts:68


userUtils?

protected optional userUtils?: UserUtils<U, A>

Defined in: src/routes/BaseAuthOTPRoute.ts:70

Methods

authenticate()

authenticate(user, req, res): Promise<AuthResult | undefined>

Defined in: src/routes/BaseAuthOTPRoute.ts:137

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

Parameters

user

JWTUser

req

HttpRequest

res

HttpResponse

Returns

Promise<AuthResult | undefined>


convertAliasType()

protected convertAliasType(type): OTPContactType

Defined in: src/routes/BaseAuthOTPRoute.ts:145

Parameters

type

AliasType

Returns

OTPContactType


getContact()

protected getContact(id): Promise<OTPContact | undefined>

Defined in: src/routes/BaseAuthOTPRoute.ts:161

Retrieves the alias with the given unique id.

Parameters

id

string

The unique id of the alias to retrieve.

Returns

Promise<OTPContact | undefined>

The alias if found, otherwise undefined.


getContacts()

protected getContacts(id): Promise<OTPContact[]>

Defined in: src/routes/BaseAuthOTPRoute.ts:184

Retrieves all aliases for the user with the given id.

Parameters

id

string

The unique id of the user to lookup.

Returns

Promise<OTPContact[]>


getUser()

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

Defined in: src/routes/BaseAuthOTPRoute.ts:228

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/BaseAuthOTPRoute.ts:76

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

Returns

Promise<void>


notifyContact()

protected notifyContact(contact, totp): Promise<void>

Defined in: src/routes/BaseAuthOTPRoute.ts:235

Parameters

contact

OTPContact

totp

string

Returns

Promise<void>