Skip to main content

QMFAService

@quik/mfa


@quik/mfa / QMFAService

Class: QMFAService

Defined in: mfa/src/QMFAService.ts:51

Service for issuing and verifying MFA challenges.

Extends

  • QService

Constructors

Constructor

new QMFAService(options?): QMFAService

Defined in: mfa/src/QMFAService.ts:62

Creates a service instance.

Parameters

options?

IQMFAChallengeStore | QMFAServiceOptions

Returns

QMFAService

Overrides

QService.constructor

Properties

_language?

protected optional _language?: string

Defined in: services/src/QService.ts:17

Inherited from

QService._language


_user

protected _user: IQUser

Defined in: services/src/QService.ts:16

Inherited from

QService._user


challengeStore

protected readonly challengeStore: IQMFAChallengeStore

Defined in: mfa/src/QMFAService.ts:53

Challenge persistence implementation.


policyEngine?

protected readonly optional policyEngine?: IQMFAPolicyEngine

Defined in: mfa/src/QMFAService.ts:55

Policy engine used for request resolution and risk/step-up hooks.

Accessors

language

Get Signature

get protected language(): string

Defined in: services/src/QService.ts:27

Returns

string

Set Signature

set protected language(value): void

Defined in: services/src/QService.ts:31

Parameters
value

string

Returns

void

Inherited from

QService.language


logger

Get Signature

get protected logger(): IQLogger

Defined in: core/src/QObject.ts:15

The logger getter for the object.

Returns

IQLogger

Inherited from

QService.logger


name

Get Signature

get name(): string

Defined in: core/src/QObject.ts:8

Returns

string

Inherited from

QService.name


user

Get Signature

get protected user(): IQUser

Defined in: services/src/QService.ts:19

Returns

IQUser

Set Signature

set protected user(newUser): void

Defined in: services/src/QService.ts:23

Parameters
newUser

IQUser

Returns

void

Inherited from

QService.user

Methods

assertEnabled()

assertEnabled(): void

Defined in: mfa/src/QMFAService.ts:218

Throws when MFA support is disabled in configuration.

Returns

void

Throws

MFADisabledError When mfa.enabled is false.


cleanup()

cleanup(): number

Defined in: mfa/src/QMFAService.ts:209

Removes expired or consumed challenges.

Returns

number


clone()

clone<T>(properties?): T

Defined in: services/src/QService.ts:40

Creates a clone of the current service.

Type Parameters

T

T extends QService = QService

Parameters

properties?

Record<string, any>

A list of properties that you want to pass to the new instance.

Returns

T

Inherited from

QService.clone


createTOTPEnrollment()

createTOTPEnrollment(input): QMFATOTPEnrollment

Defined in: mfa/src/QMFAService.ts:169

Creates a TOTP enrollment payload consumable by authenticator apps.

Parameters

input

QMFATOTPEnrollmentInput | Partial<QMFATOTPEnrollmentInput>

Enrollment request payload.

Returns

QMFATOTPEnrollment


endSpan()

protected endSpan(span): void

Defined in: core/src/QObject.ts:35

End a span returned by startSpan.

Parameters

span

TelemetrySpan

The span to end.

Returns

void

Inherited from

QService.endSpan


executeCommand()

protected executeCommand<T>(command, args?): Promise<void>

Defined in: services/src/QService.ts:106

Executes a CLI command if the CLI module is loaded.

Type Parameters

T

T = any

Parameters

command

string

The command to execute.

args?

T

Arguments passed to the command.

Returns

Promise<void>

Inherited from

QService.executeCommand


getLanguageStore()

protected getLanguageStore(): IQI18n

Defined in: services/src/QService.ts:116

Retrieves the i18n store in use by the application.

Returns

IQI18n

Inherited from

QService.getLanguageStore


hasModule()

protected hasModule(module): boolean

Defined in: services/src/QService.ts:96

Checks if a module has been registered in the bootstrapper.

Parameters

module

string

Returns

boolean

Inherited from

QService.hasModule


init()

init(): Promise<void>

Defined in: services/src/QService.ts:82

Method used to perform some initializations in the class.

Returns

Promise<void>

Inherited from

QService.init


recordSpanError()

protected recordSpanError(span, err): void

Defined in: core/src/QObject.ts:45

Record an exception on an active span.

Parameters

span

TelemetrySpan

The span to record the error on.

err

unknown

The error to record.

Returns

void

Inherited from

QService.recordSpanError


requestChallenge()

requestChallenge<TMetadata>(input): Promise<QMFAChallenge>

Defined in: mfa/src/QMFAService.ts:80

Issues a new MFA challenge for the requested factor method.

Type Parameters

TMetadata

TMetadata extends Record<string, unknown> = Record<string, unknown>

Parameters

input

QMFATypedRequestInput<TMetadata> | Partial<QMFATypedRequestInput<TMetadata>>

Challenge request payload.

Returns

Promise<QMFAChallenge>


scope()

scope(scope?): QMFAService

Defined in: services/src/QService.ts:55

Creates a scoped clone of the current service.

Parameters

scope?

IQServiceScope

The scope applied to the cloned instance.

Returns

QMFAService

Inherited from

QService.scope


session()

session(user, properties?): QMFAService

Defined in: services/src/QService.ts:75

Creates a session bound to a specific user.

Parameters

user

IQUser

The user to attach to the service instance.

properties?

Record<string, any>

Extra properties applied when cloning the service.

Returns

QMFAService

Inherited from

QService.session


setSpanAttribute()

protected setSpanAttribute(span, key, value): void

Defined in: core/src/QObject.ts:64

Set a single attribute on an active span.

Parameters

span

TelemetrySpan

The span to update.

key

string

Attribute key.

value

string | number | boolean

Attribute value.

Returns

void

Inherited from

QService.setSpanAttribute


shutdown()

shutdown(): Promise<void>

Defined in: services/src/QService.ts:89

Method used to clean up resources before shutdown.

Returns

Promise<void>

Inherited from

QService.shutdown


startSpan()

protected startSpan(spanName, options?): TelemetrySpan

Defined in: core/src/QObject.ts:26

Start a telemetry span for the given operation name. Returns undefined when no telemetry provider is active.

Parameters

spanName

string

Name of the span.

options?

TelemetrySpanOptions

Optional span attributes and kind.

Returns

TelemetrySpan

Inherited from

QService.startSpan


translate()

protected translate(key, options): string

Defined in: services/src/QService.ts:126

Helper method to translate a key using the i18n store.

Parameters

key

string

The translation key.

options

Record<string, any>

The interpolation options.

Returns

string

Inherited from

QService.translate


verifyChallenge()

verifyChallenge(input): Promise<QMFAVerifyResult>

Defined in: mfa/src/QMFAService.ts:107

Verifies a challenge attempt and updates challenge lifecycle state.

Parameters

input

QMFAVerifyRequestInput | Partial<QMFAVerifyRequestInput>

Verification payload.

Returns

Promise<QMFAVerifyResult>