Skip to main content

Class: TOTPStrategyOptions

Defined in: src/auth/TOTPStrategy.ts:14

Describes the configuration options that can be used to initialize TOTPStrategy.

Constructors

Constructor

new TOTPStrategyOptions(): TOTPStrategyOptions

Returns

TOTPStrategyOptions

Properties

allowQueryParam

allowQueryParam: boolean = false

Defined in: src/auth/TOTPStrategy.ts:26

Set to true to allow credentials to be supplied via the queryKey URL parameter. Disabled by default — query parameters appear in server logs, browser history, and Referer headers, which permanently exposes credentials outside the application.


headerKey

headerKey: string = "authorization"

Defined in: src/auth/TOTPStrategy.ts:16

The name of the header to look for when performing header based authentication. Default value is Authorization.


headerScheme

headerScheme: string = "totp"

Defined in: src/auth/TOTPStrategy.ts:18

The authorization scheme type when using header based authentication. Default value is jwt.


queryKey

queryKey: string = "auth_totp"

Defined in: src/auth/TOTPStrategy.ts:20

The name of the request query parameter to retrieve the token from when using query based authentication. Default value is auth_totp.

Methods

getSecrets()

getSecrets(uid): Promise<TOTPSecret[]>

Defined in: src/auth/TOTPStrategy.ts:32

Retrieves the stored TOTP secrets for the user with the given unique identifier. NOTE: You must override this function when using this strategy.

Parameters

uid

string

Returns

Promise<TOTPSecret[]>


getUser()

getUser(id): Promise<JWTUser | undefined>

Defined in: src/auth/TOTPStrategy.ts:40

Retrieves the user data for the given unique identifier. NOTE: You must override this function when using this strategy.

Parameters

id

string

The unique id of the user that has been successfully authenticated.

Returns

Promise<JWTUser | undefined>