Skip to main content

Class: OTPStrategyOptions

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

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

Constructors

Constructor

new OTPStrategyOptions(): OTPStrategyOptions

Returns

OTPStrategyOptions

Properties

allowDiscovery?

optional allowDiscovery?: boolean

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

Set to true to enable discovery of a user's aliases. Default is false.

Be careful enabling this as it can be used as a way for an attacker to discover sensitive information.


headerKey

headerKey: string = "authorization"

Defined in: src/auth/OTPStrategy.ts:22

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


headerScheme

headerScheme: string = "otp"

Defined in: src/auth/OTPStrategy.ts:24

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

Methods

getContact()

getContact(id): Promise<OTPContact | undefined>

Defined in: src/auth/OTPStrategy.ts:30

Retrieves the user's contact information for a given id. NOTE: You must override this function when using this strategy.

Parameters

id

string

The unique id of the contact to retrieve.

Returns

Promise<OTPContact | undefined>


getContacts()

getContacts(id): Promise<OTPContact[]>

Defined in: src/auth/OTPStrategy.ts:38

Retrieves the list of available contacts for the user with the given id. NOTE: You must override this function when using this strategy.

Parameters

id

string

The unique id of the user.

Returns

Promise<OTPContact[]>


getUser()

getUser(uid): Promise<JWTUser | undefined>

Defined in: src/auth/OTPStrategy.ts:46

Retrieves the user data for the given unique identifier after authentication has completed successfully. NOTE: You must override this function when using this strategy.

Parameters

uid

string

Returns

Promise<JWTUser | undefined>


notifyContact()

notifyContact(contact, token): Promise<void>

Defined in: src/auth/OTPStrategy.ts:55

Sends a notification to the specified contact with the provided OTP token. NOTE: You must override this function when using this strategy.

Parameters

contact

OTPContact

The contact to send the OTP token to.

token

string

The OTP token to send to the user.

Returns

Promise<void>